diff --git a/syncplay/client.py b/syncplay/client.py index 23c21e8..1063882 100644 --- a/syncplay/client.py +++ b/syncplay/client.py @@ -1405,6 +1405,9 @@ class SyncplayPlaylist(): return try: + if index is None: + self._ui.showDebugMessage(u"Cannot switch to None index in playlist") + return filename = self._playlist[index] # TODO: Handle isse with index being None if utils.isURL(filename): @@ -1597,14 +1600,18 @@ class FileSwitchManager(object): self.currentDirectory = curDir def changeMediaDirectories(self, mediaDirs): - if mediaDirs <> self._client._config["mediaSearchDirectories"]: - from syncplay.ui.ConfigurationGetter import ConfigurationGetter - ConfigurationGetter().setConfigOption("mediaSearchDirectories", mediaDirs) - self._client._config["mediaSearchDirectories"] = mediaDirs - self._client.ui.showMessage(getMessage("media-directory-list-updated-notification")) + from syncplay.ui.ConfigurationGetter import ConfigurationGetter + ConfigurationGetter().setConfigOption("mediaSearchDirectories", mediaDirs) + self._client._config["mediaSearchDirectories"] = mediaDirs + self._client.ui.showMessage(getMessage("media-directory-list-updated-notification")) self.mediaDirectoriesNotFound = [] self.folderSearchEnabled = True self.setMediaDirectories(mediaDirs) + if mediaDirs == "": + self._client.ui.showErrorMessage(getMessage("no-media-directories-error")) + self.mediaFilesCache = {} + self.newInfo = True + self.checkForFileSwitchUpdate() def setMediaDirectories(self, mediaDirs): self.mediaDirectories = mediaDirs diff --git a/syncplay/messages_de.py b/syncplay/messages_de.py index 89a824f..658ef63 100644 --- a/syncplay/messages_de.py +++ b/syncplay/messages_de.py @@ -142,6 +142,7 @@ de = { "folder-search-timeout-error" : u"The search for media in media directories was aborted as it took too long to search through '{}'. This will occur if you select a folder with too many sub-folders in your list of media folders to search through. For automatic file switching to work again please select File->Set Media Directories in the menu bar and remove this directory or replace it with an appropriate sub-folder.", #Folder # TODO: Translate "folder-search-first-file-timeout-error" : u"The search for media in '{}' was aborted as it took too long to access the directory. This could happen if it is a network drive or if you configure your drive to spin down after a period of inactivity. For automatic file switching to work again please go to File->Set Media Directories and either remove the directory or resolve the issue (e.g. by changing power saving settings).", #Folder # TODO: Translate "added-file-not-in-media-directory-error" : u"You loaded a file in '{}' which is not a known media directory. You can add this as a media directory by selecting File->Set Media Directories in the menu bar.", #Folder # TODO: Translate + "no-media-directories-error" : u"No media directories have been set. For shared playlist and file switching features to work properly please select File->Set Media Directories and specify where Syncplay should look to find media files.", # TODO: Translate "failed-to-load-server-list-error" : u"Konnte die Liste der öffentlichen Server nicht laden. Bitte besuche http://www.syncplay.pl/ [Englisch] mit deinem Browser.", diff --git a/syncplay/messages_en.py b/syncplay/messages_en.py index ba99bec..08347ac 100644 --- a/syncplay/messages_en.py +++ b/syncplay/messages_en.py @@ -142,6 +142,7 @@ en = { "folder-search-timeout-error" : u"The search for media in media directories was aborted as it took too long to search through '{}'. This will occur if you select a folder with too many sub-folders in your list of media folders to search through. For automatic file switching to work again please select File->Set Media Directories in the menu bar and remove this directory or replace it with an appropriate sub-folder.", #Folder "folder-search-first-file-timeout-error" : u"The search for media in '{}' was aborted as it took too long to access the directory. This could happen if it is a network drive or if you configure your drive to spin down after a period of inactivity. For automatic file switching to work again please go to File->Set Media Directories and either remove the directory or resolve the issue (e.g. by changing power saving settings).", #Folder "added-file-not-in-media-directory-error" : u"You loaded a file in '{}' which is not a known media directory. You can add this as a media directory by selecting File->Set Media Directories in the menu bar.", #Folder + "no-media-directories-error" : u"No media directories have been set. For shared playlist and file switching features to work properly please select File->Set Media Directories and specify where Syncplay should look to find media files.", "failed-to-load-server-list-error" : u"Failed to load public server list. Please visit http://www.syncplay.pl/ in your browser.", diff --git a/syncplay/messages_ru.py b/syncplay/messages_ru.py index 5efbc89..45db12c 100644 --- a/syncplay/messages_ru.py +++ b/syncplay/messages_ru.py @@ -142,6 +142,7 @@ ru = { "folder-search-timeout-error" : u"The search for media in media directories was aborted as it took too long to search through '{}'. This will occur if you select a folder with too many sub-folders in your list of media folders to search through. For automatic file switching to work again please select File->Set Media Directories in the menu bar and remove this directory or replace it with an appropriate sub-folder.", #Folder # TODO: Translate "folder-search-first-file-timeout-error" : u"The search for media in '{}' was aborted as it took too long to access the directory. This could happen if it is a network drive or if you configure your drive to spin down after a period of inactivity. For automatic file switching to work again please go to File->Set Media Directories and either remove the directory or resolve the issue (e.g. by changing power saving settings).", #Folder # TODO: Translate "added-file-not-in-media-directory-error" : u"You loaded a file in '{}' which is not a known media directory. You can add this as a media directory by selecting File->Set Media Directories in the menu bar.", #Folder #TODO: Translate + "no-media-directories-error" : u"No media directories have been set. For shared playlist and file switching features to work properly please select File->Set Media Directories and specify where Syncplay should look to find media files.", # TODO: Translate "failed-to-load-server-list-error" : u"Failed to load public server list. Please visit http://www.syncplay.pl/ in your browser.", # TODO: Translate into Russian diff --git a/syncplay/ui/gui.py b/syncplay/ui/gui.py index 40b5ddc..17283f4 100644 --- a/syncplay/ui/gui.py +++ b/syncplay/ui/gui.py @@ -299,6 +299,8 @@ class MainWindow(QtGui.QMainWindow): self.playlistGroup.setChecked(self.config['sharedPlaylistEnabled']) self.playlistGroup.blockSignals(False) self._syncplayClient.fileSwitch.setMediaDirectories(self.config["mediaSearchDirectories"]) + if not self.config["mediaSearchDirectories"]: + self._syncplayClient.ui.showErrorMessage(getMessage("no-media-directories-error")) self.updateReadyState(self.config['readyAtStart']) autoplayInitialState = self.config['autoplayInitialState'] if autoplayInitialState is not None: