Merge pull request #4380 from arsaboo/spotify_types

Define item_types for Spotify attributes to enable queries
This commit is contained in:
Adrian Sampson 2022-06-22 08:48:42 -04:00 committed by GitHub
commit fd65e12c8f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -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
@ -37,6 +38,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'