diff --git a/beetsplug/play.py b/beetsplug/play.py index 27da15b37..c846a755e 100644 --- a/beetsplug/play.py +++ b/beetsplug/play.py @@ -90,6 +90,9 @@ class PlayPlugin(BeetsPlugin): command_str = command_str.replace(ARGS_MARKER, opts.args) else: command_str = u"{} {}".format(command_str, opts.args) + else: + if ARGS_MARKER in command_str: + command_str = command_str.replace(" "+ARGS_MARKER, "") # Perform search by album and add folders rather than tracks to # playlist. diff --git a/test/test_play.py b/test/test_play.py index 7357cf3c6..38524aa7d 100644 --- a/test/test_play.py +++ b/test/test_play.py @@ -67,6 +67,12 @@ class PlayPluginTest(unittest.TestCase, TestHelper): self.run_and_assert( open_mock, [u'-A', u'foo', u'title:aNiceTitle'], u'echo foo other') + def test_unset_args_option_in_middle(self, open_mock): + self.config['play']['command'] = 'echo $args other' + + self.run_and_assert( + open_mock, [u'title:aNiceTitle'], u'echo other') + def test_relative_to(self, open_mock): self.config['play']['command'] = 'echo' self.config['play']['relative_to'] = '/something'