From 415b21cbc1f9b9bcd15c0dd124905bf912d491ef Mon Sep 17 00:00:00 2001 From: Rahul Ahuja Date: Mon, 21 Jan 2019 01:30:37 -0800 Subject: [PATCH] fix var reference, add docstring --- beetsplug/spotify.py | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/beetsplug/spotify.py b/beetsplug/spotify.py index fadedb39c..0626ca937 100644 --- a/beetsplug/spotify.py +++ b/beetsplug/spotify.py @@ -145,6 +145,11 @@ class SpotifyPlugin(BeetsPlugin): def album_for_id(self, album_id): """Fetches an album by its Spotify ID or URL and returns an AlbumInfo object or None if the album is not found. + + :param album_id: Spotify ID or URL for the album + :type album_id: str + :return: AlbumInfo object for album + :rtype: beets.autotag.hooks.AlbumInfo """ spotify_id = self._get_spotify_id('album', album_id) if spotify_id is None: @@ -247,9 +252,8 @@ class SpotifyPlugin(BeetsPlugin): # get album's tracks to set the track's index/position on # the entire release - spotify_id_album = response_track['album']['id'] response_album = self._handle_response( - requests.get, self.album_url + spotify_id_album + requests.get, self.album_url + response_data_track['album']['id'] ) response_data_album = response_album.json() medium_total = 0 @@ -261,7 +265,8 @@ class SpotifyPlugin(BeetsPlugin): track.medium_total = medium_total return track - def _get_artist(self, artists): + @staticmethod + def _get_artist(artists): """Returns an artist string (all artists) and an artist_id (the main artist) for a list of Spotify artist object dicts.