Added openFile(filePath) method for players.

This commit is contained in:
Uriziel 2013-06-12 00:08:05 +02:00
parent 1afe3b074b
commit 53266f9b3d
4 changed files with 19 additions and 1 deletions

View File

@ -46,6 +46,13 @@ class BasePlayer(object):
def setSpeed(self, value):
raise NotImplementedError()
'''
@type filePath: string
'''
def openFile(self, filePath):
raise NotImplementedError()
'''
@return: list of strings
'''

View File

@ -383,7 +383,10 @@ class MPCHCAPIPlayer(BasePlayer):
if(self.__mpcVersion[0:3] >= ['1', '6', '5']):
self.speedSupported = True
if(filePath):
self._mpcApi.openFile(filePath)
self.openFile(filePath)
def openFile(self, filePath):
self._mpcApi.openFile(filePath)
def displayMessage(self, message, duration = (constants.OSD_DURATION*1000)):
self._mpcApi.sendOsd(message, constants.MPC_OSD_POSITION, duration)

View File

@ -82,6 +82,11 @@ class MplayerPlayer(BasePlayer):
def setSpeed(self, value):
self._setProperty('speed', "{:.2f}".format(value))
def openFile(self, filePath):
pass
#Notification about new file opened must be added first.
#self._setProperty('loadfile', "{}".format(filePath))
def setPosition(self, value):
self._position = value
self._setProperty('time_pos', "{}".format(value))

View File

@ -95,6 +95,9 @@ class VlcPlayer(BasePlayer):
self._paused = value
self._listener.sendLine('set-playstate: {}'.format("paused" if value else "playing"))
def openFile(self, filePath):
self._listener.sendLine('load-file: {}'.format(filePath))
def _getFileInfo(self):
self._listener.sendLine("get-duration")
self._listener.sendLine("get-filepath")