add command to delete files from the playlist
This commit is contained in:
parent
11eb629b1a
commit
bdf8cabc0a
@ -1883,6 +1883,12 @@ class SyncplayPlaylist():
|
|||||||
def addToPlaylist(self, file):
|
def addToPlaylist(self, file):
|
||||||
self.changePlaylist([*self._playlist, file])
|
self.changePlaylist([*self._playlist, file])
|
||||||
|
|
||||||
|
def deleteAtIndex(self, index):
|
||||||
|
new_playlist = self._playlist.copy()
|
||||||
|
if index < len(new_playlist):
|
||||||
|
del new_playlist[index]
|
||||||
|
self.changePlaylist(new_playlist)
|
||||||
|
|
||||||
@needsSharedPlaylistsEnabled
|
@needsSharedPlaylistsEnabled
|
||||||
def undoPlaylistChange(self):
|
def undoPlaylistChange(self):
|
||||||
if self.canUndoPlaylist(self._playlist):
|
if self.canUndoPlaylist(self._playlist):
|
||||||
|
|||||||
@ -127,6 +127,7 @@ COMMANDS_TOGGLE = ['t', 'toggle']
|
|||||||
COMMANDS_QUEUE = ['queue', 'q', 'add']
|
COMMANDS_QUEUE = ['queue', 'q', 'add']
|
||||||
COMMANDS_PLAYLIST = ['playlist', 'ql', 'pl']
|
COMMANDS_PLAYLIST = ['playlist', 'ql', 'pl']
|
||||||
COMMANDS_SELECT = ['select', 'qs']
|
COMMANDS_SELECT = ['select', 'qs']
|
||||||
|
COMMANDS_DELETE = ['delete', 'd', 'qd']
|
||||||
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"
|
||||||
|
|||||||
@ -90,6 +90,7 @@ en = {
|
|||||||
"commandList-notification/queue": "\tq [file/url] - add file or url to bottom of playlist",
|
"commandList-notification/queue": "\tq [file/url] - add file or url to bottom of playlist",
|
||||||
"commandList-notification/playlist": "\tql - show the current playlist",
|
"commandList-notification/playlist": "\tql - show the current playlist",
|
||||||
"commandList-notification/select": "\tqs [index] - select given entry in the playlist",
|
"commandList-notification/select": "\tqs [index] - select given entry in the playlist",
|
||||||
|
"commandList-notification/delete": "\td [index] - delete the given entry from the 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
|
||||||
|
|
||||||
|
|||||||
@ -211,6 +211,13 @@ class ConsoleUI(threading.Thread):
|
|||||||
|
|
||||||
except TypeError:
|
except TypeError:
|
||||||
print("invalid index")
|
print("invalid index")
|
||||||
|
elif command.group('command') in constants.COMMANDS_DELETE:
|
||||||
|
try:
|
||||||
|
index = int(command.group('parameter').strip())
|
||||||
|
self._syncplayClient.playlist.deleteAtIndex(index)
|
||||||
|
|
||||||
|
except TypeError:
|
||||||
|
print("invalid index")
|
||||||
|
|
||||||
else:
|
else:
|
||||||
if self._tryAdvancedCommands(data):
|
if self._tryAdvancedCommands(data):
|
||||||
@ -229,6 +236,9 @@ class ConsoleUI(threading.Thread):
|
|||||||
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("commandList-notification/queue"), True)
|
||||||
|
self.showMessage(getMessage("commandList-notification/playlist"), True)
|
||||||
|
self.showMessage(getMessage("commandList-notification/select"), True)
|
||||||
|
self.showMessage(getMessage("commandList-notification/delete"), 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