mirror of
https://gitea.invidious.io/iv-org/invidious-copy-2022-04-11.git
synced 2024-08-15 00:43:26 +00:00
Update videos SQL
This commit is contained in:
parent
0f46c18f99
commit
09a9364427
2 changed files with 6 additions and 2 deletions
|
@ -17,6 +17,9 @@ CREATE TABLE public.videos
|
||||||
language text COLLATE pg_catalog."default",
|
language text COLLATE pg_catalog."default",
|
||||||
author text COLLATE pg_catalog."default",
|
author text COLLATE pg_catalog."default",
|
||||||
ucid text COLLATE pg_catalog."default",
|
ucid text COLLATE pg_catalog."default",
|
||||||
|
allowed_regions text[] COLLATE pg_catalog."default",
|
||||||
|
is_family_friendly boolean,
|
||||||
|
genre text COLLATE pg_catalog."default",
|
||||||
CONSTRAINT videos_pkey PRIMARY KEY (id)
|
CONSTRAINT videos_pkey PRIMARY KEY (id)
|
||||||
)
|
)
|
||||||
WITH (
|
WITH (
|
||||||
|
|
|
@ -309,7 +309,8 @@ def get_video(id, client, db, refresh = true)
|
||||||
video_array = video.to_a
|
video_array = video.to_a
|
||||||
args = arg_array(video_array[1..-1], 2)
|
args = arg_array(video_array[1..-1], 2)
|
||||||
|
|
||||||
db.exec("UPDATE videos SET (info,updated,title,views,likes,dislikes,wilson_score,published,description,language,author,ucid)\
|
db.exec("UPDATE videos SET (info,updated,title,views,likes,dislikes,wilson_score,\
|
||||||
|
published,description,language,author,ucid, allowed_regions, is_family_friendly, genre)\
|
||||||
= (#{args}) WHERE id = $1", video_array)
|
= (#{args}) WHERE id = $1", video_array)
|
||||||
rescue ex
|
rescue ex
|
||||||
db.exec("DELETE FROM videos * WHERE id = $1", id)
|
db.exec("DELETE FROM videos * WHERE id = $1", id)
|
||||||
|
@ -317,7 +318,7 @@ def get_video(id, client, db, refresh = true)
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
video = fetch_video(id, client)
|
video = fetch_video(id, client)
|
||||||
video_array = video.to_a[0, 13]
|
video_array = video.to_a
|
||||||
args = arg_array(video_array)
|
args = arg_array(video_array)
|
||||||
|
|
||||||
db.exec("INSERT INTO videos VALUES (#{args}) ON CONFLICT (id) DO NOTHING", video_array)
|
db.exec("INSERT INTO videos VALUES (#{args}) ON CONFLICT (id) DO NOTHING", video_array)
|
||||||
|
|
Loading…
Reference in a new issue