diff --git a/tubearchivist/home/src/reindex.py b/tubearchivist/home/src/reindex.py index faea9d3..da279da 100644 --- a/tubearchivist/home/src/reindex.py +++ b/tubearchivist/home/src/reindex.py @@ -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] diff --git a/tubearchivist/home/tasks.py b/tubearchivist/home/tasks.py index b68a6b7..fba2e40 100644 --- a/tubearchivist/home/tasks.py +++ b/tubearchivist/home/tasks.py @@ -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.")