mirror of
https://git.vectorsigma.ru/public/tubearchivist.git
synced 2026-08-04 23:59:24 +00:00
force create thumb folder for manual import
This commit is contained in:
@@ -124,7 +124,7 @@ class ThumbManager(ThumbManagerBase):
|
|||||||
|
|
||||||
img_raw.convert("RGB").save(thumb_path)
|
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"""
|
"""build expected path for video thumbnail from youtube_id"""
|
||||||
folder_name = self.item_id[0].lower()
|
folder_name = self.item_id[0].lower()
|
||||||
folder_path = os.path.join("videos", folder_name)
|
folder_path = os.path.join("videos", folder_name)
|
||||||
@@ -132,6 +132,10 @@ class ThumbManager(ThumbManagerBase):
|
|||||||
if absolute:
|
if absolute:
|
||||||
thumb_path = os.path.join(self.CACHE_DIR, thumb_path)
|
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
|
return thumb_path
|
||||||
|
|
||||||
def download_channel_art(self, urls, skip_existing=False):
|
def download_channel_art(self, urls, skip_existing=False):
|
||||||
|
|||||||
@@ -527,7 +527,8 @@ class ManualImport:
|
|||||||
|
|
||||||
if video.offline_import and self.current_video["thumb"]:
|
if video.offline_import and self.current_video["thumb"]:
|
||||||
old_path = 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)
|
shutil.move(old_path, new_path, copy_function=shutil.copyfile)
|
||||||
else:
|
else:
|
||||||
url = video.json_data["vid_thumb_url"]
|
url = video.json_data["vid_thumb_url"]
|
||||||
|
|||||||
Reference in New Issue
Block a user