Add queue and select command (#472)

This commit is contained in:
et0h 2021-10-28 01:25:25 +01:00
parent 16b6623f36
commit e2605577f5
12 changed files with 19 additions and 2 deletions

View File

@ -1,5 +1,5 @@
version = '1.7.0'
revision = ' development'
milestone = 'Yoitsu'
release_number = '100'
release_number = '101'
projectURL = 'https://syncplay.pl/'

View File

@ -1700,6 +1700,7 @@ class SyncplayPlaylist():
self._playlist = []
self._playlistIndex = None
self.addedChangeListCallback = False
self.switchToNewPlaylistItem = False
self._lastPlaylistIndexChange = time.time()
def needsSharedPlaylistsEnabled(f): # @NoSelf
@ -1864,6 +1865,10 @@ class SyncplayPlaylist():
self._ui.showDebugMessage("Could not change playlist index due to IndexError")
def _getValidIndexFromNewPlaylist(self, newPlaylist=None):
if self.switchToNewPlaylistItem:
self.switchToNewPlaylistItem = False
return len(self._playlist)
if self._playlistIndex is None or not newPlaylist or len(newPlaylist) <= 1:
return 0

View File

@ -125,6 +125,7 @@ COMMANDS_CREATE = ['c', 'create']
COMMANDS_AUTH = ['a', 'auth']
COMMANDS_TOGGLE = ['t', 'toggle']
COMMANDS_QUEUE = ['queue', 'qa', 'add']
COMMANDS_QUEUEANDSELECT = ['queueandselect','qas']
COMMANDS_PLAYLIST = ['playlist', 'ql', 'pl']
COMMANDS_SELECT = ['select', 'qs']
COMMANDS_DELETE = ['delete', 'd', 'qd']

View File

@ -89,6 +89,7 @@ de = {
"commandlist-notification/auth": "\ta [password] - authentifiziere als Raumleiter mit Passwort",
"commandlist-notification/chat": "\tch [message] - Chatnachricht an einem Raum senden",
"commandList-notification/queue": "\tqa [file/url] - add file or url to bottom of playlist", # TO DO: Translate
"commandList-notification/queueandselect": "\tqas [file/url] - add file or url to bottom of playlist and select it", # TO DO: Translate
"commandList-notification/playlist": "\tql - show the current playlist", # TO DO: Translate
"commandList-notification/select": "\tqs [index] - select given entry in the playlist", # TO DO: Translate
"commandList-notification/delete": "\tqd [index] - delete the given entry from the playlist", # TO DO: Translate

View File

@ -89,6 +89,7 @@ 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": "\tqa [file/url] - add file or url to bottom of playlist",
"commandList-notification/queueandselect": "\tqas [file/url] - add file or url to bottom of playlist and select it",
"commandList-notification/playlist": "\tql - show the current playlist",
"commandList-notification/select": "\tqs [index] - select given entry in the playlist",
"commandList-notification/delete": "\tqd [index] - delete the given entry from the playlist",

View File

@ -89,6 +89,7 @@ es = {
"commandlist-notification/auth": "\ta [contraseña] - autentificar como operador de la sala con la contraseña de operador",
"commandlist-notification/chat": "\tch [mensaje] - enviar un mensaje en la sala",
"commandList-notification/queue": "\tqa [file/url] - add file or url to bottom of playlist", # TO DO: Translate
"commandList-notification/queueandselect": "\tqas [file/url] - add file or url to bottom of playlist and select it", # TO DO: Translate
"commandList-notification/playlist": "\tql - show the current playlist", # TO DO: Translate
"commandList-notification/select": "\tqs [index] - select given entry in the playlist", # TO DO: Translate
"commandList-notification/delete": "\tqd [index] - delete the given entry from the playlist", # TO DO: Translate

View File

@ -89,6 +89,7 @@ it = {
"commandlist-notification/auth": "\ta [password] - autentica come gestore della stanza, utilizzando la password del gestore",
"commandlist-notification/chat": "\tch [message] - invia un messaggio nella chat della stanza",
"commandList-notification/queue": "\tqa [file/url] - add file or url to bottom of playlist", # TO DO: Translate
"commandList-notification/queueandselect": "\tqas [file/url] - add file or url to bottom of playlist and select it", # TO DO: Translate
"commandList-notification/playlist": "\tql - show the current playlist", # TO DO: Translate
"commandList-notification/select": "\tqs [index] - select given entry in the playlist", # TO DO: Translate
"commandList-notification/delete": "\tqd [index] - delete the given entry from the playlist", # TO DO: Translate

View File

@ -90,6 +90,7 @@ pt_BR = {
"commandlist-notification/auth": "\ta [senha] - autentica-se como operador da sala com a senha",
"commandlist-notification/chat": "\tch [mensagem] - envia uma mensagem no chat da sala",
"commandList-notification/queue": "\tqa [file/url] - adiciona arquivo ou URL para o final da playlist",
"commandList-notification/queueandselect": "\tqas [file/url] - add file or url to bottom of playlist and select it", # TO DO: Translate
"commandList-notification/playlist": "\tql - mostra a playlist atual",
"commandList-notification/select": "\tqs [index] - seleciona uma dada entrada na playlist",
"commandList-notification/delete": "\tqd [index] - deleta uma dada entrada na playlist",

View File

@ -89,6 +89,7 @@ pt_PT = {
"commandlist-notification/auth": "\ta [senha] - autentica-se como administrador da sala com a senha",
"commandlist-notification/chat": "\tch [mensagem] - envia uma mensagem no chat da sala",
"commandList-notification/queue": "\tqa [file/url] - add file or url to bottom of playlist", # TO DO: Translate
"commandList-notification/queueandselect": "\tqas [file/url] - add file or url to bottom of playlist and select it", # TO DO: Translate
"commandList-notification/playlist": "\tql - show the current playlist", # TO DO: Translate
"commandList-notification/select": "\tqs [index] - select given entry in the playlist", # TO DO: Translate
"commandList-notification/delete": "\tqd [index] - delete the given entry from the playlist", # TO DO: Translate

View File

@ -88,6 +88,7 @@ ru = {
"commandlist-notification/auth": "\ta [пароль] - авторизоваться как оператор комнаты с помощью пароля",
"commandlist-notification/chat": "\tch [сообщение] - выслать сообщение в комнату",
"commandList-notification/queue": "\tqa [файл/URL] - добавить файл или URL в конец списка воспроизведения",
"commandList-notification/queueandselect": "\tqas [file/url] - add file or url to bottom of playlist and select it", # TO DO: Translate
"commandList-notification/playlist": "\tql - показать текущий список воспроизведения",
"commandList-notification/select": "\tqs [индекс] - выделить указанный пункт в списке воспроизведения",
"commandList-notification/delete": "\tqd [индекс] - удалить указанный пункт из списка воспроизведения",

View File

@ -89,6 +89,7 @@ tr = {
"commandlist-notification/auth": "\ta [password] - operatör şifresi ile oda operatörü olarak kimlik doğrular",
"commandlist-notification/chat": "\tch [message] - bir odaya sohbet mesajı gönderir",
"commandList-notification/queue": "\tqa [file/url] - oynatma listesinin altına dosya veya bağlantı ekler",
"commandList-notification/queueandselect": "\tqas [file/url] - add file or url to bottom of playlist and select it", # TO DO: Translate
"commandList-notification/playlist": "\tql - mevcut oynatma listesini gösterir",
"commandList-notification/select": "\tqs [index] - oynatma listesinde verilen girişi seçer",
"commandList-notification/delete": "\tqd [index] - verilen girişi oynatma listesinden siler",

View File

@ -193,8 +193,10 @@ class ConsoleUI(threading.Thread):
if filename is None:
self.showErrorMessage("No file/url given")
return
self._syncplayClient.ui.addFileToPlaylist(filename)
elif command.group('command') in constants.COMMANDS_QUEUEANDSELECT:
self._syncplayClient.playlist.switchToNewPlaylistItem = True
self.executeCommand("{} {}".format(constants.COMMANDS_QUEUE[0], command.group('parameter')))
elif command.group('command') in constants.COMMANDS_PLAYLIST:
playlist = self._syncplayClient.playlist
playlist_elements = ["\t{}: {}".format(i+1, el) for i, el in enumerate(playlist._playlist)]
@ -244,6 +246,7 @@ class ConsoleUI(threading.Thread):
self.showMessage(getMessage("commandlist-notification/auth"), True)
self.showMessage(getMessage("commandlist-notification/chat"), True)
self.showMessage(getMessage("commandList-notification/queue"), True)
self.showMessage(getMessage("commandList-notification/queueandselect"), True)
self.showMessage(getMessage("commandList-notification/playlist"), True)
self.showMessage(getMessage("commandList-notification/select"), True)
self.showMessage(getMessage("commandList-notification/delete"), True)