mirror of
https://github.com/beetbox/beets.git
synced 2025-12-06 08:39:17 +01:00
Implement track_for_id to allow fetching singletons by discogs id
This commit is contained in:
parent
d3ef627494
commit
e151b4b49b
2 changed files with 11 additions and 0 deletions
|
|
@ -241,6 +241,14 @@ class DiscogsPlugin(BeetsPlugin):
|
|||
return None
|
||||
return self.get_album_info(result)
|
||||
|
||||
def track_for_id(self, track_id: str) -> TrackInfo | None:
|
||||
if album := self.album_for_id(track_id):
|
||||
for track in album.tracks:
|
||||
if track.track_id == track_id:
|
||||
return track
|
||||
|
||||
return None
|
||||
|
||||
def get_albums(self, query: str) -> Iterable[AlbumInfo]:
|
||||
"""Returns a list of AlbumInfo objects for a discogs search query."""
|
||||
# Strip non-word characters from query. Things like "!" and "-" can
|
||||
|
|
|
|||
|
|
@ -19,6 +19,9 @@ New features:
|
|||
Media Session API to customize media notifications.
|
||||
* :doc:`plugins/discogs`: Add configurable ``search_limit`` option to
|
||||
limit the number of results returned by the Discogs metadata search queries.
|
||||
* :doc:`plugins/discogs`: Implement ``track_for_id`` method to allow retrieving
|
||||
singletons by their Discogs ID.
|
||||
:bug:`4661`
|
||||
|
||||
Bug fixes:
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue