diff --git a/syncplay/client.py b/syncplay/client.py index 92ae5508..9dad9c69 100755 --- a/syncplay/client.py +++ b/syncplay/client.py @@ -2044,6 +2044,13 @@ def changePlaylist(self, files, username=None, resetIndex=False): self._client._protocol.setPlaylist(files) self._client._protocol.setPlaylistIndex(self._playlistIndex) return + if username is None: + if len(files) > constants.PLAYLIST_MAX_ITEMS: + self._ui.showErrorMessage(getMessage("playlist-too-many-items-error").format(constants.PLAYLIST_MAX_ITEMS)) + return + if sum(map(len, files)) > constants.PLAYLIST_MAX_CHARACTERS: + self._ui.showErrorMessage(getMessage("playlist-too-many-characters-error").format(constants.PLAYLIST_MAX_CHARACTERS)) + return self.queuedIndexFilename = None self._client.playlistMayNeedRestoring = False if self._playlist == files: diff --git a/syncplay/messages_en.py b/syncplay/messages_en.py index 263c879b..b5614ee0 100644 --- a/syncplay/messages_en.py +++ b/syncplay/messages_en.py @@ -560,4 +560,6 @@ "playlist-empty-error": "Playlist is currently empty.", "playlist-invalid-index-error": "Invalid playlist index", + "playlist-too-many-items-error": "Playlist exceeds the maximum number of items ({}).", # PLAYLIST_MAX_ITEMS + "playlist-too-many-characters-error": "Playlist exceeds the maximum total character count ({}).", # PLAYLIST_MAX_CHARACTERS }