From d80a398a003e02a697122356c6eb0fae8c008e47 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andrej=20Rama=C5=A1euski?= <andrej@x2.cz> Date: Thu, 3 Dec 2020 19:51:16 +0100 Subject: [PATCH] Zmena aktualizace is_live u streamu --- lib/PiTube/Controller/Nginx.pm | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/lib/PiTube/Controller/Nginx.pm b/lib/PiTube/Controller/Nginx.pm index 8123704..f84573d 100644 --- a/lib/PiTube/Controller/Nginx.pm +++ b/lib/PiTube/Controller/Nginx.pm @@ -1,10 +1,13 @@ package PiTube::Controller::Nginx; use Mojo::Base 'Mojolicious::Controller'; +use Mojo::Pg::PubSub; use constant HLS => qr/hls\/([a-z0-9\-]+)(_\w+)?(\/\w+)?\.(m3u8|ts)$/i; sub callback_rtmp { my $c = shift; + my $pubsub = Mojo::Pg::PubSub->new(pg => $c->pg); + $pubsub = $pubsub->json('messages'); if ( $c->param('call') =~ /publish/ ) { my $name = $c->param('name'); @@ -32,6 +35,11 @@ sub callback_rtmp { publish_last => '\now()', publish_user_id => $user->id, publish_time => ( $c->param('time') // 0 ), + is_live => ( $c->param('call') =~ /done/ ) ? 'f':'t', + }); + + $pubsub->notify( messages => { + call => $c->param('call'), }); } -- GitLab