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