App-EventStreamr
view release on metacpan or search on metacpan
bin/station-mgr.pl view on Meta::CPAN
);
$command =~ s/\$(\w+)/$cmd_vars{$1}/g;
return $command;
}
sub stream_command {
my ($id,$type) = @_;
my $command = $self->{commands}{stream};
my %cmd_vars = (
host => $self->{config}{mixer}{host},
port => $self->{config}{mixer}{port},
id => $id,
shost => $self->{config}{stream}{host},
sport => $self->{config}{stream}{port},
spassword => $self->{config}{stream}{password},
stream => $self->{config}{stream}{stream},
);
$command =~ s/\$(\w+)/$cmd_vars{$1}/g;
return $command;
}
sub set_path {
my ($path) = @_;
my %path_vars = (
room => $self->{config}{room},
date => $self->{date},
);
$path =~ s/\$(\w+)/$path_vars{$1}/g;
return $path;
}
# Get Mac Address
sub getmac {
# This is better, but can break if no eth0. We are only using it as a UID - think of something better.
my $macaddress = `ifdata -ph eth0`;
chomp $macaddress;
return $macaddress;
}
sub blank_station {
my $mixer_ipaddr = `ifdata -pa eth0`;
chomp $mixer_ipaddr;
$mixer_ipaddr =~ s/.$/1/;
my $hostname = `hostname`;
chomp $hostname;
my $room = $hostname;
$room =~ s/-\d+$//;
my $json = <<CONFIG;
{
"roles" :
[
],
"nickname" : "$hostname",
"room" : "$room",
"record_path" : "/localbackup/\$room/\$date",
"mixer" :
{
"port":"1234",
"host":"$mixer_ipaddr",
"loop":"/home/av/eventstreamr/baseimage/video/standby.dv"
},
"sync" :
{
"host":"storage.local",
"path":"/storage"
},
"devices" : "all",
"device_control" :
{
},
"run" : "0",
"stream" :
{
"host" : "",
"port" : "",
"password" : "",
"stream" : ""
}
}
CONFIG
my $config = from_json($json);
return $config;
}
sub blank_settings {
my $json = <<CONFIG;
{
"controller" : "http://10.4.4.10:5001"
}
CONFIG
my $config = from_json($json);
return $config;
}
=pod
=encoding UTF-8
=head1 NAME
station-mgr - station-mgr - Core Station Manager script
=head1 VERSION
version 0.5
=head1 SYNOPSIS
Usage:
station-mgr.pl
=head1 AUTHOR
( run in 1.066 second using v1.01-cache-2.11-cpan-2398b32b56e )