mirror of
https://github.com/krateng/maloja.git
synced 2023-08-10 21:12:55 +03:00
Added other Maloja instance as third party option
This commit is contained in:
parent
e62c637aa0
commit
4c9f824bbd
@ -171,6 +171,8 @@ malojaconfig = Configuration(
|
||||
"spotify_api_id":(tp.String(), "Spotify API ID", None),
|
||||
"spotify_api_secret":(tp.String(), "Spotify API Secret", None),
|
||||
"audiodb_api_key":(tp.String(), "TheAudioDB API Key", None),
|
||||
"other_maloja_url":(tp.String(), "Other Maloja Instance URL", None),
|
||||
"other_maloja_api_key":(tp.String(), "Other Maloja Instance API Key",None),
|
||||
"track_search_provider":(tp.String(), "Track Search Provider", None),
|
||||
"send_stats":(tp.Boolean(), "Send Statistics", None),
|
||||
|
||||
|
3
maloja/thirdparty/__init__.py
vendored
3
maloja/thirdparty/__init__.py
vendored
@ -245,7 +245,8 @@ __all__ = [
|
||||
"spotify",
|
||||
"musicbrainz",
|
||||
"audiodb",
|
||||
"deezer"
|
||||
"deezer",
|
||||
"maloja"
|
||||
]
|
||||
from . import *
|
||||
|
||||
|
40
maloja/thirdparty/maloja.py
vendored
Normal file
40
maloja/thirdparty/maloja.py
vendored
Normal file
@ -0,0 +1,40 @@
|
||||
from . import ProxyScrobbleInterface, ImportInterface
|
||||
import urllib.request
|
||||
from doreah.logging import log
|
||||
import json
|
||||
|
||||
|
||||
class OtherMalojaInstance(ProxyScrobbleInterface, ImportInterface):
|
||||
|
||||
name = "Maloja"
|
||||
identifier = "maloja"
|
||||
|
||||
settings = {
|
||||
"apikey":"OTHER_MALOJA_API_KEY",
|
||||
"instance":"OTHER_MALOJA_URL"
|
||||
}
|
||||
|
||||
proxyscrobble = {
|
||||
"scrobbleurl": "http://ws.audioscrobbler.com/2.0/",
|
||||
"required_settings": ["apikey","instance"],
|
||||
"activated_setting": "FORWARD_OTHER_MALOJA_SERVER"
|
||||
}
|
||||
|
||||
scrobbleimport = {
|
||||
"required_settings":["apikey","instance"]
|
||||
}
|
||||
|
||||
|
||||
|
||||
def active_proxyscrobble(self):
|
||||
return False
|
||||
|
||||
def import_scrobbles(self):
|
||||
url = f"{self.settings['instance']}/apis/mlj_1/scrobbles"
|
||||
|
||||
response = urllib.request.urlopen(url)
|
||||
data = json.loads(response.read().decode('utf-8'))
|
||||
|
||||
for scrobble in data['list']:
|
||||
self.self_scrobble(scrobble['artists'],scrobble['title'],scrobble['time'])
|
||||
return True
|
Loading…
Reference in New Issue
Block a user