mirror of
https://github.com/beetbox/beets.git
synced 2025-12-06 08:39:17 +01:00
Renamed class method to _extract_id.
This commit is contained in:
parent
648a9be172
commit
1d33580b68
6 changed files with 10 additions and 10 deletions
|
|
@ -251,7 +251,7 @@ class MetadataSourcePlugin(BeetsPlugin, metaclass=abc.ABCMeta):
|
|||
"""
|
||||
return cls.__name__.replace("Plugin", "") # type: ignore[attr-defined]
|
||||
|
||||
def extract_release_id(self, url: str) -> str | None:
|
||||
def _extract_id(self, url: str) -> str | None:
|
||||
"""Extract an ID from a URL for this metadata source plugin.
|
||||
|
||||
Uses the plugin's data source name to determine the ID format and
|
||||
|
|
|
|||
|
|
@ -431,7 +431,7 @@ class BeatportPlugin(MetadataSourcePlugin):
|
|||
"""
|
||||
self._log.debug("Searching for release {0}", album_id)
|
||||
|
||||
if not (release_id := self.extract_release_id(album_id)):
|
||||
if not (release_id := self._extract_id(album_id)):
|
||||
self._log.debug("Not a valid Beatport release ID.")
|
||||
return None
|
||||
|
||||
|
|
|
|||
|
|
@ -66,7 +66,7 @@ class DeezerPlugin(SearchApiMetadataSourcePlugin[IDResponse]):
|
|||
|
||||
def album_for_id(self, album_id: str) -> AlbumInfo | None:
|
||||
"""Fetch an album by its Deezer ID or URL."""
|
||||
if not (deezer_id := self.extract_release_id(album_id)):
|
||||
if not (deezer_id := self._extract_id(album_id)):
|
||||
return None
|
||||
|
||||
album_url = f"{self.album_url}{deezer_id}"
|
||||
|
|
@ -155,7 +155,7 @@ class DeezerPlugin(SearchApiMetadataSourcePlugin[IDResponse]):
|
|||
``track_id`` or ``track_data`` must be provided.
|
||||
|
||||
"""
|
||||
if not (deezer_id := self.extract_release_id(track_id)):
|
||||
if not (deezer_id := self._extract_id(track_id)):
|
||||
self._log.debug("Invalid Deezer track_id: {}", track_id)
|
||||
return None
|
||||
|
||||
|
|
|
|||
|
|
@ -204,7 +204,7 @@ class DiscogsPlugin(MetadataSourcePlugin):
|
|||
"""
|
||||
self._log.debug("Searching for release {0}", album_id)
|
||||
|
||||
discogs_id = self.extract_release_id(album_id)
|
||||
discogs_id = self._extract_id(album_id)
|
||||
|
||||
if not discogs_id:
|
||||
return None
|
||||
|
|
@ -346,7 +346,7 @@ class DiscogsPlugin(MetadataSourcePlugin):
|
|||
else:
|
||||
genre = base_genre
|
||||
|
||||
discogs_albumid = self.extract_release_id(result.data.get("uri"))
|
||||
discogs_albumid = self._extract_id(result.data.get("uri"))
|
||||
|
||||
# Extract information for the optional AlbumInfo fields that are
|
||||
# contained on nested discogs fields.
|
||||
|
|
|
|||
|
|
@ -837,7 +837,7 @@ class MusicBrainzPlugin(MetadataSourcePlugin):
|
|||
MusicBrainzAPIError.
|
||||
"""
|
||||
self._log.debug("Requesting MusicBrainz release {}", album_id)
|
||||
if not (albumid := self.extract_release_id(album_id)):
|
||||
if not (albumid := self._extract_id(album_id)):
|
||||
self._log.debug("Invalid MBID ({0}).", album_id)
|
||||
return None
|
||||
|
||||
|
|
@ -874,7 +874,7 @@ class MusicBrainzPlugin(MetadataSourcePlugin):
|
|||
"""Fetches a track by its MusicBrainz ID. Returns a TrackInfo object
|
||||
or None if no track is found. May raise a MusicBrainzAPIError.
|
||||
"""
|
||||
if not (trackid := self.extract_release_id(track_id)):
|
||||
if not (trackid := self._extract_id(track_id)):
|
||||
self._log.debug("Invalid MBID ({0}).", track_id)
|
||||
return None
|
||||
|
||||
|
|
|
|||
|
|
@ -290,7 +290,7 @@ class SpotifyPlugin(
|
|||
:return: AlbumInfo object for album
|
||||
:rtype: beets.autotag.hooks.AlbumInfo or None
|
||||
"""
|
||||
if not (spotify_id := self.extract_release_id(album_id)):
|
||||
if not (spotify_id := self._extract_id(album_id)):
|
||||
return None
|
||||
|
||||
album_data = self._handle_response("get", self.album_url + spotify_id)
|
||||
|
|
@ -393,7 +393,7 @@ class SpotifyPlugin(
|
|||
Returns a TrackInfo object or None if the track is not found.
|
||||
"""
|
||||
|
||||
if not (spotify_id := self.extract_release_id(track_id)):
|
||||
if not (spotify_id := self._extract_id(track_id)):
|
||||
self._log.debug("Invalid Spotify ID: {}", track_id)
|
||||
return None
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue