From fc8d3fceeb5e3c0b577836c46212e7a06af0d68a Mon Sep 17 00:00:00 2001 From: Alok Saboo Date: Mon, 20 Jun 2022 16:52:05 -0400 Subject: [PATCH 1/2] Define item_types for spotify attributes --- beetsplug/spotify.py | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/beetsplug/spotify.py b/beetsplug/spotify.py index 4980d9c1b..6c4529450 100644 --- a/beetsplug/spotify.py +++ b/beetsplug/spotify.py @@ -37,6 +37,22 @@ DEFAULT_WAITING_TIME = 5 class SpotifyPlugin(MetadataSourcePlugin, BeetsPlugin): data_source = 'Spotify' + item_types = { + 'spotify_track_popularity': types.INTEGER, + 'spotify_acousticness': types.FLOAT, + 'spotify_danceability': types.FLOAT, + 'spotify_energy': types.FLOAT, + 'spotify_instrumentalness': types.FLOAT, + 'spotify_key': types.FLOAT, + 'spotify_liveness': types.FLOAT, + 'spotify_loudness': types.FLOAT, + 'spotify_mode': types.INTEGER, + 'spotify_speechiness': types.FLOAT, + 'spotify_tempo': types.FLOAT, + 'spotify_time_signature': types.INTEGER, + 'spotify_valence': types.FLOAT, + } + # Base URLs for the Spotify API # Documentation: https://developer.spotify.com/web-api oauth_token_url = 'https://accounts.spotify.com/api/token' From 8102bd2e35bb65f75aa246538fa18b04d35feae5 Mon Sep 17 00:00:00 2001 From: Alok Saboo Date: Mon, 20 Jun 2022 16:59:03 -0400 Subject: [PATCH 2/2] Add import --- beetsplug/spotify.py | 1 + 1 file changed, 1 insertion(+) diff --git a/beetsplug/spotify.py b/beetsplug/spotify.py index 6c4529450..42e20c828 100644 --- a/beetsplug/spotify.py +++ b/beetsplug/spotify.py @@ -29,6 +29,7 @@ import requests import unidecode from beets import ui from beets.autotag.hooks import AlbumInfo, TrackInfo +from beets.dbcore import types from beets.plugins import BeetsPlugin, MetadataSourcePlugin DEFAULT_WAITING_TIME = 5