mirror of
https://github.com/krateng/maloja.git
synced 2023-08-10 21:12:55 +03:00
Added database feedback when trying to add duplicate scrobbles
This commit is contained in:
parent
a16c24281e
commit
f4e42f9256
@ -245,12 +245,18 @@ def add_scrobbles(scrobbleslist,dbconn=None):
|
|||||||
) for s in scrobbleslist
|
) for s in scrobbleslist
|
||||||
]
|
]
|
||||||
|
|
||||||
|
success,errors = 0,0
|
||||||
for op in ops:
|
for op in ops:
|
||||||
try:
|
try:
|
||||||
dbconn.execute(op)
|
dbconn.execute(op)
|
||||||
except sql.exc.IntegrityError:
|
success += 1
|
||||||
pass
|
except sql.exc.IntegrityError as e:
|
||||||
|
errors += 1
|
||||||
|
|
||||||
|
# TODO check if actual duplicate
|
||||||
|
|
||||||
|
if errors > 0: log(f"{errors} Scrobbles have not been written to database!",color='red')
|
||||||
|
return success,errors
|
||||||
|
|
||||||
|
|
||||||
### these will 'get' the ID of an entity, creating it if necessary
|
### these will 'get' the ID of an entity, creating it if necessary
|
||||||
|
Loading…
Reference in New Issue
Block a user