diff --git a/beets/autotag/hooks.py b/beets/autotag/hooks.py index 9cd6f2cd8a..df99c4b9c4 100644 --- a/beets/autotag/hooks.py +++ b/beets/autotag/hooks.py @@ -161,8 +161,8 @@ def __init__(self, title=None, track_id=None, release_track_id=None, data_source=None, data_url=None, media=None, lyricist=None, composer=None, composer_sort=None, arranger=None, track_alt=None, work=None, mb_workid=None, - work_disambig=None, bpm=None, initial_key=None, genre=None, - **kwargs): + work_disambig=None, bpm=None, initial_key=None, + genre=None, **kwargs): self.title = title self.track_id = track_id self.release_track_id = release_track_id diff --git a/beetsplug/spotify.py b/beetsplug/spotify.py index 2529160dd0..b5237e63f1 100644 --- a/beetsplug/spotify.py +++ b/beetsplug/spotify.py @@ -197,6 +197,9 @@ def album_for_id(self, album_id): tracks = [] medium_totals = collections.defaultdict(int) for i, track_data in enumerate(album_data['tracks']['items'], start=1): + track_data = self._handle_response( + requests.get, track_data["href"] + ) track = self._get_track(track_data) track.index = i medium_totals[track.medium] += 1 @@ -243,6 +246,7 @@ def _get_track(self, track_data): medium_index=track_data['track_number'], data_source=self.data_source, data_url=track_data['external_urls']['spotify'], + spotify_popularity=track_data['popularity'], ) def track_for_id(self, track_id=None, track_data=None): diff --git a/docs/changelog.rst b/docs/changelog.rst index f6a9273493..4a522f1efb 100644 --- a/docs/changelog.rst +++ b/docs/changelog.rst @@ -35,6 +35,7 @@ Other new things: * Permissions plugin now sets cover art permissions to the file permissions. * :doc:`/plugins/unimported`: Support excluding specific subdirectories in library. +* :doc:`/plugins/spotify`: We now fetch a ``spotify_popularity`` field. Bug fixes: