3636
3737
3838class TidalPlugin (MetadataSourcePlugin ):
39- """Tidal metadata plugin.
40-
41- Allows to fetch metadata candidates from tidal.
42- """
43-
4439 def __init__ (self ) -> None :
4540 super ().__init__ ()
4641
@@ -168,8 +163,6 @@ def item_candidates(
168163 log .debug ("Found {0} candidates" , len (candidates ))
169164 return candidates
170165
171- # ---------------------------------- Search ---------------------------------- #
172-
173166 @staticmethod
174167 def _item_queries (item : Item ) -> Iterable [str ]:
175168 """Search queries for items."""
@@ -272,9 +265,8 @@ def search_tracks_by_ids(
272265 if item ["type" ] == "artists"
273266 }
274267
275- # Yield for IDs first
276- for id in _ids :
277- if id is not None and (track := track_lookup .get (id )):
268+ for _id in _ids :
269+ if _id is not None and (track := track_lookup .get (_id )):
278270 yield self ._get_track_info (track , artist_lookup = artist_lookup )
279271 else :
280272 yield None
@@ -339,9 +331,8 @@ def search_albums_by_ids(
339331 if item ["type" ] == "artists"
340332 }
341333
342- # Yield for IDs first
343- for id in _ids :
344- if id is not None and (album := album_lookup .get (id )):
334+ for _id in _ids :
335+ if _id is not None and (album := album_lookup .get (_id )):
345336 yield self ._get_album_info (
346337 album ,
347338 track_lookup = track_lookup ,
@@ -365,8 +356,6 @@ def search_albums_by_ids(
365356 else :
366357 yield None
367358
368- # ---------------------------------- Parsing --------------------------------- #
369-
370359 def _get_album_info (
371360 self ,
372361 album : TidalAlbum ,
@@ -413,7 +402,6 @@ def _get_track_info(
413402 track : TidalTrack ,
414403 artist_lookup : dict [str , TidalArtist ],
415404 ) -> TrackInfo :
416- # Artists are sorted in the track relationship
417405 artist_names , artist_ids = self ._extract_artists (
418406 track ["relationships" ]["artists" ]["data" ],
419407 artist_lookup ,
@@ -441,9 +429,8 @@ def _extract_artists(
441429 ) -> tuple [list [str ], list [str ]]:
442430 """Extract artists from a relationship.
443431
444- Needed because artists are ordered in the track relationship,
445- while the included response data is accessed by id via
446- ``artist_lookup``.
432+ Artists are sorted in the track/album response relationship but not in the
433+ track/album responses included items.
447434 """
448435 artist_names = []
449436 artist_ids = []
@@ -462,9 +449,8 @@ def _extract_artists(
462449 @staticmethod
463450 def _extract_title (attributes : AlbumAttributes | TrackAttributes ):
464451 """
465- Tidal UIs append the version string at the end of the
466- title. We do the same here by formatting it as
467- ``"{title} ({version})"`` to stay consistent.
452+ Tidal UIs append the version string at the end of the title. We do the same here
453+ by formatting it as ``"{title} ({version})"`` to stay consistent.
468454 """
469455 if version := attributes .get ("version" ):
470456 return f"{ attributes ['title' ]} ({ version } )"
0 commit comments