brmd: Switch streaming on brmvid when record switch is pressed

This commit is contained in:
Petr Baudis 2011-05-03 20:21:35 +02:00
parent d66a389c77
commit 593f34fe9b

View file

@ -94,6 +94,14 @@ sub record_str {
$record ? 'ON AIR' : 'OFF AIR'; $record ? 'ON AIR' : 'OFF AIR';
} }
sub stream_switch {
my ($s) = @_;
system('ssh brmstream@brmvid "echo '.($s?'START':'STOP').' >/tmp/brmstream"');
}
sub record_start { stream_switch(1); }
sub record_stop { stream_switch(0); }
sub topic_update { sub topic_update {
my $newtopic = $topic; my $newtopic = $topic;
if ($status) { if ($status) {
@ -118,6 +126,12 @@ sub status_update {
sub record_update { sub record_update {
my ($newrecord) = @_; my ($newrecord) = @_;
$record = $newrecord; $record = $newrecord;
if ($record) {
record_start();
} else {
record_stop();
}
my $st = record_str(); my $st = record_str();
$record and $st .= "\002 http://nat.brmlab.cz:8090/brmstream.asf"; $record and $st .= "\002 http://nat.brmlab.cz:8090/brmstream.asf";
$irc->yield (privmsg => $channel => "[brmvideo] update: \002$st" ); $irc->yield (privmsg => $channel => "[brmvideo] update: \002$st" );