6 use NonameTV
::DataStore
;
7 use NonameTV
::Config qw
/ReadConfig/;
9 use HTTP
::Cache
::Transparent
;
11 if( scalar( @ARGV ) != 2 )
14 nonametv
-import
-download
<importer
> <batch
-id
>
16 Download the data
for a batch
and put it
in the
"new"-section
in the
17 override directory as batchid
.org
.
19 The override directory is currently hardcoded as
21 var
/local/nonametv
/override
23 To override the input
for a batch
:
25 nonametv
-import
-download TV4 plus
.tv4
.se_2004
-11-10
26 cd
/var/local/nonametv/override
/new
27 cp plus
.tv4
.se_2004
-11-10.org plus
.tv4
.se_2004
-11-10
28 emacs plus
.tv4
.se_2004
-11-10
31 The plus
.tv4
.se_2004
-11-10 will be moved from new
/ to data/
32 by nonametv
-import
. The
.org
-file will never be touched
or processed
.
34 To update an override
, do the same as
for a new override
.
36 To remove an override
, move the file
in data
/ to delete/. This forces
37 the importer to process data from the original site
.
45 my $conf = ReadConfig
();
48 my $ds = NonameTV
::DataStore
->new( $conf->{DataStore
} );
51 HTTP
::Cache
::Transparent
::init
( $conf->{Cache
} );
53 my( $imp_name, $batch_id ) = @ARGV;
55 # Create the right importer
56 my $imp_data = $conf->{Importers
}->{$imp_name};
57 my $imp_type = $imp_data->{Type
};
59 my $imp = eval "use NonameTV::Importer::$imp_type;
60 NonameTV::Importer::${imp_type}->new( \$imp_data );"
63 my( $xmltvid ) = ($batch_id =~ /(.*)_/);
65 my $data = $ds->sa->Lookup( 'channels', { xmltvid
=> $xmltvid } );
67 my $file = "/var/local/nonametv/override/new/$batch_id.org";
69 open OUT
, "> $file" or die "Failed to write to $file";
70 print OUT
$imp->FetchDataFromSite( $batch_id, $data );