Move prompt to its own function
This commit is contained in:
parent
42d4edabb7
commit
89e28db59b
30
badwitch.py
30
badwitch.py
@ -277,11 +277,29 @@ class BadWitch:
|
||||
# Perform action
|
||||
if self.args.action == 'download':
|
||||
lib.download()
|
||||
return
|
||||
if self.args.action == 'gui':
|
||||
qapp = QApplication(sys.argv)
|
||||
gui = BadWitchGUI(self, lib)
|
||||
sys.exit(qapp.exec_())
|
||||
elif self.args.action == 'edit':
|
||||
self.prompt(lib)
|
||||
return
|
||||
elif self.args.action == 'list':
|
||||
for album, albumcontent in lib.albums.items():
|
||||
print(album)
|
||||
for song, songcontent in albumcontent.items():
|
||||
if song == 'meta':
|
||||
continue
|
||||
print('\t' + str(songcontent['track'])
|
||||
+ ' - ' + song
|
||||
+ ' by ' + songcontent['artist'])
|
||||
return
|
||||
else:
|
||||
print('Nothing to do')
|
||||
return
|
||||
|
||||
def prompt(self, lib):
|
||||
print('Bad Witch interactive $ibrary editor')
|
||||
print('^C to abort, ^D to finish changes')
|
||||
print('Loaded library ' + lib.file)
|
||||
@ -347,17 +365,7 @@ class BadWitch:
|
||||
lib.save()
|
||||
print('\n\tSaving changes')
|
||||
print('Closing library')
|
||||
elif self.args.action == 'list':
|
||||
for album, albumcontent in lib.albums.items():
|
||||
print(album)
|
||||
for song, songcontent in albumcontent.items():
|
||||
if song == 'meta':
|
||||
continue
|
||||
print('\t' + str(songcontent['track'])
|
||||
+ ' - ' + song
|
||||
+ ' by ' + songcontent['artist'])
|
||||
else:
|
||||
print('Nothing to do')
|
||||
return
|
||||
|
||||
badwitch = BadWitch()
|
||||
badwitch.execute()
|
||||
|
Loading…
x
Reference in New Issue
Block a user