mirror of
https://github.com/tubearchivist/tubearchivist-frontend.git
synced 2024-12-22 18:00:17 +00:00
add thumbnail download for manual import
This commit is contained in:
parent
0c3c1b650a
commit
08338f3270
@ -413,6 +413,8 @@ class ManualImport:
|
||||
def process_import(self):
|
||||
"""go through identified media files"""
|
||||
|
||||
all_videos_added = []
|
||||
|
||||
for media_file in self.identified:
|
||||
json_file = media_file["json_file"]
|
||||
video_file = media_file["video_file"]
|
||||
@ -425,6 +427,9 @@ class ManualImport:
|
||||
# identify and archive
|
||||
vid_dict = index_new_video(youtube_id)
|
||||
VideoDownloader([youtube_id]).move_to_archive(vid_dict)
|
||||
youtube_id = vid_dict["youtube_id"]
|
||||
thumb_url = vid_dict["vid_thumb_url"]
|
||||
all_videos_added.append((youtube_id, thumb_url))
|
||||
|
||||
# cleanup
|
||||
if os.path.exists(video_path):
|
||||
@ -433,6 +438,8 @@ class ManualImport:
|
||||
json_path = os.path.join(self.CACHE_DIR, "import", json_file)
|
||||
os.remove(json_path)
|
||||
|
||||
return all_videos_added
|
||||
|
||||
def move_to_cache(self, video_path, youtube_id):
|
||||
"""move identified video file to cache, convert to mp4"""
|
||||
file_name = os.path.split(video_path)[-1]
|
||||
|
@ -114,7 +114,8 @@ def run_manual_import():
|
||||
if have_lock:
|
||||
import_handler = ManualImport()
|
||||
if import_handler.identified:
|
||||
import_handler.process_import()
|
||||
all_videos_added = import_handler.process_import()
|
||||
ThumbManager().download_vid(all_videos_added)
|
||||
else:
|
||||
print("Did not acquire lock form import.")
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user