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