reworking messaging

This commit is contained in:
david hamp-gonsalves 2014-04-19 09:34:50 -03:00
parent 44e84e775a
commit f67490c464

View file

@ -62,14 +62,14 @@ def play_music(lib, opts, args):
itemType += 's' if len(paths) > 1 else ''
if not paths:
ui.print_(ui.colorize('yellow', 'no {0} to play.'.format(itemType)))
ui.print_(ui.colorize('yellow', 'No {0} to play.'.format(itemType)))
return
# Warn user before playing any huge playlists.
if len(paths) > 100:
ui.print_(ui.colorize('yellow',
'do you really want to play {0} {1}?'
.format(len(paths), itemType)))
ui.print_(ui.colorize(
'yellow',
'You are about to queue {0} {1}.'.format(len(paths), itemType)))
if ui.input_options(('Continue', 'Abort')) == 'a':
return
@ -85,13 +85,13 @@ def play_music(lib, opts, args):
FNULL = open(os.devnull, 'w')
subprocess.Popen([command, m3u.name],
stdout=FNULL, stderr=subprocess.STDOUT)
stdout=FNULL, stderr=subprocess.STDOUT)
FNULL.close()
else:
subprocess.Popen([command, m3u.name])
ui.print_('playing {0} {1}.'.format(len(paths), itemType))
ui.print_('Playing {0} {1}.'.format(len(paths), itemType))
class PlayPlugin(BeetsPlugin):
@ -105,10 +105,12 @@ class PlayPlugin(BeetsPlugin):
})
def commands(self):
play_command = Subcommand('play',
help='send query results to music player as playlist.')
play_command.parser.add_option('-a', '--album',
action='store_true', default=False,
help='query and load albums(folders) rather then tracks.')
play_command = Subcommand(
'play',
help='Send query results to music player as playlist.')
play_command.parser.add_option(
'-a', '--album',
action='store_true', default=False,
help='Query and load albums(as folders) rather then tracks.')
play_command.func = play_music
return [play_command]