From 30b28afa14c4507a26e5d81631c6e5b7eb14481d Mon Sep 17 00:00:00 2001 From: Et0h Date: Sun, 30 Nov 2014 12:01:33 +0000 Subject: [PATCH] Allow players to have custom open dialogs (e.g. for XBMC) --- syncplay/players/basePlayer.py | 8 +++++++- syncplay/players/mpc.py | 1 + syncplay/players/mplayer.py | 1 + syncplay/players/vlc.py | 1 + syncplay/ui/gui.py | 4 ++++ 5 files changed, 14 insertions(+), 1 deletion(-) diff --git a/syncplay/players/basePlayer.py b/syncplay/players/basePlayer.py index 97fc2a2..5093668 100644 --- a/syncplay/players/basePlayer.py +++ b/syncplay/players/basePlayer.py @@ -82,7 +82,13 @@ class BasePlayer(object): @staticmethod def getExpandedPath(path): raise NotImplementedError() - + + ''' + Opens a custom media browse dialog, and then changes to that media if appropriate + ''' + @staticmethod + def openCustomOpenDialog(self): + raise NotImplementedError() class DummyPlayer(BasePlayer): diff --git a/syncplay/players/mpc.py b/syncplay/players/mpc.py index d23d857..d79a9ef 100644 --- a/syncplay/players/mpc.py +++ b/syncplay/players/mpc.py @@ -306,6 +306,7 @@ class MpcHcApi: class MPCHCAPIPlayer(BasePlayer): speedSupported = False + customOpenDialog = False def __init__(self, client): from twisted.internet import reactor diff --git a/syncplay/players/mplayer.py b/syncplay/players/mplayer.py index c01ac5f..db14c91 100644 --- a/syncplay/players/mplayer.py +++ b/syncplay/players/mplayer.py @@ -9,6 +9,7 @@ import os class MplayerPlayer(BasePlayer): speedSupported = True + customOpenDialog = False RE_ANSWER = re.compile(constants.MPLAYER_ANSWER_REGEX) POSITION_QUERY = 'time_pos' OSD_QUERY = 'osd_show_text' diff --git a/syncplay/players/vlc.py b/syncplay/players/vlc.py index 18a77a6..dd35517 100644 --- a/syncplay/players/vlc.py +++ b/syncplay/players/vlc.py @@ -13,6 +13,7 @@ from syncplay.messages import getMessage class VlcPlayer(BasePlayer): speedSupported = True + customOpenDialog = False RE_ANSWER = re.compile(constants.VLC_ANSWER_REGEX) SLAVE_ARGS = constants.VLC_SLAVE_ARGS if not sys.platform.startswith('darwin'): diff --git a/syncplay/ui/gui.py b/syncplay/ui/gui.py index 0bc77f2..5b02d8b 100644 --- a/syncplay/ui/gui.py +++ b/syncplay/ui/gui.py @@ -341,6 +341,10 @@ class MainWindow(QtGui.QMainWindow): settings.endGroup() def browseMediapath(self): + if self._syncplayClient._player.customOpenDialog == True: + self._syncplayClient._player.openCustomOpenDialog() + return + self.loadMediaBrowseSettings() options = QtGui.QFileDialog.Options() if os.path.isdir(self.mediadirectory):