Revision a21c1615 dvbdguide/tv.cgi

View differences:

dvbdguide/tv.cgi
29 29
$recordingPath = "/home/jak/recordings";
30 30

  
31 31
%xmltvToDVB = ( "bbc1.bbc.co.uk" => "dvb-t/BBC ONE",
32
                "south-east.bbc1.bbc.co.uk" => "dvb-t/BBC ONE",
33 32
		"bbc2.bbc.co.uk" => "dvb-t/BBC TWO",
34
		"south-east.bbc2.bbc.co.uk" => "dvb-t/BBC TWO",
35 33
		"choice.bbc.co.uk" => "dvb-t/BBC THREE",
36 34
		"bbc3.bbc.co.uk" => "dvb-t/BBC THREE",
37 35
		"knowledge.bbc.co.uk" => "dvb-t/BBC FOUR",
......
50 48
  return "listings.$offset.xml" 
51 49
}
52 50

  
51
sub lookupXmlTV {
52
  my ($channel) = @_;
53

  
54
  for my $k (keys %xmltvToDVB) {
55
    if ($channel =~ m/$k/) {
56
      return $xmltvToDVB{$k};
57
    }
58
  }
59
  undef;
60
}
61

  
53 62
sub printScheduled ($$$) {
54 63
    my $output = shift;
55 64
    my $schedule = shift;
......
285 294
    return $a;
286 295
}
287 296

  
297
sub quoteSpaceWord {
298
    my ($word) = @_;
299
    return ($word =~ m/ / ? "'" . $word . "'" : $word);
300
}
301

  
288 302
sub schedule {
289 303
    my ($schedule, $channel, $title, $subtitle, $start, $stop) = @_;
290 304
    my $duration = calcDuration($start, $stop);
291 305
    
292 306
    if (!alreadyScheduled($schedule, $channel, $start)) {
293 307
	# print "Scheduling: [$channel] [$xmltvToDVB{$channel}] $title ($subtitle)\n";
294
	if ($xmltvToDVB{$channel} =~ m%^(.*)/(.*)$%) {
308
	my $channelspec = lookupXmlTV($channel);
309
	if ($channelspec && $channelspec =~ m%^(.*)/(.*)$%) {
295 310
	    my $dvbType = $1;
296 311
	    my $dvbChannel = $2;
297 312

  
......
319 334

  
320 335
	    # print "@command\n";
321 336
	    system(@command) and
322
		print "Failed: @command\n $!\n";
337
		print "Failed: " . join(" ", map(quoteSpaceWord($_), @command)) . "\n $!\n";
323 338
	    return 1;
324 339
	}
325 340
	else {

Also available in: Unified diff