Make logging more appropriate in edit prompt
This commit is contained in:
parent
7e9c25ef53
commit
b4bab99ef9
@ -161,6 +161,8 @@ class BadWitch:
|
|||||||
auto_track = int(input('\tStarting track number (leave blank to assign per song): ') or -1)
|
auto_track = int(input('\tStarting track number (leave blank to assign per song): ') or -1)
|
||||||
if in_album not in lib.albums:
|
if in_album not in lib.albums:
|
||||||
lib.albums[in_album] = {}
|
lib.albums[in_album] = {}
|
||||||
|
else:
|
||||||
|
print('\tLoaded existing album')
|
||||||
album = lib.albums[in_album]
|
album = lib.albums[in_album]
|
||||||
try:
|
try:
|
||||||
while True:
|
while True:
|
||||||
@ -178,6 +180,8 @@ class BadWitch:
|
|||||||
# Only assign values if we gave them
|
# Only assign values if we gave them
|
||||||
if in_song not in album:
|
if in_song not in album:
|
||||||
album[in_song] = {}
|
album[in_song] = {}
|
||||||
|
else:
|
||||||
|
print('\t\tLoaded existing song')
|
||||||
song = album[in_song]
|
song = album[in_song]
|
||||||
if in_track is not '': song['track'] = int(in_track)
|
if in_track is not '': song['track'] = int(in_track)
|
||||||
if in_artist is not '': song['artist'] = in_artist
|
if in_artist is not '': song['artist'] = in_artist
|
||||||
@ -185,13 +189,13 @@ class BadWitch:
|
|||||||
# Bail if song is bad
|
# Bail if song is bad
|
||||||
for field in ['track', 'artist', 'source']:
|
for field in ['track', 'artist', 'source']:
|
||||||
if field not in song:
|
if field not in song:
|
||||||
print('Critical field is empty: ' + field)
|
print('\t\tError: Critical field is empty: ' + field)
|
||||||
continue
|
continue
|
||||||
except KeyboardInterrupt:
|
except KeyboardInterrupt:
|
||||||
print('\n\t\tAborting, changes were not saved')
|
print('\n\t\tAborting, changes were not saved')
|
||||||
except EOFError:
|
except EOFError:
|
||||||
album[in_song] = song
|
album[in_song] = song
|
||||||
print('\n\t\tSaving changes')
|
print('\n\t\tChanges cached, ^D again to save')
|
||||||
lib.albums[in_album] = album
|
lib.albums[in_album] = album
|
||||||
lib.save()
|
lib.save()
|
||||||
except KeyboardInterrupt:
|
except KeyboardInterrupt:
|
||||||
|
Loading…
Reference in New Issue
Block a user