diff --git a/beetsplug/play.py b/beetsplug/play.py index 65d5b91ec..1c8a062c9 100644 --- a/beetsplug/play.py +++ b/beetsplug/play.py @@ -35,6 +35,7 @@ class PlayPlugin(BeetsPlugin): 'command': None, 'use_folders': False, 'relative_to': None, + 'optional_args': None, }) def commands(self): @@ -43,19 +44,28 @@ class PlayPlugin(BeetsPlugin): help='send music to a player as a playlist' ) play_command.parser.add_album_option() + play_command.parser.add_option('-o','--optargs',action='store_true', + help='Insert additional arguments into command string') play_command.func = self.play_music return [play_command] def play_music(self, lib, opts, args): """Execute query, create temporary playlist and execute player - command passing that playlist. + command passing that playlist, at request insert optional arguments. """ command_str = config['play']['command'].get() use_folders = config['play']['use_folders'].get(bool) relative_to = config['play']['relative_to'].get() + optional_args = config['play']['optional_args'].get() if relative_to: relative_to = util.normpath(relative_to) + # Prepare command strings wirh optional args + if opts.optargs: + command_str=command_str.format(optional_args or '') + else: + command_str=command_str.format('') + # Perform search by album and add folders rather than tracks to # playlist. if opts.album: