summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorOmar Roth <omarroth@hotmail.com>2018-07-26 14:49:06 -0500
committerOmar Roth <omarroth@hotmail.com>2018-07-26 14:49:06 -0500
commit09a93644278b10916451e879dcc24f02785c790f (patch)
tree3dc83abd303af69ed25e2366d6f0410cd95115e4
parent0f46c18f99a3dd8de7bc12ae8bf15e2308bf6af5 (diff)
downloadinvidious-09a93644278b10916451e879dcc24f02785c790f.tar.gz
invidious-09a93644278b10916451e879dcc24f02785c790f.tar.bz2
invidious-09a93644278b10916451e879dcc24f02785c790f.zip
Update videos SQL
-rw-r--r--config/sql/videos.sql3
-rw-r--r--src/invidious/helpers.cr5
2 files changed, 6 insertions, 2 deletions
diff --git a/config/sql/videos.sql b/config/sql/videos.sql
index 63a42e66..9f20e8c6 100644
--- a/config/sql/videos.sql
+++ b/config/sql/videos.sql
@@ -17,6 +17,9 @@ CREATE TABLE public.videos
language text COLLATE pg_catalog."default",
author 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)
)
WITH (
diff --git a/src/invidious/helpers.cr b/src/invidious/helpers.cr
index e8ed7126..d6dba902 100644
--- a/src/invidious/helpers.cr
+++ b/src/invidious/helpers.cr
@@ -309,7 +309,8 @@ def get_video(id, client, db, refresh = true)
video_array = video.to_a
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)
rescue ex
db.exec("DELETE FROM videos * WHERE id = $1", id)
@@ -317,7 +318,7 @@ def get_video(id, client, db, refresh = true)
end
else
video = fetch_video(id, client)
- video_array = video.to_a[0, 13]
+ video_array = video.to_a
args = arg_array(video_array)
db.exec("INSERT INTO videos VALUES (#{args}) ON CONFLICT (id) DO NOTHING", video_array)