xmltv/grab/it channel_ids, 1.45, 1.46 tv_grab_it.PL, 1.14, 1.15 tv_grab_it.in, 1.102, 1.103

Geoff <[email protected]>
Newsgroups gmane.comp.tv.xmltv.cvs
Message-ID <[email protected]>
Update of /cvsroot/xmltv/xmltv/grab/it
In directory sfp-cvs-1.v30.ch3.sourceforge.com:/tmp/cvs-serv4875

Modified Files:
	channel_ids tv_grab_it.PL tv_grab_it.in 
Log Message:
add new backend : mediaset_guidatv

Index: tv_grab_it.PL
===================================================================
RCS file: /cvsroot/xmltv/xmltv/grab/it/tv_grab_it.PL,v
retrieving revision 1.14
retrieving revision 1.15
diff -C2 -d -r1.14 -r1.15
*** tv_grab_it.PL	31 Mar 2010 06:27:34 -0000	1.14
--- tv_grab_it.PL	9 Oct 2014 14:17:58 -0000	1.15
***************
*** 51,69 ****
  =over
  
  =item B<skylife>  - grabs data from www.skylife.it
  
! =item B<mtvit>    - grabs data from www.mtv.it
  
! =item B<boingtv>  - grabs data from www.boingtv.it
  
! =item B<sitcom1>  - grabs data from www.sitcom1.it
  
! =item B<raisat>   - grabs data from www.risat.it
  
! =item B<raiit>    - grabs data from www.rai.it
  
! =item B<iris>     - grabs data from www.iris.it
  
! =item B<mediasetpremium>  - grabs data from www.mediasetpremium.it
  
  
--- 51,71 ----
  =over
  
+ =item B<mediaset>  - grabs data from www.mediaset.it
+ 
  =item B<skylife>  - grabs data from www.skylife.it
  
! =item B<raiit>    - grabs data from www.rai.it
  
! =item B<mediaset_guidatv>  - grabs data from www.mediaset.it/guidatv
  
! =item B<mediasetpremium>  - grabs data from www.mediasetpremium.it
  
! =item B<iris>     - grabs data from www.iris.it
  
! =item B<boingtv>  - grabs data from www.boingtv.it
  
! =item B<mtvit>    - grabs data from www.mtv.it
  
! =item B<la7>    - grabs data from www.la7.it
  
  

Index: channel_ids
===================================================================
RCS file: /cvsroot/xmltv/xmltv/grab/it/channel_ids,v
retrieving revision 1.45
retrieving revision 1.46
diff -C2 -d -r1.45 -r1.46
*** channel_ids	27 Aug 2014 12:47:16 -0000	1.45
--- channel_ids	9 Oct 2014 14:17:58 -0000	1.46
***************
*** 581,583 ****
  italia2.mediaset.it;Italia 2
  www.boingtv.it;Boing
! cartoonito.mediaset.it;Cartoonito
\ No newline at end of file
--- 581,614 ----
  italia2.mediaset.it;Italia 2
  www.boingtv.it;Boing
! cartoonito.mediaset.it;Cartoonito
! [mediaset_guidatv]
! www.italia1.com;Italia 1
! www.canale5.com;Canale 5
! www.rete4.com;Retequattro
! italia2.mediaset.it;Mediaset Italia 2
! mediasetextra.mediaset.it;Mediaset Extra
! la5.mediaset.it;La5
! discoveryworld.mediaset.it;Discovery World
! tgcom24.mediaset.it;TgCom24
! topcrime.guidatv.sky.it;Top Crime
! premiumcrime.mediaset.it;Premium Crime
! steel.mediaset.it;Premium Action
! direttacalcio.mediaset.it;Premium Calcio
! premiumcinema.mediaset.it;Premium Cinema
! premiumcinemacomedy.mediaset.it;Premium Cinema Comedy
! premiumcinemaemotion.mediaset.it;Premium Cinema Emotion
! premiumcinemaenergy.mediaset.it;Premium Cinema Energy
! www.studiouniversal.it;Studio Universal
! bbcknowledge.mediaset.it;BBC Knowledge
! www.eurosport.com;Eurosport
! eurosport2.skytv.it;Eurosport 2
! foxsports.guidatv.sky.it;Fox Sports
! foxsportsplus.guidatv.sky.it;Fox Sports Plus
! iris.mediaset.it;Iris
! www.boingtv.it;Boing
! joi.mediaset.it;Joi
! mya.mediaset.it;Mya
! disney.mediaset.it;Disney
! disneyjunior.mediaset.it;Disney Junior
! www.cartoonnetwork.it;Cartoon Network
! cartoonito.guidatv.sky.it;Cartoonito

