Exported remaining VLC related constants to constants.py

This commit is contained in:
daniel-123 2013-06-11 19:57:14 +02:00
parent 9479bd4ffa
commit bccc4db613
2 changed files with 10 additions and 8 deletions

View File

@ -26,6 +26,7 @@ COMMANDS_PAUSE = ["p", "play", "pause"]
COMMANDS_ROOM = ["r", "room"]
COMMANDS_HELP = ['help', 'h', '?', '/?', r'\?']
MPC_MIN_VER = "1.6.4"
VLC_MIN_VERSION = "2.0.6"
MPC_PATHS = [
r"C:\Program Files (x86)\MPC-HC\mpc-hc.exe",
r"C:\Program Files\MPC-HC\mpc-hc.exe",
@ -55,11 +56,15 @@ MPC_MAX_RETRIES = 30
MPC_PAUSE_TOGGLE_DELAY = 0.05
VLC_OPEN_MAX_WAIT_TIME = 10
VLC_SOCKET_OPEN_WAIT_TIME = 0.5
VLC_MIN_PORT = 10000
VLC_MAX_PORT = 55000
#These are not changes you're looking for
MPLAYER_SLAVE_ARGS = [ '-slave', '--hr-seek=always', '-nomsgcolor', '-msglevel', 'all=1:global=4:cplayer=4']
MPV_SLAVE_ARGS = [ '--slave-broken', '--hr-seek=always', '-msglevel', 'all=1:global=4']
VLC_SLAVE_ARGS = ['--extraintf=luaintf','--lua-intf=syncplay']
MPLAYER_ANSWER_REGEX = "^ANS_([a-zA-Z_]+)=(.+)$"
VLC_ANSWER_REGEX = r"(?:^(?P<command>[a-zA-Z_]+)(?:\: )?(?P<argument>.*))"
UI_COMMAND_REGEX = r"^(?P<command>[^\ ]+)(?:\ (?P<parameter>.+))?"
UI_OFFSET_REGEX = r"^(?:o|offset)\ ?(?P<sign>[/+-])?(?P<time>\d{1,4}(?:[^\d\.](?:\d{1,6})){0,2}(?:\.(?:\d{1,3}))?)$"
UI_SEEK_REGEX = r"^(?:s|seek)?\ ?(?P<sign>[+-])?(?P<time>\d{1,4}(?:[^\d\.](?:\d{1,6})){0,2}(?:\.(?:\d{1,3}))?)$"

View File

@ -12,14 +12,11 @@ import time
class VlcPlayer(BasePlayer):
speedSupported = True
RE_ANSWER = re.compile(r"(?:^(?P<command>[a-zA-Z_]+)(?:\: )?(?P<argument>.*))")
VLC_MIN_PORT = 10000
VLC_MAX_PORT = 55000
SLAVE_ARGS = ['--extraintf=luaintf','--lua-intf=syncplay']
VLC_MIN_VERSION = "2.0.6"
RE_ANSWER = re.compile(constants.VLC_ANSWER_REGEX)
SLAVE_ARGS = constants.VLC_SLAVE_ARGS
random.seed()
vlcport = random.randrange(VLC_MIN_PORT, VLC_MAX_PORT) if (VLC_MIN_PORT < VLC_MAX_PORT) else VLC_MIN_PORT
vlcport = random.randrange(constants.VLC_MIN_PORT, constants.VLC_MAX_PORT) if (constants.VLC_MIN_PORT < constants.VLC_MAX_PORT) else constants.VLC_MIN_PORT
SLAVE_ARGS.append('--lua-config=syncplay={{port=\"{}\"}}'.format(str(vlcport)))
def __init__(self, client, playerPath, filePath, args):
@ -133,8 +130,8 @@ class VlcPlayer(BasePlayer):
self._filenameAsk.set()
elif (line[:16] == "VLC media player"):
vlc_version = line[17:22]
if (int(vlc_version.replace(".","")) < int(self.VLC_MIN_VERSION.replace(".",""))):
self._client.ui.showMessage(getMessage("en", "vlc-version-mismatch").format(str(vlc_version), str(self.VLC_MIN_VERSION)))
if (int(vlc_version.replace(".","")) < int(constants.VLC_MIN_VERSION.replace(".",""))):
self._client.ui.showMessage(getMessage("en", "vlc-version-mismatch").format(str(vlc_version), str(constants.VLC_MIN_VERSION)))
self._vlcready.set()