| 1 |
root |
1.1 |
#!/opt/bin/perl |
| 2 |
|
|
|
| 3 |
root |
1.2 |
use Fcntl (); |
| 4 |
|
|
use Event; |
| 5 |
|
|
use PApp::SQL; |
| 6 |
|
|
|
| 7 |
root |
1.1 |
use StableTV; |
| 8 |
root |
1.2 |
|
| 9 |
|
|
use StableTV::Source::V4L2; |
| 10 |
|
|
use StableTV::Source::IVTV; |
| 11 |
|
|
use StableTV::Source::DVB; |
| 12 |
|
|
|
| 13 |
|
|
our $CFG; |
| 14 |
|
|
|
| 15 |
|
|
use YAML; |
| 16 |
|
|
|
| 17 |
|
|
$StableTV::CFG = YAML::LoadFile "/etc/stabletv.cfg"; |
| 18 |
|
|
|
| 19 |
|
|
$StableTV::CFG->{ivtvctl} ||= "ivtvctl"; |
| 20 |
|
|
|
| 21 |
|
|
$DATABASE = "DBI:mysql:mythconverg;mysql_read_default_file=/root/.my.cnf"; |
| 22 |
|
|
|
| 23 |
|
|
$PApp::SQL::DBH = PApp::SQL::connect_cached undef, $DATABASE |
| 24 |
|
|
or die "$DATABASE: $DBI::ERRSTR\n"; |
| 25 |
|
|
|
| 26 |
|
|
for (values %{ $StableTV::CFG->{source} }) { |
| 27 |
|
|
my $class = "StableTV::Source::$_->{type}"; |
| 28 |
|
|
|
| 29 |
|
|
eval "require $class" or die "$class: $@"; |
| 30 |
|
|
push @sources, $class->new (%$_); |
| 31 |
|
|
} |
| 32 |
|
|
|
| 33 |
|
|
for (@sources) { |
| 34 |
|
|
$_->start ("scan"); |
| 35 |
|
|
} |
| 36 |
|
|
|
| 37 |
|
|
Event::loop; |
| 38 |
|
|
|