diff --git a/syncplay/constants.py b/syncplay/constants.py index b2bf82f..a9b6985 100755 --- a/syncplay/constants.py +++ b/syncplay/constants.py @@ -125,6 +125,8 @@ COMMANDS_CREATE = ['c', 'create'] COMMANDS_AUTH = ['a', 'auth'] COMMANDS_TOGGLE = ['t', 'toggle'] COMMANDS_QUEUE = ['queue', 'q', 'add'] +COMMANDS_PLAYLIST = ['playlist', 'ql', 'pl'] +COMMANDS_SELECT = ['select', 'qs'] MPC_MIN_VER = "1.6.4" MPC_BE_MIN_VER = "1.5.2.3123" VLC_MIN_VERSION = "2.2.1" diff --git a/syncplay/messages_en.py b/syncplay/messages_en.py index d16e96d..f2d1309 100755 --- a/syncplay/messages_en.py +++ b/syncplay/messages_en.py @@ -88,6 +88,8 @@ en = { "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/queue": "\tq [file/url] - add file or url to bottom of playlist", + "commandList-notification/playlist": "\tql - show the current playlist", + "commandList-notification/select": "\tqs [index] - select given entry in the playlist", "syncplay-version-notification": "Syncplay version: {}", # syncplay.version "more-info-notification": "More info available at: {}", # projectURL diff --git a/syncplay/ui/consoleUI.py b/syncplay/ui/consoleUI.py index 5025efc..2d1f9fb 100755 --- a/syncplay/ui/consoleUI.py +++ b/syncplay/ui/consoleUI.py @@ -197,6 +197,20 @@ class ConsoleUI(threading.Thread): return self._syncplayClient.ui.addFileToPlaylist(filename) + elif command.group('command') in constants.COMMANDS_PLAYLIST: + playlist_elements = [f"\t{i}: {el}" for i, el in enumerate(self._syncplayClient.playlist._playlist)] + if playlist_elements: + print(*playlist_elements, sep='\n') + else: + print("playlist is currently empty.") + elif command.group('command') in constants.COMMANDS_SELECT: + try: + index = int(command.group('parameter').strip()) + self._syncplayClient.playlist.changeToPlaylistIndex(index, resetPosition=True) + self._syncplayClient.rewindFile() + + except TypeError: + print("invalid index") else: if self._tryAdvancedCommands(data):