diff --git a/data/interfaces/default/config.html b/data/interfaces/default/config.html index 72c344df..9da1a1df 100644 --- a/data/interfaces/default/config.html +++ b/data/interfaces/default/config.html @@ -1654,6 +1654,16 @@ +
+ Last.fm +
+
+ + +
+
+
+
Songkick
diff --git a/headphones/config.py b/headphones/config.py index c781a3be..d7a19f32 100644 --- a/headphones/config.py +++ b/headphones/config.py @@ -155,6 +155,7 @@ _CONFIG_DEFINITIONS = { 'KEEP_TORRENT_FILES': (int, 'General', 0), 'KEEP_TORRENT_FILES_DIR': (path, 'General', ''), 'LASTFM_USERNAME': (str, 'General', ''), + 'LASTFM_APIKEY': (str, 'General', ''), 'LAUNCH_BROWSER': (int, 'General', 1), 'LIBRARYSCAN': (int, 'General', 1), 'LIBRARYSCAN_INTERVAL': (int, 'General', 24), diff --git a/headphones/lastfm.py b/headphones/lastfm.py index 969e0e99..4e87219f 100644 --- a/headphones/lastfm.py +++ b/headphones/lastfm.py @@ -23,7 +23,7 @@ from headphones import db, logger, request TIMEOUT = 60.0 # seconds REQUEST_LIMIT = 1.0 / 5 # seconds ENTRY_POINT = "https://ws.audioscrobbler.com/2.0/" -API_KEY = "395e6ec6bb557382fc41fde867bce66f" +APP_API_KEY = "395e6ec6bb557382fc41fde867bce66f" # Required for API request limit lastfm_lock = headphones.lock.TimedLock(REQUEST_LIMIT) @@ -40,7 +40,7 @@ def request_lastfm(method, **kwargs): # Prepare request kwargs["method"] = method - kwargs.setdefault("api_key", API_KEY) + kwargs.setdefault("api_key", headphones.CONFIG.LASTFM_APIKEY or APP_API_KEY) kwargs.setdefault("format", "json") # Send request diff --git a/headphones/webserve.py b/headphones/webserve.py index 29817d86..758b2267 100644 --- a/headphones/webserve.py +++ b/headphones/webserve.py @@ -1385,6 +1385,7 @@ class WebInterface(object): "custompass": headphones.CONFIG.CUSTOMPASS, "hpuser": headphones.CONFIG.HPUSER, "hppass": headphones.CONFIG.HPPASS, + "lastfm_apikey": headphones.CONFIG.LASTFM_APIKEY, "songkick_enabled": checked(headphones.CONFIG.SONGKICK_ENABLED), "songkick_apikey": headphones.CONFIG.SONGKICK_APIKEY, "songkick_location": headphones.CONFIG.SONGKICK_LOCATION,