mirror of
https://github.com/tubearchivist/tubearchivist-frontend.git
synced 2024-11-22 11:50:14 +00:00
delete existing before of reindexing subtitles
This commit is contained in:
parent
13cbada539
commit
ce4fa8ee61
@ -204,7 +204,9 @@ class Reindex:
|
||||
video.build_json()
|
||||
if not video.json_data:
|
||||
video.deactivate()
|
||||
return
|
||||
|
||||
video.delete_subtitles()
|
||||
# add back
|
||||
video.json_data["player"] = player
|
||||
video.json_data["date_downloaded"] = date_downloaded
|
||||
@ -218,6 +220,7 @@ class Reindex:
|
||||
thumb_handler.delete_vid_thumb(youtube_id)
|
||||
to_download = (youtube_id, video.json_data["vid_thumb_url"])
|
||||
thumb_handler.download_vid([to_download], notify=False)
|
||||
return
|
||||
|
||||
@staticmethod
|
||||
def reindex_single_channel(channel_id):
|
||||
|
@ -422,7 +422,7 @@ class YoutubeVideo(YouTubeItem, YoutubeSubtitle):
|
||||
os.remove(file_path)
|
||||
|
||||
self.del_in_es()
|
||||
self._delete_subtitles()
|
||||
self.delete_subtitles()
|
||||
|
||||
def _get_ryd_stats(self):
|
||||
"""get optional stats from returnyoutubedislikeapi.com"""
|
||||
@ -452,7 +452,7 @@ class YoutubeVideo(YouTubeItem, YoutubeSubtitle):
|
||||
self.json_data["subtitles"] = subtitles
|
||||
handler.download_subtitles(relevant_subtitles=subtitles)
|
||||
|
||||
def _delete_subtitles(self):
|
||||
def delete_subtitles(self):
|
||||
"""delete indexed subtitles"""
|
||||
data = {"query": {"term": {"youtube_id": {"value": self.youtube_id}}}}
|
||||
_, _ = ElasticWrap("ta_subtitle/_delete_by_query").post(data=data)
|
||||
|
Loading…
Reference in New Issue
Block a user