diff --git a/beets/metadata_plugins.py b/beets/metadata_plugins.py index 8da1f0333..1d16c0cc8 100644 --- a/beets/metadata_plugins.py +++ b/beets/metadata_plugins.py @@ -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 diff --git a/beetsplug/beatport.py b/beetsplug/beatport.py index 72828a96a..16e0dc896 100644 --- a/beetsplug/beatport.py +++ b/beetsplug/beatport.py @@ -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 diff --git a/beetsplug/deezer.py b/beetsplug/deezer.py index bf6f83980..8815e3d59 100644 --- a/beetsplug/deezer.py +++ b/beetsplug/deezer.py @@ -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 diff --git a/beetsplug/discogs.py b/beetsplug/discogs.py index 713dfbcae..9765f317f 100644 --- a/beetsplug/discogs.py +++ b/beetsplug/discogs.py @@ -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. diff --git a/beetsplug/musicbrainz.py b/beetsplug/musicbrainz.py index 3b250c071..b52e44b23 100644 --- a/beetsplug/musicbrainz.py +++ b/beetsplug/musicbrainz.py @@ -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 diff --git a/beetsplug/spotify.py b/beetsplug/spotify.py index 27fd2e3b5..7a4f4ec52 100644 --- a/beetsplug/spotify.py +++ b/beetsplug/spotify.py @@ -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