From 5bf136c58f4423e627a964e687aaaabb9a33af45 Mon Sep 17 00:00:00 2001 From: Et0h Date: Thu, 2 Jun 2016 20:59:27 +0100 Subject: [PATCH] Give error when media directory does not exist --- syncplay/client.py | 3 +++ syncplay/messages_de.py | 1 + syncplay/messages_en.py | 1 + syncplay/messages_ru.py | 1 + 4 files changed, 6 insertions(+) diff --git a/syncplay/client.py b/syncplay/client.py index 1063882..0913a80 100644 --- a/syncplay/client.py +++ b/syncplay/client.py @@ -1642,6 +1642,9 @@ class FileSwitchManager(object): # Spin up hard drives to prevent premature timeout randomFilename = u"RandomFile"+unicode(random.randrange(10000, 99999))+".txt" for directory in dirsToSearch: + if not os.path.isdir(directory): + self.directorySearchError = getMessage("cannot-find-directory-error").format(directory) + startTime = time.time() if os.path.isfile(os.path.join(directory, randomFilename)): randomFilename = u"RandomFile"+unicode(random.randrange(10000, 99999))+".txt" diff --git a/syncplay/messages_de.py b/syncplay/messages_de.py index a02fa66..7e8844a 100644 --- a/syncplay/messages_de.py +++ b/syncplay/messages_de.py @@ -143,6 +143,7 @@ de = { "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 + "cannot-find-directory-error" : u"Could not find media directory '{}'. To update your list of media directories please select File->Set Media Directories from the menu bar 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 055ce4d..2aafa48 100644 --- a/syncplay/messages_en.py +++ b/syncplay/messages_en.py @@ -143,6 +143,7 @@ en = { "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.", + "cannot-find-directory-error" : u"Could not find media directory '{}'. To update your list of media directories please select File->Set Media Directories from the menu bar 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 660ced1..1b98007 100644 --- a/syncplay/messages_ru.py +++ b/syncplay/messages_ru.py @@ -143,6 +143,7 @@ ru = { "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 + "cannot-find-directory-error" : u"Could not find media directory '{}'. To update your list of media directories please select File->Set Media Directories from the menu bar 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