TVDB: better handling of first run
[nonametv.git] / lib / DVB.pm
blob187d26eda67d8fdaea6e285fd2f6a805f8f2745b
1 package DVB;
4 =pod
6 This file contains some DVB related functions.
7 Draft: "ETSI EN 300 468"
9 =cut
11 use strict;
12 use warnings;
14 use utf8;
15 use Env;
17 use NonameTV::Log qw/progress/;
19 BEGIN {
20 use Exporter ();
21 our ($VERSION, @ISA, @EXPORT, @EXPORT_OK, %EXPORT_TAGS);
23 # set the version for version checking
24 $VERSION = 0.1;
26 @ISA = qw(Exporter);
27 @EXPORT = qw( );
28 %EXPORT_TAGS = ( ); # eg: TAG => [ qw!name1 name2! ],
29 @EXPORT_OK = qw/DVBCategory/;
31 our @EXPORT_OK;
33 sub DVBCategory
35 my( $ds, $categ, $type ) = @_;
37 my $defaultcategory = "0:0:0:0";
38 return $defaultcategory if ( $categ !~ /\S+/i );
40 my $q = "SELECT * from dvb_cat WHERE `category` LIKE '%" . $categ . "%' LIMIT 1";
41 my( $res, $data ) = $ds->sa->Sql( $q );
43 return $defaultcategory if( ! $res );
45 while( my $category = $data->fetchrow_hashref() ) {
46 return $category->{dvb_category};
49 return $defaultcategory;
54 ### Setup coding system
55 ## Local Variables:
56 ## coding: utf-8
57 ## End: