1
0
Fork 0

Compare commits

...

4 Commits

Author SHA1 Message Date
pta fe138bf332 Add links for popout youtube chat for mpv/vlc users
Since I watch youtube streams in mpv, I really only need a chat-only
browser window. I've been using a small sed script to generate the link
for me, but now I can just middle click on the chat link to open the
window. Other mpv/vlc users should find this convenient too.
2024-05-24 17:50:53 -04:00
gg1234 83c4be4c00 Insert newly discovered schedule entries while fixing 2024-05-24 13:44:39 -07:00
gg 735790aa72 Merge pull request 'Use faster, functional code to update video data' (#12) from pta/WeatherNews.jl:main into main
Reviewed-on: gg/WeatherNews.jl#12
2024-05-23 12:00:02 +00:00
gg 697cf93df9 Merge pull request 'Various fixes and and a new cron job to ensure consistent video data collection.' (#11) from pta/WeatherNews.jl:main into main
Reviewed-on: gg/WeatherNews.jl#11
2024-05-17 14:54:07 +00:00
4 changed files with 23 additions and 0 deletions

View File

@ -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

View File

@ -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;

View File

@ -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 });

View File

@ -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><: "" -:>
: }