diff --git a/tubearchivist/home/apps.py b/tubearchivist/home/apps.py index 14b1d7c..073afcc 100644 --- a/tubearchivist/home/apps.py +++ b/tubearchivist/home/apps.py @@ -134,7 +134,7 @@ class StartupCheck: "query": { "bool": {"must_not": [{"exists": {"field": "vid_type"}}]} }, - "script": {"source": "ctx._source['vid_type'] = 'video'"}, + "script": {"source": "ctx._source['vid_type'] = 'videos'"}, } for index_name in index_list: diff --git a/tubearchivist/home/src/download/queue.py b/tubearchivist/home/src/download/queue.py index 5233ffd..b571053 100644 --- a/tubearchivist/home/src/download/queue.py +++ b/tubearchivist/home/src/download/queue.py @@ -163,7 +163,7 @@ class PendingList(PendingIndex): def _process_entry(self, entry): """process single entry from url list""" if entry["type"] == "video": - vid_type = entry.get("vid_type", VideoTypeEnum.VIDEO) + vid_type = entry.get("vid_type", VideoTypeEnum.VIDEOS) self._add_video(entry["url"], vid_type) elif entry["type"] == "channel": self._parse_channel(entry["url"]) @@ -173,7 +173,7 @@ class PendingList(PendingIndex): else: raise ValueError(f"invalid url_type: {entry}") - def _add_video(self, url, vid_type=VideoTypeEnum.VIDEO): + def _add_video(self, url, vid_type=VideoTypeEnum.VIDEOS): """add video to list""" if url not in self.missing_videos and url not in self.to_skip: self.missing_videos.append((url, vid_type)) @@ -197,7 +197,7 @@ class PendingList(PendingIndex): for video_id in youtube_ids: # FIXME: This will need to be adjusted to support Live/Shorts # from playlists - self._add_video(video_id, VideoTypeEnum.VIDEO) + self._add_video(video_id, VideoTypeEnum.VIDEOS) def add_to_pending(self, status="pending"): """add missing videos to pending list""" @@ -244,7 +244,7 @@ class PendingList(PendingIndex): if idx + 1 % 25 == 0: print("adding to queue progress: " + progress) - def get_youtube_details(self, youtube_id, vid_type=VideoTypeEnum.VIDEO): + def get_youtube_details(self, youtube_id, vid_type=VideoTypeEnum.VIDEOS): """get details from youtubedl for single pending video""" vid = YtWrap(self.yt_obs, self.config).extract(youtube_id) if not vid: @@ -260,7 +260,7 @@ class PendingList(PendingIndex): return self._parse_youtube_details(vid, vid_type) - def _parse_youtube_details(self, vid, vid_type=VideoTypeEnum.VIDEO): + def _parse_youtube_details(self, vid, vid_type=VideoTypeEnum.VIDEOS): """parse response""" vid_id = vid.get("id") duration_str = DurationConverter.get_str(vid["duration"]) diff --git a/tubearchivist/home/src/download/subscriptions.py b/tubearchivist/home/src/download/subscriptions.py index df77bde..afc1490 100644 --- a/tubearchivist/home/src/download/subscriptions.py +++ b/tubearchivist/home/src/download/subscriptions.py @@ -41,18 +41,18 @@ class ChannelSubscription: queries = [ ( - VideoTypeEnum.VIDEO, - "videos", + VideoTypeEnum.VIDEOS, + VideoTypeEnum.VIDEOS.value, self.config["subscriptions"]["channel_size"], ), ( - VideoTypeEnum.LIVE, - "streams", + VideoTypeEnum.STREAMS, + VideoTypeEnum.STREAMS.value, self.config["subscriptions"]["live_channel_size"], ), ( - VideoTypeEnum.SHORT, - "shorts", + VideoTypeEnum.SHORTS, + VideoTypeEnum.SHORTS.value, self.config["subscriptions"]["shorts_channel_size"], ), ] diff --git a/tubearchivist/home/src/download/yt_dlp_handler.py b/tubearchivist/home/src/download/yt_dlp_handler.py index 7c8af77..3485548 100644 --- a/tubearchivist/home/src/download/yt_dlp_handler.py +++ b/tubearchivist/home/src/download/yt_dlp_handler.py @@ -189,7 +189,7 @@ class VideoDownloader: youtube_id = youtube_data.get("youtube_id") tmp_vid_type = youtube_data.get( - "vid_type", VideoTypeEnum.VIDEO.value + "vid_type", VideoTypeEnum.VIDEOS.value ) video_type = VideoTypeEnum(tmp_vid_type) print(f"Downloading type: {video_type}") @@ -269,7 +269,7 @@ class VideoDownloader: "youtube_id": i["youtube_id"], # Using .value in default val to match what would be # decoded when parsing json if not set - "vid_type": i.get("vid_type", VideoTypeEnum.VIDEO.value), + "vid_type": i.get("vid_type", VideoTypeEnum.VIDEOS.value), } ) for i in pending.all_pending diff --git a/tubearchivist/home/src/index/video.py b/tubearchivist/home/src/index/video.py index 92cbfdc..406ad66 100644 --- a/tubearchivist/home/src/index/video.py +++ b/tubearchivist/home/src/index/video.py @@ -128,7 +128,7 @@ class YoutubeVideo(YouTubeItem, YoutubeSubtitle): self, youtube_id, video_overwrites=False, - video_type=VideoTypeEnum.VIDEO, + video_type=VideoTypeEnum.VIDEOS, ): super().__init__(youtube_id) self.channel_id = False @@ -406,7 +406,7 @@ class YoutubeVideo(YouTubeItem, YoutubeSubtitle): def index_new_video( - youtube_id, video_overwrites=False, video_type=VideoTypeEnum.VIDEO + youtube_id, video_overwrites=False, video_type=VideoTypeEnum.VIDEOS ): """combined classes to create new video in index""" video = YoutubeVideo( diff --git a/tubearchivist/home/src/index/video_constants.py b/tubearchivist/home/src/index/video_constants.py index 1b8dcd4..9ccd046 100644 --- a/tubearchivist/home/src/index/video_constants.py +++ b/tubearchivist/home/src/index/video_constants.py @@ -6,7 +6,7 @@ import enum class VideoTypeEnum(enum.Enum): """all vid_type fields""" - VIDEO = "video" - LIVE = "live" - SHORT = "short" + VIDEOS = "videos" + STREAMS = "streams" + SHORTS = "shorts" UNKNOWN = "unknown" diff --git a/tubearchivist/home/tasks.py b/tubearchivist/home/tasks.py index ec08e39..dd940e0 100644 --- a/tubearchivist/home/tasks.py +++ b/tubearchivist/home/tasks.py @@ -68,7 +68,7 @@ def update_subscribed(): playlist_videos = [ { "type": "video", - "vid_type": VideoTypeEnum.VIDEO, + "vid_type": VideoTypeEnum.VIDEOS, "url": i, } for i in missing_from_playlists diff --git a/tubearchivist/home/urls.py b/tubearchivist/home/urls.py index 6cb0c5a..8dc8c9d 100644 --- a/tubearchivist/home/urls.py +++ b/tubearchivist/home/urls.py @@ -47,7 +47,7 @@ urlpatterns = [ name="channel_id", ), path( - "channel//live/", + "channel//streams/", login_required(ChannelIdLiveView.as_view()), name="channel_id_live", ), diff --git a/tubearchivist/home/views.py b/tubearchivist/home/views.py index e5636c5..20647aa 100644 --- a/tubearchivist/home/views.py +++ b/tubearchivist/home/views.py @@ -514,7 +514,7 @@ class ChannelIdView(ChannelIdBaseView): view_origin = "home" es_search = "ta_video/_search" - video_types = [VideoTypeEnum.VIDEO] + video_types = [VideoTypeEnum.VIDEOS] def get(self, request, channel_id): """get request""" @@ -584,11 +584,11 @@ class ChannelIdView(ChannelIdBaseView): class ChannelIdLiveView(ChannelIdView): - """resolves to /channel//live/ + """resolves to /channel//streams/ display single channel page from channel_id """ - video_types = [VideoTypeEnum.LIVE] + video_types = [VideoTypeEnum.STREAMS] class ChannelIdShortsView(ChannelIdView): @@ -596,7 +596,7 @@ class ChannelIdShortsView(ChannelIdView): display single channel page from channel_id """ - video_types = [VideoTypeEnum.SHORT] + video_types = [VideoTypeEnum.SHORTS] class ChannelIdAboutView(ChannelIdBaseView):