Fixed mplayer not opening files with spaces or quotes
This commit is contained in:
parent
1fc1cc0d47
commit
29f31b47e3
@ -83,7 +83,7 @@ class MplayerPlayer(BasePlayer):
|
|||||||
self._setProperty('speed', "{:.2f}".format(value))
|
self._setProperty('speed', "{:.2f}".format(value))
|
||||||
|
|
||||||
def openFile(self, filePath):
|
def openFile(self, filePath):
|
||||||
self._listener.sendLine('loadfile {}'.format(filePath))
|
self._listener.sendLine('loadfile {}'.format(self._quoteArg(filePath)))
|
||||||
self._onFileUpdate()
|
self._onFileUpdate()
|
||||||
|
|
||||||
def setPosition(self, value):
|
def setPosition(self, value):
|
||||||
@ -109,6 +109,11 @@ class MplayerPlayer(BasePlayer):
|
|||||||
def _getPosition(self):
|
def _getPosition(self):
|
||||||
self._getProperty('time_pos')
|
self._getProperty('time_pos')
|
||||||
|
|
||||||
|
def _quoteArg(self, arg):
|
||||||
|
arg = arg.replace("'", "\\'")
|
||||||
|
arg = arg.replace('"', '\\"')
|
||||||
|
return '"{}"'.format(arg)
|
||||||
|
|
||||||
def lineReceived(self, line):
|
def lineReceived(self, line):
|
||||||
match = self.RE_ANSWER.match(line)
|
match = self.RE_ANSWER.match(line)
|
||||||
if not match:
|
if not match:
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user