Index: tv_grab_it.in
===================================================================
RCS file: /cvsroot/xmltv/xmltv/grab/it/tv_grab_it.in,v
retrieving revision 1.102
retrieving revision 1.103
diff -C2 -d -r1.102 -r1.103
*** tv_grab_it.in	24 Sep 2013 21:34:04 -0000	1.102
--- tv_grab_it.in	9 Oct 2014 14:17:58 -0000	1.103
***************
*** 151,155 ****
  my $date_today = UnixDate("today", '%Y-%m-%d');
  
! my @default_backends = ('mediaset', 'skylife', 'raiit', 'mediasetpremium', 'iris', 'boingtv', 'mtvit', 'la7');
  
  
--- 151,155 ----
  my $date_today = UnixDate("today", '%Y-%m-%d');
  
! my @default_backends = ('mediaset', 'skylife', 'raiit', 'mediaset_guidatv', 'mediasetpremium', 'iris', 'boingtv', 'mtvit', 'la7');
  
  
***************
*** 284,287 ****
--- 284,297 ----
       },
  
+      'mediaset_guidatv' =>
+      { domain => 'mediaset_guidatv.it',
+        base_chan => 'http://www.mediaset.it/guidatv/palinsesto.xml',
+        base_data => 'http://www.mediaset.it/guidatv/palinsesto.xml',
+        rturl => "http://www.mediaset.it/guidatv/palinsesto.xml",
+        needs_login => 0,
+        needs_cookies => 0,
+        fetch_data_sub =>   \&mediaset_guidatv_fetch_data,
+        channel_list_sub => \&mediaset_guidatv_get_channels_list,
+      },
  
      );
***************
*** 3026,3027 ****
--- 3036,3329 ----
      }
  }
