video: store original_name and use it for saving

pull/292/head
panni 6 years ago
parent c975f7f07c
commit d896599417

@ -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"} hints = {"title": title, "type": "movie" if media_type == "movie" else "episode"}
dont_use_actual_file = False dont_use_actual_file = False
original_name = os.path.basename(path)
if sceneName != "None" and use_scenename: if sceneName != "None" and use_scenename:
# use the sceneName but keep the folder structure for better guessing # 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]) 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: try:
video = parse_video(path, hints=hints, providers=providers, dry_run=dont_use_actual_file) video = parse_video(path, hints=hints, providers=providers, dry_run=dont_use_actual_file)
video.used_scene_name = dont_use_actual_file video.used_scene_name = dont_use_actual_file
video.original_name = original_name
return video return video
except: except:
@ -244,7 +246,7 @@ def download_subtitle(path, language, hi, providers, providers_auth, sceneName,
continue continue
try: try:
saved_subtitles = save_subtitles(video.name, subtitles, single=single, saved_subtitles = save_subtitles(video.original_name, subtitles, single=single,
tags=None, # fixme tags=None, # fixme
directory=None, # fixme directory=None, # fixme
chmod=None, # fixme chmod=None, # fixme
@ -412,7 +414,7 @@ def manual_download_subtitle(path, language, hi, subtitle, provider, providers_a
return return
try: try:
score = round(subtitle.score / max_score * 100, 2) 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) path_decoder=force_unicode)
except Exception as e: except Exception as e:

Loading…
Cancel
Save