From 63c2214913008f27276a291f30ff995c88e49ecd Mon Sep 17 00:00:00 2001 From: Krateng Date: Mon, 24 Jun 2019 16:09:25 +0200 Subject: [PATCH] Added log output for proxy scrobbling --- .gitignore | 1 - database.py | 1 - external.py | 7 +++++++ 3 files changed, 7 insertions(+), 2 deletions(-) diff --git a/.gitignore b/.gitignore index 50cc9d4..7628e4d 100644 --- a/.gitignore +++ b/.gitignore @@ -13,7 +13,6 @@ nohup.out # currently not using /screenshot*.png -/proxyscrobble.py # only for development, normally external /doreah diff --git a/database.py b/database.py index adca465..3daa304 100644 --- a/database.py +++ b/database.py @@ -119,7 +119,6 @@ def createScrobble(artists,title,time,volatile=False): proxy_scrobble(artists,title,time) - return get_track_dict(TRACKS[obj.track]) diff --git a/external.py b/external.py index 6e5e6ad..04915a6 100644 --- a/external.py +++ b/external.py @@ -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)