Add option to pull all videos

このコミットが含まれているのは:
Omar Roth 2018-08-08 20:12:17 -05:00
コミット 6d8caaee65
4個のファイルの変更9行の追加7行の削除

ファイルの表示

@ -6,4 +6,5 @@ db:
password: kemal
host: localhost
port: 5432
dbname: invidious
dbname: invidious
full_refresh: false

ファイルの表示

@ -83,7 +83,7 @@ crawl_threads.times do
end
end
refresh_channels(PG_DB, channel_threads)
refresh_channels(PG_DB, channel_threads, CONFIG.full_refresh)
video_threads.times do |i|
spawn do

ファイルの表示

@ -10,9 +10,10 @@ class Config
port: Int32,
dbname: String,
),
dl_api_key: String?,
https_only: Bool?,
hmac_key: String?,
dl_api_key: String?,
https_only: Bool?,
hmac_key: String?,
full_refresh: Bool,
})
end

ファイルの表示

@ -44,7 +44,7 @@ def crawl_videos(db)
end
end
def refresh_channels(db, max_threads = 1)
def refresh_channels(db, max_threads = 1, full_refresh = false)
max_channel = Channel(Int32).new
spawn do
@ -67,7 +67,7 @@ def refresh_channels(db, max_threads = 1)
spawn do
begin
client = make_client(YT_URL)
channel = fetch_channel(id, client, db, false)
channel = fetch_channel(id, client, db, full_refresh)
db.exec("UPDATE channels SET updated = $1 WHERE id = $2", Time.now, id)
rescue ex