invidious/config/sql/channel_videos.sql
Harm 93724f8051 Update logic to process shorts/livestreams
[config/config.example.yml]
- Separate hide_shorts_and_live to hide_shorts and hide_livestreams

[config/sql/channel_videos.sql]
- Introduce enum video_type
- Include video_type as new column for channel_videos

[locales/en-US.json]
- Add labels for new settings

[src/invidious/channels/channels.cr]
- Add property video_type of type VideoType to ChannelVideo struct
- Add deserializer module for conversion from database entry to enum
- Add check if we already have a video in the database.
  If the video `updated` field has no been updated, only update views
- Add check whether a video is in the `videos` array. If this is not
  the case, fetch the individual video for `video_type` as well as
  `length_videos`

[src/invidious/config.cr]
- Separate hide_shorts_and_live property
  to hide_shorts and hide_livestreams properties

[src/invidious/database/channels.cr]
- Include video_type in database insert for ChannelVideo

[src/invidious/routes/preferences.cr]
- Separate hide_shorts_and_live setting to hide_shorts and hide_livestreams

[src/invidious/users.cr]
- Accumulate VideoTypes in an array and query on these types
- Remove paths for hide_shorts_and_live

[src/invidious/videos.cr]
- Add `Short` entry to VideoType enum

[src/invidious/videos/parser.cr]
- Add check whether a video is a short
2026-01-24 16:08:16 +01:00

40 lines
827 B
SQL

-- Table: public.channel_videos
-- DROP TABLE public.channel_videos;
CREATE TYPE public.video_type AS ENUM
(
'Video',
'Short',
'Livestream',
'Scheduled'
);
CREATE TABLE IF NOT EXISTS public.channel_videos
(
id text NOT NULL,
title text,
published timestamp with time zone,
updated timestamp with time zone,
ucid text,
author text,
length_seconds integer,
live_now boolean,
premiere_timestamp timestamp with time zone,
views bigint,
video_type video_type,
CONSTRAINT channel_videos_id_key UNIQUE (id)
);
GRANT ALL ON TABLE public.channel_videos TO current_user;
-- Index: public.channel_videos_ucid_idx
-- DROP INDEX public.channel_videos_ucid_idx;
CREATE INDEX IF NOT EXISTS channel_videos_ucid_idx
ON public.channel_videos
USING btree
(ucid COLLATE pg_catalog."default");