+ 
+ ###############################
+ # mediaset_guidatv  functions #
+ ###############################
+ 
+ ####################################################
+ # mediaset_guidatv_get_channels_list
+ sub mediaset_guidatv_get_channels_list {
+ 
+     ###############################################
+     # l'unico url che ho trovato che contiene l'elenco di tutti i canali e' 
+     # http://www.mediaset.it/guidatv/palinsesto.xml
+     # pero' e' un file di circa 2.5 mega, visto che questa funzione viene chiamata ad ogni
+     # esecuzione del grabber preferisco fare anche qui una finta funzione che mi
+     # ritorna un valore fisso
+     #
+     ## [honir] Don't like hard-coding variable data like this, so commented out
+     ##    
+     if (0) {
+     
+     my %chan_hash;
+ 
+     %chan_hash = ("BBC Knowledge", "EB",
+                   "Boing", "KB",
+                   "Canale 5", "C5",
+                   "Cartoonito", "LA",
+                   "Cartoon Network", "KN",
+                   "Discovery World", "ED",
+                   "Disney", "DY",
+                   "Disney Junior", "KP",
+                   "Eurosport 2", "EF",
+                   "Eurosport", "EE",
+                   "Fox Sports", "0F",
+                   "Fox Sports Plus", "0P",
+                   "Iris", "KI",
+                   "Italia 1", "I1",
+                   "Joi", "KJ",
+                   "La5", "KA",
+                   "Mediaset Extra", "KQ",
+                   "Mediaset Italia 2", "I2",
+                   "Mya", "KD",
+                   "Premium Action", "KS",
+                   "Premium Calcio", "KC",
+                   "Premium Cinema", "KE",
+                   "Premium Cinema Comedy", "LC",
+                   "Premium Cinema Emotion", "KO",
+                   "Premium Cinema Energy", "KG",
+                   "Premium Crime", "LR",
+                   "Retequattro", "R4",
+                   "Studio Universal", "KR",
+                   "TgCom24", "TG24",
+                   "Top Crime", "LT"
+       );
+ 
+     foreach (keys %chan_hash) {
+         my $xmltv_id = xmltv_chanid('mediaset_guidatv', $_);
+ #  warn $_."chan_hash-------------------";
+ #  warn $xmltv_id."xmltv_id-------------------";
+         $backend_info{mediaset_guidatv}{site_ids}{$xmltv_id}{site_id} = $_;
+         }
+     return %chan_hash;
+     
+     }
+     ################################################ fine fake sub
+     
+     
+     my %chan_hash;
+     
+     my $url = $backend_info{mediaset_guidatv}{base_chan};
+     warn ($DEF_LANG eq 'eng' ?
+                       "VERBOSE: Getting channel list from $url\n" :
+                       "VERBOSE: Scarico la lista dei canali da $url\n") if ($opt_verbose);
+  
+     my $content;
+     eval { $content = get_nice($url); };
+       if ($@) {   #get_nice has died
+           warn ($DEF_LANG eq 'eng' ? 
+                         "VERBOSE: Cannot get mediaset_guidatv's channel list ($url). Site \\n" : 
+                         "VERBOSE: Non sono riuscito a prendere la lista dei canali di mediaset_guidatv ($url). Il sito non funziona?\n") unless ($opt_quiet);
+           return ();
+       }
+ 
+     #split and parse
+     my @events = split /<evento/, $content;
+     foreach my $e (@events) {
+       my ($c) = ( $e =~ /<channel>(.*?)<\/channel>/ );
+       my ($n) = ( $e =~ /<channelDescription>(.*?)<\/channelDescription>/ );
+       ($n) = ( $n =~ /<!\[CDATA\[(.*)\]\]>/ ) if defined $n;
+       
+       next if (not defined $n);
+       my $name = tidy($n);
+       next if defined $chan_hash{$name};
+       
+       $chan_hash{$name} = "$c";
+       
+       #update backend info, in case this is a new channel not in channel_ids
+       my $xmltv_id = xmltv_chanid('mediaset_guidatv', $name);
+       $backend_info{mediaset_guidatv}{site_ids}{$xmltv_id}{site_id} = $name;
+       $backend_info{mediaset_guidatv}{site_ids}{$xmltv_id}{chanid} = $chan_hash{$name};                
+    }
+ 
+   return %chan_hash;
+ }
+ 
+ 
+ ####################################################
+ # mediaset_guidatv_fetch_data
+ # 2 parameters: xmltv_id of channel 
+ #               day offset
+ # returns an error or an array of data
+ 
+ sub mediaset_guidatv_fetch_data {
+     my ($xmltv_id, $offset) = @_;
+     my $content;
+ 
+     my $site_id = $backend_info{mediaset_guidatv}{site_ids}{$xmltv_id}{site_id};
+ #	warn $site_id."site_id-----------------\n";
+     if (not defined $site_id) {
+         warn ($DEF_LANG eq 'eng' ?
+                          "VERBOSE: \tThis site doesn't know about $xmltv_id!\n" :
+                          "VERBOSE: \tQuesto sito non sa niente di $xmltv_id!\n" ) if ($opt_verbose);
+         return (1, ());
+     }
+ 
+     my %chan = %{$backend_info{mediaset_guidatv}{channels}};
+     my $channel_name  = $backend_info{mediaset_guidatv}{site_ids}{$xmltv_id}{site_id};
+ #	warn "test-".$channel_name."channel_name-----------------\n";
+     my $channel_num = $chan{$channel_name};
+ #	warn $channel_num."channel_num-----------------\n";
+ #	warn $chan{"Canale 5"}."channel_num Canale 5-----------------\n";
+ #	warn $chan{"Retequattro"}."channel_num Rete 4-----------------\n";
+ #	warn $chan{"Cartoonito"}."channel_num Cartoonito-----------------\n";
+     # build url to grab"
+ 
+     if (not defined $channel_num) {
+                 # if we get here it means that the site should have the channel (it's in channel_ids)
+                 # but for some reason we are missing it's site id (probably the site is down)
+                 # we return an error so that another backend will by used, if possible
+         warn ($DEF_LANG eq 'eng' ?
+                           "VERBOSE: \tThis site appears to be down!\n" :
+                           "VERBOSE: \tQuesto sito non sembra funzionare!!\n") if ($opt_verbose);
+         return (1, ());
+         }
+ 
+     my $date_grab = &DateCalc("today","+ ".$offset." days");
+ 
+ 
+     die ($DEF_LANG eq 'eng' ? 'date calculation failed' : 'errore di calcolo di data') if not defined $date_grab;
+     $date_grab = UnixDate($date_grab, '%Y%m%d');
+     my $date_grab2 = UnixDate($date_grab, '%Y-%m-%d');
+ #    warn $date_grab2;
+     my $url = $backend_info{mediaset_guidatv}{base_data};
+ 
+     #to trick memoize into not caching data with add a string to the url, based on time, with hourly resolution
+     #so if we redownload data within 5 minutes (we are within the same run) it comes from the cache
+     #but if we download it tomorrow it doesn't.
+     #this makes sense if you use the --cache option and you want to cache only the --slow data, to speed up things 
+     #when you grab data every two-three days, but you don't want to miss schedule changes
+     #this string is ignored by the server
+     if ($opt_cache_slow) {
+             my $cachestring = "?pippo=".UnixDate("today","%Y%m%d%H");
+                 $url.=$cachestring;
+         }
+     warn ($DEF_LANG eq 'eng' ?
+                   "VERBOSE: fetching $url\n" :
+                   "VERBOSE: scarico $url\n") if ($opt_verbose);
+ 
+     eval { $content=get_nice($url) };
+     if ($@) {   #get_nice has died
+         warn ($DEF_LANG eq 'eng' ?
+                           "VERBOSE: Error fetching $url channel $xmltv_id day $offset backend mediaset_guidatv\n" :
+                           "VERBOSE: Errore nello scaricare $url, canale $xmltv_id, giorno $offset, fonte mediaset_guidatv\n") if ($opt_verbose);
+ 
+         # Indicate to the caller that we had problems
+         return (1, ());
+     }
+ 
+     my @programmes = ();
+     warn "VERBOSE: parsing...\n" if ($opt_verbose);
+ 
+     #split and parse
+     my @p = split /<programmazione/, $content;
+ 	foreach my $pr (@p) {
+ 		next unless $pr=~/$date_grab2/;#cerca la programmazione del giorno selezionato
+ #		next if $pr=~/<data>/;
+ #		next if $pr=~/<listaeventi>/;
+ #               warn $pr."-----------------\n";
+ #               warn $date_grab2."-----------------\n";
+ #               warn "|$1|$2|$3|$4|$5|\n";
+ 		my @lines = split /<evento/, $pr;
+ 		my %programme = ();
+                 my ($title, $time_start, $time_end, $guidatv_channel_num, $rerun, $first, $id, $anno, $nazione,
+                     $desc, $epnum, $subtitle, $category, $rating, $audio, $doppioaudio, $sottotitoli);
+ 		my $lastline;
+                 foreach my $l(@lines) {
+ 			next unless $l=~/<channel>$channel_num<\/channel>/;
+ #                        next if ($l=~/anno\/|paese\/|linkScheda|trafficLight\/|orafine|\!--sort|\!-- canale|\/durata|\/prg|\/canale|\/giorno|\/palinsesto/);
+ #                        if ($l=~/<title><\!\[CDATA\[(.*?)\]\]<\/title>/){
+                         if ($l=~/<displayTitle><!\[CDATA\[(.*?)\]\]><\/displayTitle>/){
+                                 $title=$1;
+ #                                warn "titolo: $title\n";
+                         }
+ 			if ($l=~/<title><!\[CDATA\[(.*?)\]\]><\/title>/){
+                                 $subtitle=$1;
+ #                                warn "sottotitolo: $subtitle\n";
+                         }
+ 			if ($l=~/<startTime>(.*?)<\/startTime>/){
+                                 $time_start=$1;
+ #                                warn "time_start: $time_start\n";
+                         }
+                         if ($l=~/<endTime>(.*?)<\/endTime>/){
+                                 $time_end=$1;
+ #                                warn "time_end: $time_end\n";
+                         }
+ 			if ($l=~/<channel>(.*?)<\/channel>/){
+                                 $guidatv_channel_num=$1;
+ #                                warn "channel_num: $guidatv_channel_num\n";
+                         }
+ 			if ($l=~/<genere> ?(.*?)<\/genere>/){
+                                 $category=$1;
+ #                                warn "category: $category\n";
+                         }
+ 			else {
+ #                                warn "linea sconosciuta !!$l!! \n";
+                         }
+                         $lastline = $l;
+ 
+ 		        $time_end=~s/:/\./; $time_start=~s/:/\./;
+         		my $next_day_end = 0; my $next_day_start = 0;
+ 	      		if ($time_end < 6) {
+         	            $next_day_end = 1;
+                   	}
+ 		        if ($time_start < 6) {
+                 	    $next_day_start = 1;
+ 	                    $next_day_end = 1;
+         	        }
+ 		        $time_end=~s/\./:/; $time_start=~s/\./:/;
+                 	$programme{stop}=xmltv_date($time_end, $offset + $next_day_end);
+ 
+ 
+ 	                # Three mandatory fields: title, start, channel.
+         	        if (not defined $title) {
+                 	        warn ($DEF_LANG eq 'eng' ? 'no title found, skipping programme' : 'titolo non trovato, salto');
+                         	next;
+ 	                }
+         	                $programme{title}=[[tidy($title), $LANG] ];
+                 	if (not defined $time_start) {
+                         	warn ($DEF_LANG eq 'eng' ? "no start time for title $title, skipping programme" : "nessun orario di inizio per $title, salto");
+ 	                        next;
+         	        }
+                 	#$time_start=~s/://;
+ 	                $programme{start}=xmltv_date($time_start, $offset + $next_day_start);
+         	        if (not defined $xmltv_id) {
+                 	        warn ($DEF_LANG eq 'eng' ? "no channel for programme $title at $time_start, skipping programme" : "canale non trovato per $title alle $time_start, salto");
+                         	next;
+ 	                }
+         	        $programme{channel}=$xmltv_id;
+                 	$programme{title} = [[tidy($title), $LANG] ] if (defined $title);
+ 	                $programme{date}= $anno if (defined $anno);
+         	        $programme{premiere} = ['prima TV', $LANG ] if(defined $first and $first ne 'No');
+                 	#non mi e' chiaro come funziona
+ 	                #$programme{audio}= ['stereo', tidy($audio)] if (defined $audio);
+         	        $programme{rating}=[[tidy($rating), $LANG ]] if (defined $rating);
+                 	$programme{category}=[[tidy($category), $LANG ]] if (defined $category and $category ne '');
+ 
+ 	                #$programme{'sub-title'}=[[$subtitle, $LANG] ] if (defined $subtitle and $subtitle ne '');
+         	        #push@{$programme->{'episode-num'}}, [$strseason, 'onscreen'] if ($strseason);
+                 	#push@{$programme->{'episode-num'}}, [(defined $season ? ($season-1) : '').".".(defined $episode ? ($episode-1) : '').".0/1", 'xmltv_ns'] if ($strseason);  
+ 
+ 	                push (@{$programme{country}}, [$nazione, $LANG]) if ($nazione and $nazione ne '--');
+         	        $programme{desc}=[[tidy($desc), $LANG ]] if (defined $desc and $desc ne '');
+ 
+                 	#put info in array
+ 	                push @programmes, {%programme};
+ 
+ 
+         	        }
+                 next unless $title;
+ 
+ 
+ 	}
+ 
+     if (scalar @programmes) {
+         return (0, @programmes);
+     }
+     else {
+         # there is a number of reasons why we could get an empty array.
+         # so we return an error 
+         return (1, @programmes);
+     }
+ }
+ 


------------------------------------------------------------------------------
Meet PCI DSS 3.0 Compliance Requirements with EventLog Analyzer
Achieve PCI DSS 3.0 Compliant Status with Out-of-the-box PCI DSS Reports
Are you Audit-Ready for PCI DSS 3.0 Compliance? Download White paper
Comply to PCI DSS 3.0 Requirement 10 and 11.5 with EventLog Analyzer
http://pubads.g.doubleclick.net/gampad/clk?id=154622311&iu=/4140/ostg.clktrk
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.