Added database feedback when trying to add duplicate scrobbles

This commit is contained in:
krateng 2022-04-06 16:48:02 +02:00
parent a16c24281e
commit f4e42f9256
1 changed files with 9 additions and 3 deletions

View File

@ -245,12 +245,18 @@ def add_scrobbles(scrobbleslist,dbconn=None):
) for s in scrobbleslist
]
success,errors = 0,0
for op in ops:
try:
dbconn.execute(op)
except sql.exc.IntegrityError:
pass
success += 1
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