From a41aa0962b6c5232f2036dc212c18cec41ed5b00 Mon Sep 17 00:00:00 2001 From: krateng Date: Sat, 27 Nov 2021 19:19:58 +0100 Subject: [PATCH] Added Deezer and TheAudioDB as metadata providers --- maloja/data_files/config/settings/default.ini | 2 +- maloja/thirdparty/__init__.py | 4 +++- maloja/thirdparty/audiodb.py | 21 +++++++++++++++++++ maloja/thirdparty/deezer.py | 17 +++++++++++++++ 4 files changed, 42 insertions(+), 2 deletions(-) create mode 100644 maloja/thirdparty/audiodb.py create mode 100644 maloja/thirdparty/deezer.py diff --git a/maloja/data_files/config/settings/default.ini b/maloja/data_files/config/settings/default.ini index 87394b4..46e3b96 100644 --- a/maloja/data_files/config/settings/default.ini +++ b/maloja/data_files/config/settings/default.ini @@ -28,7 +28,7 @@ FORCE_PASSWORD = none # 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] +METADATA_PROVIDERS = [lastfm,spotify,deezer,musicbrainz] # whether to proxy scrobble to other services SCROBBLE_LASTFM = false diff --git a/maloja/thirdparty/__init__.py b/maloja/thirdparty/__init__.py index d9faaa2..ac7efea 100644 --- a/maloja/thirdparty/__init__.py +++ b/maloja/thirdparty/__init__.py @@ -220,7 +220,9 @@ def b64(inp): __all__ = [ "lastfm", "spotify", - "musicbrainz" + "musicbrainz", + "audiodb", + "deezer" ] from . import * diff --git a/maloja/thirdparty/audiodb.py b/maloja/thirdparty/audiodb.py new file mode 100644 index 0000000..66d2b84 --- /dev/null +++ b/maloja/thirdparty/audiodb.py @@ -0,0 +1,21 @@ +from . import MetadataInterface + +class AudioDB(MetadataInterface): + name = "TheAudioDB" + identifier = "audiodb" + + settings = { + "api_key":"AUDIODB_API_KEY" + } + + metadata = { + #"trackurl": "https://theaudiodb.com/api/v1/json/{api_key}/searchtrack.php?s={artist}&t={title}", + "artisturl": "https://www.theaudiodb.com/api/v1/json/{api_key}/search.php?s={artist}", + "response_type":"json", + #"response_parse_tree_track": ["tracks",0,"astrArtistThumb"], + "response_parse_tree_artist": ["artists",0,"strArtistThumb"], + "required_settings": ["api_key"], + } + + def get_image_track(self,artist): + return None diff --git a/maloja/thirdparty/deezer.py b/maloja/thirdparty/deezer.py new file mode 100644 index 0000000..1347c6f --- /dev/null +++ b/maloja/thirdparty/deezer.py @@ -0,0 +1,17 @@ +from . import MetadataInterface + +class Deezer(MetadataInterface): + name = "Deezer" + identifier = "deezer" + + settings = { + } + + metadata = { + "trackurl": "https://api.deezer.com/search?q={artist}%20{title}", + "artisturl": "https://api.deezer.com/search?q={artist}", + "response_type":"json", + "response_parse_tree_track": ["data",0,"album","cover_medium"], + "response_parse_tree_artist": ["data",0,"artist","picture_medium"], + "required_settings": [], + }