From 5f9068cb50a7549afae5f648162af4af62aaaf0d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Oliver=20R=C3=BCmpelein?= Date: Sat, 1 Aug 2015 13:55:17 +0200 Subject: [PATCH] Implemented Idea 2 from #1532 * New argument `--optargs` reads string from option * If "{}" is present in the given string, the `optargs` from config-file get inserted at that point. --- beetsplug/play.py | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/beetsplug/play.py b/beetsplug/play.py index 0a51789d3..560370335 100644 --- a/beetsplug/play.py +++ b/beetsplug/play.py @@ -46,7 +46,7 @@ class PlayPlugin(BeetsPlugin): play_command.parser.add_album_option() play_command.parser.add_option( '-o', '--optargs', - action='store_true', + action='store', help='Insert additional arguments into command string' ) play_command.func = self.play_music @@ -59,16 +59,15 @@ class PlayPlugin(BeetsPlugin): command_str = config['play']['command'].get() use_folders = config['play']['use_folders'].get(bool) relative_to = config['play']['relative_to'].get() - optargs = config['play']['optargs'].get() + confargs = config['play']['optargs'].get() if relative_to: relative_to = util.normpath(relative_to) # Prepare command strings with optional args if opts.optargs: - command_str = command_str.format(optargs or '') - else: - command_str = command_str.format('') - + command_str = command_str.format(opts.optargs or '')\ + .format(confargs or '') + # Perform search by album and add folders rather than tracks to # playlist. if opts.album: