mirror of
https://github.com/krateng/maloja.git
synced 2025-07-09 03:04:07 -04:00
Fix misleading logging entries about metadata requests
This commit is contained in:
parent
76691a5b0f
commit
d0a20fecb2
@ -164,7 +164,7 @@ malojaconfig = Configuration(
|
|||||||
"name":(tp.String(), "Name", "Generic Maloja User")
|
"name":(tp.String(), "Name", "Generic Maloja User")
|
||||||
},
|
},
|
||||||
"Third Party Services":{
|
"Third Party Services":{
|
||||||
"metadata_providers":(tp.List(tp.String()), "Metadata Providers", ['lastfm','spotify','deezer','musicbrainz'], "Which metadata providers should be used in what order. Musicbrainz is rate-limited and should not be used first."),
|
"metadata_providers":(tp.List(tp.String()), "Metadata Providers", ['lastfm','spotify','deezer','audiodb','musicbrainz'], "Which metadata providers should be used in what order. Musicbrainz is rate-limited and should not be used first."),
|
||||||
"scrobble_lastfm":(tp.Boolean(), "Proxy-Scrobble to Last.fm", False),
|
"scrobble_lastfm":(tp.Boolean(), "Proxy-Scrobble to Last.fm", False),
|
||||||
"lastfm_api_key":(tp.String(), "Last.fm API Key", None),
|
"lastfm_api_key":(tp.String(), "Last.fm API Key", None),
|
||||||
"lastfm_api_secret":(tp.String(), "Last.fm API Secret", None),
|
"lastfm_api_secret":(tp.String(), "Last.fm API Secret", None),
|
||||||
|
11
maloja/thirdparty/__init__.py
vendored
11
maloja/thirdparty/__init__.py
vendored
@ -7,13 +7,12 @@
|
|||||||
# pls don't sue me
|
# pls don't sue me
|
||||||
|
|
||||||
import xml.etree.ElementTree as ElementTree
|
import xml.etree.ElementTree as ElementTree
|
||||||
import json
|
|
||||||
import requests
|
import requests
|
||||||
import urllib.parse
|
import urllib.parse
|
||||||
import base64
|
import base64
|
||||||
import time
|
import time
|
||||||
from doreah.logging import log
|
from doreah.logging import log
|
||||||
from threading import BoundedSemaphore
|
from threading import BoundedSemaphore, Thread
|
||||||
|
|
||||||
from ..pkg_global.conf import malojaconfig
|
from ..pkg_global.conf import malojaconfig
|
||||||
from .. import database
|
from .. import database
|
||||||
@ -53,6 +52,7 @@ def proxy_scrobble_all(artists,title,timestamp):
|
|||||||
def get_image_track_all(track):
|
def get_image_track_all(track):
|
||||||
with thirdpartylock:
|
with thirdpartylock:
|
||||||
for service in services["metadata"]:
|
for service in services["metadata"]:
|
||||||
|
if "track" not in service.metadata["enabled_entity_types"]: continue
|
||||||
try:
|
try:
|
||||||
res = service.get_image_track(track)
|
res = service.get_image_track(track)
|
||||||
if res:
|
if res:
|
||||||
@ -65,6 +65,7 @@ def get_image_track_all(track):
|
|||||||
def get_image_artist_all(artist):
|
def get_image_artist_all(artist):
|
||||||
with thirdpartylock:
|
with thirdpartylock:
|
||||||
for service in services["metadata"]:
|
for service in services["metadata"]:
|
||||||
|
if "artist" not in service.metadata["enabled_entity_types"]: continue
|
||||||
try:
|
try:
|
||||||
res = service.get_image_artist(artist)
|
res = service.get_image_artist(artist)
|
||||||
if res:
|
if res:
|
||||||
@ -77,6 +78,7 @@ def get_image_artist_all(artist):
|
|||||||
def get_image_album_all(album):
|
def get_image_album_all(album):
|
||||||
with thirdpartylock:
|
with thirdpartylock:
|
||||||
for service in services["metadata"]:
|
for service in services["metadata"]:
|
||||||
|
if "album" not in service.metadata["enabled_entity_types"]: continue
|
||||||
try:
|
try:
|
||||||
res = service.get_image_album(album)
|
res = service.get_image_album(album)
|
||||||
if res:
|
if res:
|
||||||
@ -109,7 +111,10 @@ class GenericInterface:
|
|||||||
# avoid constant disk access, restart on adding services is acceptable
|
# avoid constant disk access, restart on adding services is acceptable
|
||||||
for key in self.settings:
|
for key in self.settings:
|
||||||
self.settings[key] = malojaconfig[self.settings[key]]
|
self.settings[key] = malojaconfig[self.settings[key]]
|
||||||
self.authorize()
|
t = Thread(target=self.authorize)
|
||||||
|
t.daemon = True
|
||||||
|
t.start()
|
||||||
|
#self.authorize()
|
||||||
|
|
||||||
# this makes sure that of every class we define, we immediately create an
|
# this makes sure that of every class we define, we immediately create an
|
||||||
# instance (de facto singleton). then each instance checks if the requirements
|
# instance (de facto singleton). then each instance checks if the requirements
|
||||||
|
1
maloja/thirdparty/audiodb.py
vendored
1
maloja/thirdparty/audiodb.py
vendored
@ -16,6 +16,7 @@ class AudioDB(MetadataInterface):
|
|||||||
#"response_parse_tree_track": ["tracks",0,"astrArtistThumb"],
|
#"response_parse_tree_track": ["tracks",0,"astrArtistThumb"],
|
||||||
"response_parse_tree_artist": ["artists",0,"strArtistThumb"],
|
"response_parse_tree_artist": ["artists",0,"strArtistThumb"],
|
||||||
"required_settings": ["api_key"],
|
"required_settings": ["api_key"],
|
||||||
|
"enabled_entity_types": ["artist"]
|
||||||
}
|
}
|
||||||
|
|
||||||
def get_image_track(self,track):
|
def get_image_track(self,track):
|
||||||
|
1
maloja/thirdparty/deezer.py
vendored
1
maloja/thirdparty/deezer.py
vendored
@ -17,6 +17,7 @@ class Deezer(MetadataInterface):
|
|||||||
"response_parse_tree_artist": ["data",0,"artist","picture_medium"],
|
"response_parse_tree_artist": ["data",0,"artist","picture_medium"],
|
||||||
"response_parse_tree_album": ["data",0,"album","cover_medium"],
|
"response_parse_tree_album": ["data",0,"album","cover_medium"],
|
||||||
"required_settings": [],
|
"required_settings": [],
|
||||||
|
"enabled_entity_types": ["artist","album"]
|
||||||
}
|
}
|
||||||
|
|
||||||
delay = 1
|
delay = 1
|
||||||
|
1
maloja/thirdparty/lastfm.py
vendored
1
maloja/thirdparty/lastfm.py
vendored
@ -32,6 +32,7 @@ class LastFM(MetadataInterface, ProxyScrobbleInterface):
|
|||||||
#"response_parse_tree_artist": ["artist","image",-1,"#text"],
|
#"response_parse_tree_artist": ["artist","image",-1,"#text"],
|
||||||
"response_parse_tree_album": ["album","image",-1,"#text"],
|
"response_parse_tree_album": ["album","image",-1,"#text"],
|
||||||
"required_settings": ["apikey"],
|
"required_settings": ["apikey"],
|
||||||
|
"enabled_entity_types": ["track","album"]
|
||||||
}
|
}
|
||||||
|
|
||||||
def get_image_artist(self,artist):
|
def get_image_artist(self,artist):
|
||||||
|
1
maloja/thirdparty/musicbrainz.py
vendored
1
maloja/thirdparty/musicbrainz.py
vendored
@ -19,6 +19,7 @@ class MusicBrainz(MetadataInterface):
|
|||||||
metadata = {
|
metadata = {
|
||||||
"response_type":"json",
|
"response_type":"json",
|
||||||
"required_settings": [],
|
"required_settings": [],
|
||||||
|
"enabled_entity_types": ["album","track"]
|
||||||
}
|
}
|
||||||
|
|
||||||
def get_image_artist(self,artist):
|
def get_image_artist(self,artist):
|
||||||
|
1
maloja/thirdparty/spotify.py
vendored
1
maloja/thirdparty/spotify.py
vendored
@ -21,6 +21,7 @@ class Spotify(MetadataInterface):
|
|||||||
"response_parse_tree_album": ["albums","items",0,"images",0,"url"],
|
"response_parse_tree_album": ["albums","items",0,"images",0,"url"],
|
||||||
"response_parse_tree_artist": ["artists","items",0,"images",0,"url"],
|
"response_parse_tree_artist": ["artists","items",0,"images",0,"url"],
|
||||||
"required_settings": ["apiid","secret"],
|
"required_settings": ["apiid","secret"],
|
||||||
|
"enabled_entity_types": ["artist","album","track"]
|
||||||
}
|
}
|
||||||
|
|
||||||
def authorize(self):
|
def authorize(self):
|
||||||
|
Loading…
x
Reference in New Issue
Block a user