Skip to content

Commit

Permalink
Fix the 'ok' button of the subtitles selection GUI
Browse files Browse the repository at this point in the history
Signed-off-by: Emeric Grange <emeric.grange@gmail.com>
  • Loading branch information
emericg committed Apr 15, 2012
1 parent 3ade5fc commit bf76d62
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions gnome/opensubtitles-download.py
Expand Up @@ -180,8 +180,8 @@ def hashFile(path):
subprocess.call(['zenity', '--error', '--text=Unable to reach opensubtitles.org server.\n\nPlease check:\n- Your Internet connection status\n- www.opensubtitles.org availability']) subprocess.call(['zenity', '--error', '--text=Unable to reach opensubtitles.org server.\n\nPlease check:\n- Your Internet connection status\n- www.opensubtitles.org availability'])
exit(1) exit(1)


searchResult = 0
searchLanguage = 0 searchLanguage = 0
searchLanguageResult = 0
movieHash = hashFile(moviePath) movieHash = hashFile(moviePath)
movieSize = os.path.getsize(moviePath) movieSize = os.path.getsize(moviePath)
movieFileName = os.path.basename(moviePath) movieFileName = os.path.basename(moviePath)
Expand All @@ -202,7 +202,7 @@ def hashFile(path):
if subtitlesList['data']: if subtitlesList['data']:


# Mark search as successful # Mark search as successful
searchResult += 1 searchLanguageResult += 1


# Sanitize the title string to avoid parsing errors # Sanitize the title string to avoid parsing errors
for item in subtitlesList['data']: for item in subtitlesList['data']:
Expand Down Expand Up @@ -265,7 +265,7 @@ def hashFile(path):
subtitlesSelected = '' subtitlesSelected = ''
retcode = 0 retcode = 0


if retcode == 0: if retcode != -1:
subIndex = 0 subIndex = 0
subIndexTemp = 0 subIndexTemp = 0


Expand All @@ -284,7 +284,7 @@ def hashFile(path):


# Write language code into the filename ? # Write language code into the filename ?
if (opt_file_languagecode == 'on' or \ if (opt_file_languagecode == 'on' or \
opt_file_languagecode == 'auto' and searchLanguage > 1): opt_file_languagecode == 'auto' and searchLanguageResult > 1):
subPath = moviePath.rsplit('.', 1)[0] + subLangId + '.' + subtitlesList['data'][subIndex]['SubFormat'] subPath = moviePath.rsplit('.', 1)[0] + subLangId + '.' + subtitlesList['data'][subIndex]['SubFormat']


# Download and unzip the selected subtitles (with progressbar) # Download and unzip the selected subtitles (with progressbar)
Expand All @@ -296,7 +296,7 @@ def hashFile(path):
exit(1) exit(1)


# Print a message if none of the subtitles languages have been found # Print a message if none of the subtitles languages have been found
if searchResult == 0: if searchLanguageResult == 0:
subprocess.call(['zenity', '--info', '--title=No subtitles found for ' + movieFileName, '--text=No subtitles found for this video:\n<i>' + movieFileName + '</i>']) subprocess.call(['zenity', '--info', '--title=No subtitles found for ' + movieFileName, '--text=No subtitles found for this video:\n<i>' + movieFileName + '</i>'])


# Disconnect from opensubtitles.org server, then exit # Disconnect from opensubtitles.org server, then exit
Expand Down

0 comments on commit bf76d62

Please sign in to comment.