diff --git a/maloja/__pkginfo__.py b/maloja/__pkginfo__.py index 888b9c1..e7a9a8b 100644 --- a/maloja/__pkginfo__.py +++ b/maloja/__pkginfo__.py @@ -5,7 +5,7 @@ author = { "email":"maloja@krateng.dev", "github": "krateng" } -version = 2,6,1 +version = 2,6,2 versionstr = ".".join(str(n) for n in version) links = { "pypi":"malojaserver", @@ -30,9 +30,7 @@ resources = [ "static/*/*", "data_files/*/*", "data_files/*/*/*", - "proccontrol/*", - "proccontrol/*/*", - "thirdparty/*" + "**/*.py" ] commands = { diff --git a/maloja/data_files/settings/default.ini b/maloja/data_files/settings/default.ini index d60e842..86e9c2f 100644 --- a/maloja/data_files/settings/default.ini +++ b/maloja/data_files/settings/default.ini @@ -9,10 +9,9 @@ HOST = "::" # You most likely want either :: for IPv6 or 0.0.0.0 for IPv4 here [Third Party Services] -# whether to use metadata providers -METADATA_LASTFM = true -METADATA_SPOTIFY = true -METADATA_MUSICBRAINZ = true +# order in which to use the metadata providers +# keep in mind that musicbrainz is rate-limited and should probably not be used first +METADATA_PROVIDERS = [lastfm,spotify,musicbrainz] # whether to proxy scrobble to other services SCROBBLE_LASTFM = false diff --git a/maloja/thirdparty/__init__.py b/maloja/thirdparty/__init__.py index 6dde7b3..18738e4 100644 --- a/maloja/thirdparty/__init__.py +++ b/maloja/thirdparty/__init__.py @@ -22,6 +22,8 @@ services = { "metadata":[] } +metadata_service_ids = {} + def proxy_scrobble_all(artists,title,timestamp): for service in services["proxyscrobble"]: @@ -77,7 +79,7 @@ class GenericInterface: services["import"].append(s) log(cls.name + " registered as scrobble import source") if s.active_metadata(): - services["metadata"].append(s) + metadata_service_ids[s.identifier] = s log(cls.name + " registered as metadata provider") def authorize(self): @@ -201,3 +203,11 @@ __all__ = [ "musicbrainz" ] from . import * + + + +services["metadata"] = [ + metadata_service_ids[pr] + for pr in get_settings("METADATA_PROVIDERS") + if metadata_service_ids[pr].active_metadata() +] diff --git a/maloja/thirdparty/lastfm.py b/maloja/thirdparty/lastfm.py index a189da8..7099a6d 100644 --- a/maloja/thirdparty/lastfm.py +++ b/maloja/thirdparty/lastfm.py @@ -4,6 +4,7 @@ import urllib.parse, urllib.request class LastFM(MetadataInterface, ProxyScrobbleInterface): name = "LastFM" + identifier = "lastfm" settings = { "apikey":"LASTFM_API_KEY", diff --git a/maloja/thirdparty/musicbrainz.py b/maloja/thirdparty/musicbrainz.py index b45e50c..9e146a8 100644 --- a/maloja/thirdparty/musicbrainz.py +++ b/maloja/thirdparty/musicbrainz.py @@ -8,6 +8,7 @@ from ..__pkginfo__ import versionstr, author, links class MusicBrainz(MetadataInterface): name = "MusicBrainz" + identifier = "musicbrainz" # musicbrainz is rate-limited lock = threading.Lock() diff --git a/maloja/thirdparty/spotify.py b/maloja/thirdparty/spotify.py index 5e290a5..6b46dee 100644 --- a/maloja/thirdparty/spotify.py +++ b/maloja/thirdparty/spotify.py @@ -5,6 +5,7 @@ import json class Spotify(MetadataInterface): name = "Spotify" + identifier = "spotify" settings = { "apiid":"SPOTIFY_API_ID",