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
|
# Perform action
|
||||||
if self.args.action == 'download':
|
if self.args.action == 'download':
|
||||||
lib.download()
|
lib.download()
|
||||||
|
return
|
||||||
if self.args.action == 'gui':
|
if self.args.action == 'gui':
|
||||||
qapp = QApplication(sys.argv)
|
qapp = QApplication(sys.argv)
|
||||||
gui = BadWitchGUI(self, lib)
|
gui = BadWitchGUI(self, lib)
|
||||||
sys.exit(qapp.exec_())
|
sys.exit(qapp.exec_())
|
||||||
elif self.args.action == 'edit':
|
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('Bad Witch interactive $ibrary editor')
|
||||||
print('^C to abort, ^D to finish changes')
|
print('^C to abort, ^D to finish changes')
|
||||||
print('Loaded library ' + lib.file)
|
print('Loaded library ' + lib.file)
|
||||||
@ -347,17 +365,7 @@ class BadWitch:
|
|||||||
lib.save()
|
lib.save()
|
||||||
print('\n\tSaving changes')
|
print('\n\tSaving changes')
|
||||||
print('Closing library')
|
print('Closing library')
|
||||||
elif self.args.action == 'list':
|
return
|
||||||
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')
|
|
||||||
|
|
||||||
badwitch = BadWitch()
|
badwitch = BadWitch()
|
||||||
badwitch.execute()
|
badwitch.execute()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user