play-raw: Call vlc with one file par arg

This commit is contained in:
nath@home 2015-08-24 20:53:42 +02:00
parent 18d5c3b0a0
commit a23c5d4f67
2 changed files with 9 additions and 10 deletions

View file

@ -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)

View file

@ -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