Skip to content

Commit 70f70ba

Browse files
committed
Allow embedding
1 parent e54e81d commit 70f70ba

File tree

2 files changed

+25
-1
lines changed

2 files changed

+25
-1
lines changed

bk-downloader/airtable.jl

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,9 @@ module Airtable
4545
function update!(baseId, sheetId, records)
4646
for part in Iterators.partition(records, 10)
4747
resp = patch(baseId, sheetId, Dict(:records=>part))
48-
@show resp
48+
if resp.status != 200
49+
@warn "Update failed" baseId sheetId part
50+
end
4951
end
5052
end
5153
end

youtube/update_youtube.jl

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@ include("Youtube.jl")
44
client = load_or_obtain()
55
refresh!(client)
66

7+
const EPOCH = 2
8+
79
const baseId = "appAeQFpa0ywisJKd"
810
const sheet1Id = "tblube5UaXuYqPzDq"
911

@@ -38,7 +40,14 @@ end
3840
function update_metadata(client, table)
3941
for record in table
4042
fields = record[:fields]
43+
epoch = fields[Symbol("Epoch")]
4144
pretalx_id = fields[Symbol("Pretalx ID")]
45+
if epoch >= EPOCH
46+
@info "Skipping..." pretalx_id epoch
47+
end
48+
if !haskey(fields, Symbol("Youtube ID"))
49+
continue
50+
end
4251
yt_id = Base.get(fields, Symbol("Youtube ID"), nothing)
4352

4453
if yt_id === nothing
@@ -66,11 +75,24 @@ function update_metadata(client, table)
6675
:description => yt_desc,
6776
:categoryId => "28",
6877
),
78+
:status => Dict(
79+
:privacyStatus => "unlisted",
80+
:selfDeclaredMadeForKids => false,
81+
:embeddable => true
82+
),
6983
)
7084

7185
resp = video_update!(client, yt_id, parts)
7286
if resp.status != 200
7387
@warn "Update failed" pretalx_id resp
88+
else
89+
new_record = Dict(
90+
:id => record[:id],
91+
:fields => Dict(
92+
"Epoch" => EPOCH,
93+
)
94+
)
95+
Airtable.update!(baseId, sheet1Id, [new_record])
7496
end
7597
end
7698
end

0 commit comments

Comments
 (0)