Don't deliver new notifications for YouTube Red videos

This commit is contained in:
Omar Roth 2018-09-28 09:23:28 -05:00
parent c2f7d3d41c
commit 477c84deb1

View file

@ -104,6 +104,9 @@ def fetch_channel(ucid, client, db, pull_all_videos = true)
videos.each do |video|
ids << video.id
# FIXME: Red videos don't provide published date, so the best we can do is ignore them
if Time.now - video.published > 1.minute
db.exec("UPDATE users SET notifications = notifications || $1 \
WHERE updated < $2 AND $3 = ANY(subscriptions) AND $1 <> ALL(notifications)", video.id, video.published, video.ucid)
@ -112,6 +115,7 @@ def fetch_channel(ucid, client, db, pull_all_videos = true)
db.exec("INSERT INTO channel_videos VALUES (#{args}) ON CONFLICT (id) DO UPDATE SET title = $2, \
published = $3, updated = $4, ucid = $5, author = $6", video_array)
end
end
if count < 30
break