mirror of
https://github.com/morpheus65535/bazarr.git
synced 2025-01-12 17:57:43 +08:00
Way better logging when trying to download subtitles.
This commit is contained in:
parent
9328c4f140
commit
e8a8c2501a
1 changed files with 17 additions and 8 deletions
|
@ -28,9 +28,18 @@ def download_subtitle(path, language, hi, providers, providers_auth):
|
||||||
logging.exception('Error trying to best subtitles for this file: ' + path)
|
logging.exception('Error trying to best subtitles for this file: ' + path)
|
||||||
return None
|
return None
|
||||||
else:
|
else:
|
||||||
|
try:
|
||||||
best_subtitle = best_subtitles[video][0]
|
best_subtitle = best_subtitles[video][0]
|
||||||
|
except:
|
||||||
|
return None
|
||||||
|
|
||||||
|
else:
|
||||||
|
try:
|
||||||
result = save_subtitles(video, [best_subtitle], encoding='utf-8')
|
result = save_subtitles(video, [best_subtitle], encoding='utf-8')
|
||||||
|
except:
|
||||||
|
logging.error('Error saving subtitles file to disk.')
|
||||||
|
return None
|
||||||
|
else:
|
||||||
downloaded_provider = str(result[0]).strip('<>').split(' ')[0][:-8]
|
downloaded_provider = str(result[0]).strip('<>').split(' ')[0][:-8]
|
||||||
downloaded_language = pycountry.languages.lookup(str(str(result[0]).strip('<>').split(' ')[2].strip('[]'))).name
|
downloaded_language = pycountry.languages.lookup(str(str(result[0]).strip('<>').split(' ')[2].strip('[]'))).name
|
||||||
message = downloaded_language + " subtitles downloaded from " + downloaded_provider + "."
|
message = downloaded_language + " subtitles downloaded from " + downloaded_provider + "."
|
||||||
|
|
Loading…
Reference in a new issue