add videos to playlist from chat

This commit is contained in:
kiscs 2020-05-25 17:32:47 +02:00 committed by odrling
parent b71f076bbb
commit 8afdc45f25
3 changed files with 20 additions and 1 deletions

View File

@ -124,6 +124,7 @@ COMMANDS_HELP = ['help', 'h', '?', '/?', r'\?']
COMMANDS_CREATE = ['c', 'create'] COMMANDS_CREATE = ['c', 'create']
COMMANDS_AUTH = ['a', 'auth'] COMMANDS_AUTH = ['a', 'auth']
COMMANDS_TOGGLE = ['t', 'toggle'] COMMANDS_TOGGLE = ['t', 'toggle']
COMMANDS_QUEUE = ['queue', 'q', 'add']
MPC_MIN_VER = "1.6.4" MPC_MIN_VER = "1.6.4"
MPC_BE_MIN_VER = "1.5.2.3123" MPC_BE_MIN_VER = "1.5.2.3123"
VLC_MIN_VERSION = "2.2.1" VLC_MIN_VERSION = "2.2.1"

View File

@ -87,6 +87,7 @@ en = {
"commandlist-notification/create": "\tc [name] - create managed room using name of current room", "commandlist-notification/create": "\tc [name] - create managed room using name of current room",
"commandlist-notification/auth": "\ta [password] - authenticate as room operator with operator password", "commandlist-notification/auth": "\ta [password] - authenticate as room operator with operator password",
"commandlist-notification/chat": "\tch [message] - send a chat message in a room", "commandlist-notification/chat": "\tch [message] - send a chat message in a room",
"commandList-notification/queue": "\tq [file/url] - add file or url to bottom of playlist",
"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

View File

@ -3,12 +3,13 @@ import re
import sys import sys
import threading import threading
import time import time
import os
import syncplay import syncplay
from syncplay import constants from syncplay import constants
from syncplay import utils from syncplay import utils
from syncplay.messages import getMessage from syncplay.messages import getMessage
from syncplay.utils import formatTime from syncplay.utils import formatTime, isURL
class ConsoleUI(threading.Thread): class ConsoleUI(threading.Thread):
@ -184,6 +185,21 @@ class ConsoleUI(threading.Thread):
self._syncplayClient.identifyAsController(controlpassword) self._syncplayClient.identifyAsController(controlpassword)
elif command.group('command') in constants.COMMANDS_TOGGLE: elif command.group('command') in constants.COMMANDS_TOGGLE:
self._syncplayClient.toggleReady() self._syncplayClient.toggleReady()
elif command.group('command') in constants.COMMANDS_QUEUE:
filename = command.group('parameter')
if filename is None:
self.showErrorMessage("No file/url given")
return
elif os.path.isfile(filename) or isURL(filename):
filePath = filename
else:
filePath = self._syncplayClient.fileSwitch.findFilepath(filename)
if filePath is None:
self.showErrorMessage(getMessage("cannot-find-file-for-playlist-switch-error").format(filename))
else:
self._syncplayClient.ui.addFileToPlaylist(filePath)
else: else:
if self._tryAdvancedCommands(data): if self._tryAdvancedCommands(data):
return return
@ -200,6 +216,7 @@ class ConsoleUI(threading.Thread):
self.showMessage(getMessage("commandlist-notification/create"), True) self.showMessage(getMessage("commandlist-notification/create"), True)
self.showMessage(getMessage("commandlist-notification/auth"), True) self.showMessage(getMessage("commandlist-notification/auth"), True)
self.showMessage(getMessage("commandlist-notification/chat"), True) self.showMessage(getMessage("commandlist-notification/chat"), True)
self.showMessage(getMessage("commandList-notification/queue"), 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)