From 843606db658609483824f2a88dd077b2d2d68b29 Mon Sep 17 00:00:00 2001 From: Omar Roth Date: Sat, 15 Dec 2018 12:02:57 -0600 Subject: [PATCH] Support changing author names --- src/invidious/channels.cr | 2 +- src/invidious/jobs.cr | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/invidious/channels.cr b/src/invidious/channels.cr index f713d97b..d5003509 100644 --- a/src/invidious/channels.cr +++ b/src/invidious/channels.cr @@ -31,7 +31,7 @@ def get_channel(id, client, db, refresh = true, pull_all_videos = true) args = arg_array(channel_array) db.exec("INSERT INTO channels VALUES (#{args}) \ - ON CONFLICT (id) DO UPDATE SET updated = $3", channel_array) + ON CONFLICT (id) DO UPDATE SET author = $2, updated = $3", channel_array) end else channel = fetch_channel(id, client, db, pull_all_videos) diff --git a/src/invidious/jobs.cr b/src/invidious/jobs.cr index afd0ad31..8a90a031 100644 --- a/src/invidious/jobs.cr +++ b/src/invidious/jobs.cr @@ -71,7 +71,7 @@ def refresh_channels(db, max_threads = 1, full_refresh = false) client = make_client(YT_URL) channel = fetch_channel(id, client, db, full_refresh) - db.exec("UPDATE channels SET updated = $1 WHERE id = $2", Time.now, id) + db.exec("UPDATE channels SET updated = $1, author = $2 WHERE id = $3", Time.now, channel.author, id) rescue ex STDOUT << id << " : " << ex.message << "\n" end