1
0
mirror of https://github.com/spl0k/supysonic.git synced 2024-12-22 17:06:17 +00:00

Catch validation errors when creating/updating tracks

Closes #162
This commit is contained in:
Alban Féron 2019-08-25 15:05:23 +02:00
parent 9dd7d8a58b
commit ff0a9475d4
No known key found for this signature in database
GPG Key ID: 8CE0313646D16165

View File

@ -265,8 +265,12 @@ class Scanner(Thread):
trdict["artist"] = trartist
trdict["created"] = datetime.fromtimestamp(mtime)
Track(**trdict)
self.__stats.added.tracks += 1
try:
Track(**trdict)
self.__stats.added.tracks += 1
except ValueError:
# Field validation error
self.__stats.errors.append(path)
else:
if tr.album.id != tralbum.id:
trdict["album"] = tralbum
@ -274,7 +278,11 @@ class Scanner(Thread):
if tr.artist.id != trartist.id:
trdict["artist"] = trartist
tr.set(**trdict)
try:
tr.set(**trdict)
except ValueError:
# Field validation error
self.__stats.errors.append(path)
@db_session
def remove_file(self, path):