forked from gg/WeatherNews.jl
Compare commits
4 Commits
e07d4ee12d
...
fe138bf332
Author | SHA1 | Date |
---|---|---|
![]() |
fe138bf332 | |
![]() |
83c4be4c00 | |
|
735790aa72 | |
|
697cf93df9 |
|
@ -189,6 +189,9 @@ function fix_conflict(db, schedule)
|
|||
dbs = DB.find_schedule_by_jst(db, string(s[:t]))
|
||||
@debug dbs string(s[:t])
|
||||
if ismissing(dbs)
|
||||
ts = now(tz"Asia/Tokyo")
|
||||
@info "$(ts) :: schedule entry missing; ____ $(s[:caster])"
|
||||
DB.insert_schedule(db, s)
|
||||
continue
|
||||
elseif s[:caster] == "" && !ismissing(dbs[:caster_id])
|
||||
# the new caster may be NULL in rare cases
|
||||
|
|
17
www/Utils.pm
17
www/Utils.pm
|
@ -40,6 +40,11 @@ sub thumb {
|
|||
"https://site.weathernews.jp/app/wnlive/thumb/$x/$id.jpg"
|
||||
}
|
||||
|
||||
sub chat {
|
||||
my $id = shift;
|
||||
"https://www.youtube.com/live_chat?is_popout=1&v=$id";
|
||||
}
|
||||
|
||||
# mobile video page for aupay video_id
|
||||
sub aupay_vid {
|
||||
my $id = shift;
|
||||
|
@ -74,6 +79,7 @@ my $tx = Text::Xslate->new(
|
|||
function => {
|
||||
yt => \&yt,
|
||||
th => \&thumb,
|
||||
chat => \&chat,
|
||||
aupay_vid => \&aupay_vid,
|
||||
aupay_m3u8 => \&aupay_m3u8,
|
||||
aupay_th => \&aupay_th,
|
||||
|
@ -136,4 +142,15 @@ sub mark_live {
|
|||
}
|
||||
}
|
||||
|
||||
sub mark_chat {
|
||||
my $rows = shift;
|
||||
my $i = 0;
|
||||
for (@$rows) {
|
||||
if ($_->{title} ne "au PAY") {
|
||||
$_->{chat} = 1;
|
||||
}
|
||||
last if (is_live($_->{jst}) && $_->{title} ne "au PAY")
|
||||
}
|
||||
}
|
||||
|
||||
1;
|
||||
|
|
|
@ -25,6 +25,7 @@ cgi {
|
|||
my $cgi = $_;
|
||||
my @r = WNDB::schedule_default($sql);
|
||||
mark_live(\@r);
|
||||
mark_chat(\@r);
|
||||
my $method = $cgi->method;
|
||||
if ($method eq 'GET') {
|
||||
my $html = page('schedule', { base => $config{base}, r => \@r });
|
||||
|
|
|
@ -1,6 +1,8 @@
|
|||
: if $i.video_id {
|
||||
: if $i.title == "au PAY" {
|
||||
<a href="<: aupay_vid($i.video_id) :>">vid</a>, <a href="<: aupay_m3u8($i.video_id) :>">m3u8</a>, <a href="<: aupay_th($i.video_id) :>">th</a><: "" -:>
|
||||
: } else if $i.chat {
|
||||
<a href="<: yt($i.video_id) :>">yt</a>, <a href="<: th($i.video_id) :>">th</a>, <a href="<: chat($i.video_id) :>">chat</a><: "" -:>
|
||||
: } else {
|
||||
<a href="<: yt($i.video_id) :>">yt</a>, <a href="<: th($i.video_id) :>">th</a><: "" -:>
|
||||
: }
|
||||
|
|
Loading…
Reference in New Issue