mirror of
https://github.com/krateng/maloja.git
synced 2025-07-09 03:04:07 -04:00
Cleanup
This commit is contained in:
parent
c648b25d28
commit
ac5c58c919
@ -3,6 +3,7 @@ from ._exceptions import *
|
|||||||
from .. import database
|
from .. import database
|
||||||
import datetime
|
import datetime
|
||||||
from ._apikeys import apikeystore
|
from ._apikeys import apikeystore
|
||||||
|
from ..database.exceptions import DuplicateScrobble
|
||||||
|
|
||||||
from ..pkg_global.conf import malojaconfig
|
from ..pkg_global.conf import malojaconfig
|
||||||
|
|
||||||
@ -25,6 +26,7 @@ class Listenbrainz(APIHandler):
|
|||||||
InvalidAuthException: (401, {"code": 401, "error": "Incorrect Authorization"}),
|
InvalidAuthException: (401, {"code": 401, "error": "Incorrect Authorization"}),
|
||||||
InvalidMethodException: (200, {"code": 200, "error": "Invalid Method"}),
|
InvalidMethodException: (200, {"code": 200, "error": "Invalid Method"}),
|
||||||
MalformedJSONException: (400, {"code": 400, "error": "Invalid JSON document submitted."}),
|
MalformedJSONException: (400, {"code": 400, "error": "Invalid JSON document submitted."}),
|
||||||
|
DuplicateScrobble: (200, {"status": "ok"}),
|
||||||
Exception: (500, {"code": 500, "error": "Unspecified server error."})
|
Exception: (500, {"code": 500, "error": "Unspecified server error."})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -360,15 +360,14 @@ def add_scrobbles(scrobbleslist,update_album=False,dbconn=None):
|
|||||||
result = dbconn.execute(DB['scrobbles'].select().where(
|
result = dbconn.execute(DB['scrobbles'].select().where(
|
||||||
DB['scrobbles'].c.timestamp == scrobble_entry['timestamp']
|
DB['scrobbles'].c.timestamp == scrobble_entry['timestamp']
|
||||||
)).first()
|
)).first()
|
||||||
print("Existing",result)
|
|
||||||
if result.track_id == scrobble_entry['track_id']:
|
if result.track_id == scrobble_entry['track_id']:
|
||||||
exists += 1
|
exists += 1
|
||||||
else:
|
else:
|
||||||
errors += 1
|
errors += 1
|
||||||
|
|
||||||
|
|
||||||
if errors > 0: log(f"{errors} Scrobbles have not been written to database!",color='red')
|
if errors > 0: log(f"{errors} Scrobbles have not been written to database (duplicate timestamps)!", color='red')
|
||||||
if exists > 0: log(f"{exists} Scrobbles have not been written to database (duplicate)", color='orange')
|
if exists > 0: log(f"{exists} Scrobbles have not been written to database (already exist)", color='orange')
|
||||||
return success, exists, errors
|
return success, exists, errors
|
||||||
|
|
||||||
@connection_provider
|
@connection_provider
|
||||||
|
Loading…
x
Reference in New Issue
Block a user