download thumbnail for manual import

This commit is contained in:
simon 2022-08-10 21:47:26 +07:00
parent 44473a364f
commit 35f1084cc2
No known key found for this signature in database
GPG Key ID: 2C15AA5E89985DD4

View File

@ -12,6 +12,7 @@ import shutil
import subprocess
from home.src.download.queue import PendingList
from home.src.download.thumbnails import ThumbManager
from home.src.es.connect import ElasticWrap
from home.src.index.reindex import Reindex
from home.src.index.video import YoutubeVideo, index_new_video
@ -466,7 +467,8 @@ class ManualImport:
def index_metadata(self):
"""get metadata from yt or json"""
video = YoutubeVideo(self.current_video["video_id"])
video_id = self.current_video["video_id"]
video = YoutubeVideo(video_id)
video.build_json(
youtube_meta_overwrite=self._get_info_json(),
media_path=self.current_video["media"],
@ -474,6 +476,9 @@ class ManualImport:
video.check_subtitles()
video.upload_to_es()
url = video.json_data["vid_thumb_url"]
ThumbManager(video_id).download_video_thumb(url)
return video.json_data
def _get_info_json(self):