Add console support for controlled rooms
This commit is contained in:
parent
94ce0221b8
commit
68d163e476
@ -45,6 +45,8 @@ COMMANDS_LIST = ["l", "list", "users"]
|
|||||||
COMMANDS_PAUSE = ["p", "play", "pause"]
|
COMMANDS_PAUSE = ["p", "play", "pause"]
|
||||||
COMMANDS_ROOM = ["r", "room"]
|
COMMANDS_ROOM = ["r", "room"]
|
||||||
COMMANDS_HELP = ['help', 'h', '?', '/?', r'\?']
|
COMMANDS_HELP = ['help', 'h', '?', '/?', r'\?']
|
||||||
|
COMMANDS_CREATE = ['c','create']
|
||||||
|
COMMANDS_IDENTIFY = ['i','identify']
|
||||||
MPC_MIN_VER = "1.6.4"
|
MPC_MIN_VER = "1.6.4"
|
||||||
VLC_MIN_VERSION = "2.0.0"
|
VLC_MIN_VERSION = "2.0.0"
|
||||||
VLC_INTERFACE_MIN_VERSION = "0.2.1"
|
VLC_INTERFACE_MIN_VERSION = "0.2.1"
|
||||||
|
|||||||
@ -53,6 +53,8 @@ en = {
|
|||||||
"commandlist-notification/pause" : "\tp - toggle pause",
|
"commandlist-notification/pause" : "\tp - toggle pause",
|
||||||
"commandlist-notification/seek" : "\t[s][+-]time - seek to the given value of time, if + or - is not specified it's absolute time in seconds or min:sec",
|
"commandlist-notification/seek" : "\t[s][+-]time - seek to the given value of time, if + or - is not specified it's absolute time in seconds or min:sec",
|
||||||
"commandlist-notification/help" : "\th - this help",
|
"commandlist-notification/help" : "\th - this help",
|
||||||
|
"commandlist-notification/create" : "\tc - create controlled room using name of current room",
|
||||||
|
"commandlist-notification/identify" : "\ti [password] - identify as room controller with controller password",
|
||||||
"syncplay-version-notification" : "Syncplay version: {}", # syncplay.version
|
"syncplay-version-notification" : "Syncplay version: {}", # syncplay.version
|
||||||
"more-info-notification" : "More info available at: {}", # projectURL
|
"more-info-notification" : "More info available at: {}", # projectURL
|
||||||
|
|
||||||
|
|||||||
@ -55,14 +55,17 @@ class ConsoleUI(threading.Thread):
|
|||||||
message = u"In room '{}':".format(room)
|
message = u"In room '{}':".format(room)
|
||||||
self.showMessage(message, True)
|
self.showMessage(message, True)
|
||||||
for user in rooms[room]:
|
for user in rooms[room]:
|
||||||
username = "*<{}>*".format(user.username) if user == currentUser else "<{}>".format(user.username)
|
userflags = u""
|
||||||
|
if user.isController():
|
||||||
|
userflags = userflags + u"(Controller) "
|
||||||
|
username = userflags + u"*<{}>*".format(user.username) if user == currentUser else userflags + u"<{}>".format(user.username)
|
||||||
if user.file:
|
if user.file:
|
||||||
message = u"{} is playing:".format(username)
|
message = u"{} is playing:".format(username)
|
||||||
self.showMessage(message, True)
|
self.showMessage(message, True)
|
||||||
message = u" File: '{}' ({})".format(user.file['name'], formatTime(user.file['duration']))
|
message = u" File: '{}' ({})".format(user.file['name'], formatTime(user.file['duration']))
|
||||||
if currentUser.file:
|
if currentUser.file:
|
||||||
if user.file['name'] == currentUser.file['name'] and user.file['size'] != currentUser.file['size']:
|
if user.file['name'] == currentUser.file['name'] and user.file['size'] != currentUser.file['size']:
|
||||||
message += " (their file size is different from yours!)"
|
message += u" (their file size is different from yours!)"
|
||||||
self.showMessage(message, True)
|
self.showMessage(message, True)
|
||||||
else:
|
else:
|
||||||
message = u"{} is not playing a file".format(username)
|
message = u"{} is not playing a file".format(username)
|
||||||
@ -140,6 +143,11 @@ class ConsoleUI(threading.Thread):
|
|||||||
|
|
||||||
self._syncplayClient.setRoom(room)
|
self._syncplayClient.setRoom(room)
|
||||||
self._syncplayClient.sendRoom()
|
self._syncplayClient.sendRoom()
|
||||||
|
elif command.group('command') in constants.COMMANDS_CREATE:
|
||||||
|
self._syncplayClient.createControlledRoom()
|
||||||
|
elif command.group('command') in constants.COMMANDS_IDENTIFY:
|
||||||
|
controlpassword = command.group('parameter')
|
||||||
|
self._syncplayClient.identifyAsController(controlpassword)
|
||||||
else:
|
else:
|
||||||
if self._tryAdvancedCommands(data):
|
if self._tryAdvancedCommands(data):
|
||||||
return
|
return
|
||||||
@ -152,6 +160,8 @@ class ConsoleUI(threading.Thread):
|
|||||||
self.showMessage(getMessage("commandlist-notification/pause"), True)
|
self.showMessage(getMessage("commandlist-notification/pause"), True)
|
||||||
self.showMessage(getMessage("commandlist-notification/seek"), True)
|
self.showMessage(getMessage("commandlist-notification/seek"), True)
|
||||||
self.showMessage(getMessage("commandlist-notification/help"), True)
|
self.showMessage(getMessage("commandlist-notification/help"), True)
|
||||||
|
self.showMessage(getMessage("commandlist-notification/create"), True)
|
||||||
|
self.showMessage(getMessage("commandlist-notification/identify"), True)
|
||||||
self.showMessage(getMessage("syncplay-version-notification").format(syncplay.version), True)
|
self.showMessage(getMessage("syncplay-version-notification").format(syncplay.version), True)
|
||||||
self.showMessage(getMessage("more-info-notification").format(syncplay.projectURL), True)
|
self.showMessage(getMessage("more-info-notification").format(syncplay.projectURL), True)
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user