Better validation exceptions
This commit is contained in:
parent
33ba8e3845
commit
64af929cf1
@ -47,11 +47,9 @@ class Library:
|
|||||||
try:
|
try:
|
||||||
for album, albumcontent in self.albums.items():
|
for album, albumcontent in self.albums.items():
|
||||||
for song, songcontent in albumcontent.items():
|
for song, songcontent in albumcontent.items():
|
||||||
if songcontent['artist'] is None:
|
for field in ['track', 'artist', 'source']:
|
||||||
raise Exception
|
if field not in songcontent:
|
||||||
except:
|
raise Exception('Song is missing required field', song, field)
|
||||||
logging.warn('Library not valid')
|
|
||||||
raise Exception('Library not valid')
|
|
||||||
|
|
||||||
# Download library
|
# Download library
|
||||||
def download(self, targetalbum=None):
|
def download(self, targetalbum=None):
|
||||||
|
Loading…
x
Reference in New Issue
Block a user