Skip to content

Commit

Permalink
Fixed formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
tehkillerbee committed Jul 16, 2023
1 parent cc1ce83 commit 157b1b4
Show file tree
Hide file tree
Showing 6 changed files with 30 additions and 54 deletions.
11 changes: 4 additions & 7 deletions tidalapi/album.py
Original file line number Diff line number Diff line change
Expand Up @@ -126,8 +126,7 @@ def parse(

@property
def year(self) -> Optional[int]:
"""
Convenience function to get the year using :class:`available_release_date`
"""Convenience function to get the year using :class:`available_release_date`
:return: An :any:`python:int` containing the year the track was released
"""
Expand All @@ -138,9 +137,8 @@ def available_release_date(self) -> Optional[datetime]:
"""Get the release date if it's available, otherwise get the day it was released
on TIDAL.
:return: A
:any:`python:datetime.datetime` object with the release date, or the tidal
release date, can be None
:return: A :any:`python:datetime.datetime` object with the release date, or the
tidal release date, can be None
"""
if self.release_date:
return self.release_date
Expand All @@ -153,8 +151,7 @@ def tracks(self, limit: Optional[int] = None, offset: int = 0) -> List["Track"]:
:param limit: The amount of items you want returned.
:param offset: The position of the first item you want to include.
:return: A list of the
:class:`Tracks <.Track>` in the album.
:return: A list of the :class:`Tracks <.Track>` in the album.
"""
params = {"limit": limit, "offset": offset}
tracks = self.requests.map_request(
Expand Down
24 changes: 8 additions & 16 deletions tidalapi/artist.py
Original file line number Diff line number Diff line change
Expand Up @@ -76,8 +76,7 @@ def parse_artists(self, json_obj) -> List["Artist"]:
inside of the python tidalapi module.
:param json_obj: Json data returned from api.tidal.com containing an artist
:return: Returns a copy of the original
:exc: 'Artist': object
:return: Returns a copy of the original :exc: 'Artist': object
"""
return list(map(self.parse_artist, json_obj))

Expand All @@ -89,35 +88,31 @@ def _get_albums(self, params=None):
def get_albums(self, limit=None, offset=0):
"""Queries TIDAL for the artists albums.
:return: A list of
:class:`Albums<tidalapi.album.Album>`
:return: A list of :class:`Albums<tidalapi.album.Album>`
"""
params = {"limit": limit, "offset": offset}
return self._get_albums(params)

def get_albums_ep_singles(self, limit=None, offset=0):
"""Queries TIDAL for the artists extended plays and singles.
:return: A list of
:class:`Albums <tidalapi.album.Album>`
:return: A list of :class:`Albums <tidalapi.album.Album>`
"""
params = {"filter": "EPSANDSINGLES", "limit": limit, "offset": offset}
return self._get_albums(params)

def get_albums_other(self, limit=None, offset=0):
"""Queries TIDAL for albums the artist has appeared on as a featured artist.
:return: A list of
:class:`Albums <tidalapi.album.Album>`
:return: A list of :class:`Albums <tidalapi.album.Album>`
"""
params = {"filter": "COMPILATIONS", "limit": limit, "offset": offset}
return self._get_albums(params)

def get_top_tracks(self, limit=None, offset=0):
"""Queries TIDAL for the artists tracks, sorted by popularity.
:return: A list of
:class:`Tracks <tidalapi.media.Track>`
:return: A list of :class:`Tracks <tidalapi.media.Track>`
"""
params = {"limit": limit, "offset": offset}
return self.request.map_request(
Expand All @@ -129,8 +124,7 @@ def get_top_tracks(self, limit=None, offset=0):
def get_videos(self, limit=None, offset=0):
"""Queries tidal for the artists videos.
:return: A list of
:class:`Videos <tidalapi.media.Video>`
:return: A list of :class:`Videos <tidalapi.media.Video>`
"""
params = {"limit": limit, "offset": offset}
return self.request.map_request(
Expand All @@ -149,8 +143,7 @@ def get_bio(self):
def get_similar(self):
"""Queries TIDAL for similar artists.
:return: A list of
:class:`Artists <tidalapi.artist.Artist>`
:return: A list of :class:`Artists <tidalapi.artist.Artist>`
"""
return self.request.map_request(
"artists/%s/similar" % self.id, parse=self.parse_artist
Expand All @@ -160,8 +153,7 @@ def get_radio(self):
"""Queries TIDAL for the artist radio, which is a mix of tracks that are similar
to what the artist makes.
:return: A list of
:class:`Tracks <tidalapi.media.Track>`
:return: A list of :class:`Tracks <tidalapi.media.Track>`
"""
params = {"limit": 100}
return self.request.map_request(
Expand Down
10 changes: 4 additions & 6 deletions tidalapi/media.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,14 +50,13 @@ class VideoQuality(Enum):


class Media:
"""
Base class for generic media, specifically :class:`Track` and :class:`Video`
"""Base class for generic media, specifically :class:`Track` and :class:`Video`
This class includes data used by both of the subclasses, and a function to parse
both of them.
The date_added attribute is only relevant for playlists.
For the release date of the actual media, use the release date of the album.
The date_added attribute is only relevant for playlists. For the release date of the
actual media, use the release date of the album.
"""

id = None
Expand Down Expand Up @@ -218,8 +217,7 @@ def get_track_radio(self) -> List["Track"]:
"""Queries TIDAL for the track radio, which is a mix of tracks that are similar
to this track.
:return: A list of
:class:`Tracks <tidalapi.media.Track>`
:return: A list of :class:`Tracks <tidalapi.media.Track>`
"""
params = {"limit": 100}
tracks = self.requests.map_request(
Expand Down
6 changes: 3 additions & 3 deletions tidalapi/mix.py
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ def get(self, mix_id: Optional[str] = None) -> "Mix":
return self

def parse(self, json_obj: JsonObj) -> "Mix":
"""Parse a mix into a :class:`Mix`, replaces the calling object
"""Parse a mix into a :class:`Mix`, replaces the calling object.
:param json_obj: The json of a mix to be parsed
:return: A copy of the parsed mix
Expand All @@ -119,8 +119,8 @@ def parse(self, json_obj: JsonObj) -> "Mix":
return copy.copy(self)

def items(self) -> List[Union["Video", "Track"]]:
"""
Returns all the items in the mix, retrieves them with :class:`get` as well if not already done
"""Returns all the items in the mix, retrieves them with :class:`get` as well if
not already done.
:return: A :class:`list` of videos and/or tracks from the mix
"""
Expand Down
23 changes: 8 additions & 15 deletions tidalapi/page.py
Original file line number Diff line number Diff line change
Expand Up @@ -159,8 +159,8 @@ def parse(self, json_obj):
return category.parse(json_obj)

def show_more(self):
"""
Get the full list of items on their own :class:`.Page` from a :class:`.PageCategory`
"""Get the full list of items on their own :class:`.Page` from a
:class:`.PageCategory`
:return: A :class:`.Page` more of the items in the category, None if there aren't any
"""
Expand Down Expand Up @@ -196,9 +196,7 @@ def parse(self, json_obj):


class PageLinks(PageCategory):
"""
A list of :class:`.PageLink` to other parts of TIDAL
"""
"""A list of :class:`.PageLink` to other parts of TIDAL."""

items: Optional[list["PageLink"]] = None

Expand Down Expand Up @@ -257,9 +255,7 @@ def parse(self, json_obj):


class PageLink(object):
"""
A Link to another :class:`.Page` on TIDAL, Call get() to retrieve the Page
"""
"""A Link to another :class:`.Page` on TIDAL, Call get() to retrieve the Page."""

title = None
icon = None
Expand All @@ -275,10 +271,8 @@ def __init__(self, session: "tidalapi.session.Session", json_obj):
self.image_id = json_obj["imageId"]

def get(self):
"""
Requests the linked page from TIDAL
:return: A :class:`Page` at the api_path
"""
"""Requests the linked page from TIDAL :return: A :class:`Page` at the
api_path."""
return self.request.map_request(
self.api_path,
params={"deviceType": "DESKTOP"},
Expand All @@ -287,9 +281,8 @@ def get(self):


class PageItem(object):
"""
An Item from a :class:`.PageCategory` from the /pages endpoint, call get() to retrieve the actual item
"""
"""An Item from a :class:`.PageCategory` from the /pages endpoint, call get() to
retrieve the actual item."""

header = ""
short_header = ""
Expand Down
10 changes: 3 additions & 7 deletions tidalapi/playlist.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,8 +65,7 @@ def parse(self, json_obj):
"""Parses a playlist from tidal, replaces the current playlist object.
:param json_obj: Json data returned from api.tidal.com containing a playlist
:return: Returns a copy of the original
:exc: 'Playlist': object
:return: Returns a copy of the original :exc: 'Playlist': object
"""
self.id = json_obj["uuid"]
self.name = json_obj["title"]
Expand Down Expand Up @@ -128,8 +127,7 @@ def tracks(self, limit: Optional[int] = None, offset=0) -> List[tidalapi.Track]:
:param limit: The amount of items you want returned.
:param offset: The index of the first item you want included.
:return: A list of
:class:`Tracks <.Track>`
:return: A list of :class:`Tracks <.Track>`
"""
params = {"limit": limit, "offset": offset}
request = self.requests.request(
Expand All @@ -145,9 +143,7 @@ def items(self, limit=100, offset=0):
:param limit: The amount of items you want, up to 100.
:param offset: The index of the first item you want returned
:return: A list of
:class:`Tracks<.Track>` and
:class:`Videos<.Video>`
:return: A list of :class:`Tracks<.Track>` and :class:`Videos<.Video>`
"""
params = {"limit": limit, "offset": offset}
request = self.requests.request(
Expand Down

0 comments on commit 157b1b4

Please sign in to comment.