mirror of
https://github.com/tubearchivist/tubearchivist
synced 2024-11-16 00:12:49 +00:00
fix channel reindex flow
This commit is contained in:
parent
c327e94726
commit
5d0d050149
@ -47,13 +47,13 @@ class YoutubeChannel(YouTubeItem):
|
|||||||
if not self.youtube_meta and fallback:
|
if not self.youtube_meta and fallback:
|
||||||
self._video_fallback(fallback)
|
self._video_fallback(fallback)
|
||||||
else:
|
else:
|
||||||
self._process_youtube_meta()
|
self.process_youtube_meta()
|
||||||
self.get_channel_art()
|
self.get_channel_art()
|
||||||
|
|
||||||
if upload:
|
if upload:
|
||||||
self.upload_to_es()
|
self.upload_to_es()
|
||||||
|
|
||||||
def _process_youtube_meta(self):
|
def process_youtube_meta(self):
|
||||||
"""extract relevant fields"""
|
"""extract relevant fields"""
|
||||||
self.youtube_meta["thumbnails"].reverse()
|
self.youtube_meta["thumbnails"].reverse()
|
||||||
channel_subs = self.youtube_meta.get("channel_follower_count") or 0
|
channel_subs = self.youtube_meta.get("channel_follower_count") or 0
|
||||||
|
@ -331,23 +331,29 @@ class Reindex(ReindexBase):
|
|||||||
@staticmethod
|
@staticmethod
|
||||||
def _reindex_single_channel(channel_id):
|
def _reindex_single_channel(channel_id):
|
||||||
"""refresh channel data and sync to videos"""
|
"""refresh channel data and sync to videos"""
|
||||||
|
# read current state
|
||||||
channel = YoutubeChannel(channel_id)
|
channel = YoutubeChannel(channel_id)
|
||||||
channel.get_from_es()
|
channel.get_from_es()
|
||||||
subscribed = channel.json_data["channel_subscribed"]
|
es_meta = channel.json_data.copy()
|
||||||
overwrites = channel.json_data.get("channel_overwrites", False)
|
|
||||||
|
# get new
|
||||||
channel.get_from_youtube()
|
channel.get_from_youtube()
|
||||||
if not channel.json_data:
|
if not channel.youtube_meta:
|
||||||
channel.deactivate()
|
channel.deactivate()
|
||||||
channel.get_from_es()
|
channel.get_from_es()
|
||||||
channel.sync_to_videos()
|
channel.sync_to_videos()
|
||||||
return
|
return
|
||||||
|
|
||||||
channel.json_data["channel_subscribed"] = subscribed
|
channel.process_youtube_meta()
|
||||||
|
channel.get_channel_art()
|
||||||
|
|
||||||
|
# add back
|
||||||
|
channel.json_data["channel_subscribed"] = es_meta["channel_subscribed"]
|
||||||
|
overwrites = es_meta.get("channel_overwrites")
|
||||||
if overwrites:
|
if overwrites:
|
||||||
channel.json_data["channel_overwrites"] = overwrites
|
channel.json_data["channel_overwrites"] = overwrites
|
||||||
channel.upload_to_es()
|
|
||||||
channel.sync_to_videos()
|
|
||||||
|
|
||||||
|
channel.upload_to_es()
|
||||||
ChannelFullScan(channel_id).scan()
|
ChannelFullScan(channel_id).scan()
|
||||||
|
|
||||||
def _reindex_single_playlist(self, playlist_id):
|
def _reindex_single_playlist(self, playlist_id):
|
||||||
|
Loading…
Reference in New Issue
Block a user