7 use lib
"$FindBin::Bin/../lib";
12 #use NonameTV::Augmenter::Tvdb;
13 use NonameTV
::Factory qw
/CreateAugmenter CreateDataStore CreateDataStoreDummy /;
15 my $ds = CreateDataStore
( );
17 my $dt = DateTime
->now( time_zone
=> 'UTC' );
18 $dt->add( days
=> 7 );
20 my $batchid = 'neo.zdf.de_' . $dt->week_year() . '-' . $dt->week();
21 printf( "augmenting %s...\n", $batchid );
23 my $augmenter = CreateAugmenter
( 'Tvdb', $ds );
25 # program metadata from augmenter
27 # result code from augmenter
30 # stripped down rule for testing
31 my %simplerule = ( matchby
=> 'episodetitle' );
33 my ( $res, $sth ) = $ds->sa->Sql( "
34 SELECT p.* from programs p, batches b
35 WHERE (p.batch_id = b.id)
37 ORDER BY start_time asc, end_time desc",
38 # name of batch to use for testing
43 my $ce = $sth->fetchrow_hashref();
44 while( defined( $ce ) ) {
45 if( ( $ce->{program_type
} eq 'series' )and( defined( $ce->{subtitle
} ) ) ) {
46 $ce->{subtitle
} =~ s
|,\sTeil
(\d
+)$| ($1)|;
47 $ce->{subtitle
} =~ s
|\s
-\sTeil
(\d
+)$| ($1)|;
48 $ce->{subtitle
} =~ s
|\s\
(Teil
(\d
+)\
)$| ($1)|;
49 ( $newprogram, $result ) = $augmenter->AugmentProgram( $ce, \
%simplerule );
50 if( defined( $newprogram) ) {
57 $ce = $sth->fetchrow_hashref();
60 printf( "found %d/%d episodes at tvdb by name\n", $found, $found+$notfound );