force create thumb folder for manual import

This commit is contained in:
simon 2022-09-06 23:13:29 +07:00
parent a6dd927860
commit 1c3febc49d
No known key found for this signature in database
GPG Key ID: 2C15AA5E89985DD4
2 changed files with 7 additions and 2 deletions

View File

@ -124,7 +124,7 @@ class ThumbManager(ThumbManagerBase):
img_raw.convert("RGB").save(thumb_path)
def vid_thumb_path(self, absolute=False):
def vid_thumb_path(self, absolute=False, create_folder=False):
"""build expected path for video thumbnail from youtube_id"""
folder_name = self.item_id[0].lower()
folder_path = os.path.join("videos", folder_name)
@ -132,6 +132,10 @@ class ThumbManager(ThumbManagerBase):
if absolute:
thumb_path = os.path.join(self.CACHE_DIR, thumb_path)
if create_folder:
folder_path = os.path.join(self.CACHE_DIR, folder_path)
os.makedirs(folder_path, exist_ok=True)
return thumb_path
def download_channel_art(self, urls, skip_existing=False):

View File

@ -527,7 +527,8 @@ class ManualImport:
if video.offline_import and self.current_video["thumb"]:
old_path = self.current_video["thumb"]
new_path = ThumbManager(video_id).vid_thumb_path(absolute=True)
thumbs = ThumbManager(video_id)
new_path = thumbs.vid_thumb_path(absolute=True, create_folder=True)
shutil.move(old_path, new_path, copy_function=shutil.copyfile)
else:
url = video.json_data["vid_thumb_url"]