From a23c5d4f67824d405ed165c6d31bf4f46ea14db0 Mon Sep 17 00:00:00 2001 From: "nath@home" Date: Mon, 24 Aug 2015 20:53:42 +0200 Subject: [PATCH] play-raw: Call vlc with one file par arg --- beets/util/__init__.py | 8 +++++--- beetsplug/play.py | 11 ++++------- 2 files changed, 9 insertions(+), 10 deletions(-) diff --git a/beets/util/__init__.py b/beets/util/__init__.py index 61a95baa2..2b2a13a25 100644 --- a/beets/util/__init__.py +++ b/beets/util/__init__.py @@ -735,7 +735,7 @@ def open_anything(): return base_cmd -def interactive_open(target, command=None): +def interactive_open(target=None, command=None, multiple_targets=[]): """Open the file `target` by `exec`ing a new command. (The new program takes over, and Python execution ends: this does not fork a subprocess.) @@ -756,6 +756,8 @@ def interactive_open(target, command=None): else: base_cmd = open_anything() command = [base_cmd, base_cmd] - - command.append(target) + if multiple_targets: + command = command + multiple_targets + else: + command.append(target) return os.execlp(*command) diff --git a/beetsplug/play.py b/beetsplug/play.py index 38264d9c0..b277349d0 100644 --- a/beetsplug/play.py +++ b/beetsplug/play.py @@ -117,14 +117,15 @@ class PlayPlugin(BeetsPlugin): ui.print_(u'Playing {0} {1}.'.format(len(selection), item_type)) if raw: - passedToCommand = self._concatenatePaths(paths) + passedToCommand = paths else: passedToCommand, m3u = self._createTmpPlaylist(paths) self._log.debug('executing command: {} {}', command_str, passedToCommand) try: - util.interactive_open(passedToCommand, command_str) + util.interactive_open(multiple_targets=passedToCommand, + command=command_str) except OSError as exc: raise ui.UserError("Could not play the music playlist: " "{0}".format(exc)) @@ -138,8 +139,4 @@ class PlayPlugin(BeetsPlugin): for item in pathsList: m3u.write(item + b'\n') m3u.close() - return m3u.name, m3u - - def _concatenatePaths(self, pathsList): - concatenatedPaths = b'"' + b'" "'.join(pathsList) + b'"' - return concatenatedPaths + return [m3u.name], m3u