video: store original_name and use it for saving

This commit is contained in:
panni 2019-01-15 13:35:58 +01:00
parent c975f7f07c
commit d896599417
1 changed files with 4 additions and 2 deletions

View File

@ -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: