Skip to content

Commit

Permalink
Add queue and select command (#472)
Browse files Browse the repository at this point in the history
  • Loading branch information
Et0h committed Oct 28, 2021
1 parent 16b6623 commit e260557
Show file tree
Hide file tree
Showing 12 changed files with 19 additions and 2 deletions.
2 changes: 1 addition & 1 deletion syncplay/__init__.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
version = '1.7.0'
revision = ' development'
milestone = 'Yoitsu'
release_number = '100'
release_number = '101'
projectURL = 'https://syncplay.pl/'
5 changes: 5 additions & 0 deletions syncplay/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -1700,6 +1700,7 @@ def __init__(self, client):
self._playlist = []
self._playlistIndex = None
self.addedChangeListCallback = False
self.switchToNewPlaylistItem = False
self._lastPlaylistIndexChange = time.time()

def needsSharedPlaylistsEnabled(f): # @NoSelf
Expand Down Expand Up @@ -1864,6 +1865,10 @@ def switchToNewPlaylistIndex(self, index, resetPosition = False):
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

Expand Down
1 change: 1 addition & 0 deletions syncplay/constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,7 @@ def getValueForOS(constantDict):
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']
Expand Down
1 change: 1 addition & 0 deletions syncplay/messages_de.py
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,7 @@
"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
Expand Down
1 change: 1 addition & 0 deletions syncplay/messages_en.py
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,7 @@
"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",
Expand Down
1 change: 1 addition & 0 deletions syncplay/messages_es.py
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,7 @@
"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
Expand Down
1 change: 1 addition & 0 deletions syncplay/messages_it.py
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,7 @@
"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
Expand Down
1 change: 1 addition & 0 deletions syncplay/messages_pt_BR.py
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,7 @@
"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",
Expand Down
1 change: 1 addition & 0 deletions syncplay/messages_pt_PT.py
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,7 @@
"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
Expand Down
1 change: 1 addition & 0 deletions syncplay/messages_ru.py
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,7 @@
"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 [индекс] - удалить указанный пункт из списка воспроизведения",
Expand Down
1 change: 1 addition & 0 deletions syncplay/messages_tr.py
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,7 @@
"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",
Expand Down
5 changes: 4 additions & 1 deletion syncplay/ui/consoleUI.py
Original file line number Diff line number Diff line change
Expand Up @@ -193,8 +193,10 @@ def executeCommand(self, data):
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)]
Expand Down Expand Up @@ -244,6 +246,7 @@ def executeCommand(self, data):
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)
Expand Down

0 comments on commit e260557

Please sign in to comment.