1
0
mirror of https://github.com/krateng/maloja.git synced 2023-08-10 21:12:55 +03:00

Added log output for proxy scrobbling

This commit is contained in:
Krateng 2019-06-24 16:09:25 +02:00
parent b9ae163132
commit 63c2214913
3 changed files with 7 additions and 2 deletions

1
.gitignore vendored
View File

@ -13,7 +13,6 @@ nohup.out
# currently not using
/screenshot*.png
/proxyscrobble.py
# only for development, normally external
/doreah

View File

@ -119,7 +119,6 @@ def createScrobble(artists,title,time,volatile=False):
proxy_scrobble(artists,title,time)
return get_track_dict(TRACKS[obj.track])

View File

@ -4,6 +4,7 @@ import base64
from doreah.settings import get_settings
from doreah.logging import log
import hashlib
import xml.etree.ElementTree as ET
### PICTURES
@ -173,3 +174,9 @@ def proxy_scrobble(artists,title,timestamp):
for api in apis_scrobble:
response = urllib.request.urlopen(api["scrobbleurl"],data=utf(api["requestbody"](artists,title,timestamp)))
xml = response.read()
data = ET.fromstring(xml)
if data.attrib.get("status") == "ok":
if data.find("scrobbles").attrib.get("ignored") == "0":
log(api["name"] + ": Scrobble accepted: " + "/".join(artists) + " - " + title)
else:
log(api["name"] + ": Scrobble not accepted: " + "/".join(artists) + " - " + title)