Compare commits

...

2 Commits

Author SHA1 Message Date
gg 723a5b1b68 Add script for updating the schedule database 2023-07-19 10:41:50 -07:00
gg 5a4b79868e Make DB.insert_schedule less noisy 2023-07-19 10:41:29 -07:00
2 changed files with 21 additions and 2 deletions

19
bin/wndb-update.jl Normal file
View File

@ -0,0 +1,19 @@
#!/usr/bin/env -S julia --color=yes --startup-file=no
using WeatherNews
using SQLite
function get_db()
return SQLite.DB("sql/wn.db")
end
function main()
db = get_db()
s = WeatherNews.get_schedule()
for row in s
DB.insert_schedule(db, row)
end
end
if abspath(PROGRAM_FILE) == @__FILE__
main()
end

View File

@ -32,11 +32,11 @@ function insert_schedule(db, row)
try
sql_insert = "INSERT INTO schedule (caster_id, segment_id, jst) VALUES (?, ?, ?)"
timestamp = Dates.format(row[:t], "Y-mm-ddTHH:MM:SSz")
@info "before insert" caster_id, segment.id[1] timestamp
#@info "before insert" caster_id, segment.id[1] timestamp
ri = DBInterface.execute(db, sql_insert, [caster_id, segment.id[1], timestamp])
return ri
catch e
@error e
@debug e
return false
end
end