3 # Update the channels-table with information about which channels
9 use lib
"$FindBin::Bin/../lib";
12 use NonameTV
::DataStore
;
13 use NonameTV
::Config qw
/ReadConfig/;
14 use NonameTV
::Factory qw
/CreateDataStore/;
25 my $res = GetOptions
( $opt, qw
/verbose quiet unattended/ );
28 my $conf = ReadConfig
();
31 my $ds = CreateDataStore
();
33 my $iconroot = $conf->{Exporters
}->{Xmltv
}->{IconRootUrl
};
35 my $sth = $ds->sa->Iterate( 'channels' );
37 while( my $entry = $sth->fetchrow_hashref() ) {
38 my $xmltvid = $entry->{xmltvid
};
39 my $logo = $entry->{logo
};
41 print "Processing $xmltvid\n" if $opt->{verbose
};
43 my $url = "$iconroot$xmltvid.png";
46 $ds->sa->Update( 'channels', { xmltvid
=> $xmltvid }, { logo
=> 1 } );
47 print "Added icon for $xmltvid\n" if not $opt->{quiet
};
53 if( $opt->{unattended
} ) {
54 print "Icon for $xmltvid has disappeared.\n";
57 $ds->sa->Update( 'channels', { xmltvid
=> $xmltvid }, { logo
=> 0 } );
58 print "Removed icon for $xmltvid\n" if not $opt->{quiet
};