From d896599417d900ad12788e7e401e9d2f9c150cf7 Mon Sep 17 00:00:00 2001 From: panni Date: Tue, 15 Jan 2019 13:35:58 +0100 Subject: [PATCH] video: store original_name and use it for saving --- bazarr/get_subtitle.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/bazarr/get_subtitle.py b/bazarr/get_subtitle.py index cf07b216e..b82fc7d80 100644 --- a/bazarr/get_subtitle.py +++ b/bazarr/get_subtitle.py @@ -51,6 +51,7 @@ def get_video(path, title, sceneName, use_scenename, providers=None, media_type= """ hints = {"title": title, "type": "movie" if media_type == "movie" else "episode"} dont_use_actual_file = False + original_name = os.path.basename(path) if sceneName != "None" and use_scenename: # use the sceneName but keep the folder structure for better guessing path = os.path.join(os.path.dirname(path), sceneName + os.path.splitext(path)[1]) @@ -59,6 +60,7 @@ def get_video(path, title, sceneName, use_scenename, providers=None, media_type= try: video = parse_video(path, hints=hints, providers=providers, dry_run=dont_use_actual_file) video.used_scene_name = dont_use_actual_file + video.original_name = original_name return video except: @@ -244,7 +246,7 @@ def download_subtitle(path, language, hi, providers, providers_auth, sceneName, continue try: - saved_subtitles = save_subtitles(video.name, subtitles, single=single, + saved_subtitles = save_subtitles(video.original_name, subtitles, single=single, tags=None, # fixme directory=None, # fixme chmod=None, # fixme @@ -412,7 +414,7 @@ def manual_download_subtitle(path, language, hi, subtitle, provider, providers_a return try: score = round(subtitle.score / max_score * 100, 2) - saved_subtitles = save_subtitles(video.name, [subtitle], single=single, + saved_subtitles = save_subtitles(video.original_name, [subtitle], single=single, path_decoder=force_unicode) except Exception as e: