xmltv2html 0.5.3 → 0.5.4

Sign up to get free protection for your applications and to get access to all the features.
data/ChangeLog CHANGED
@@ -1,4 +1,103 @@
1
1
  ------------------------------------------------------------------------
2
+ r137 | kvh | 2005-09-10 11:21:43 -0500 (Sat, 10 Sep 2005) | 1 line
3
+ Changed paths:
4
+ M /trunk/bin/xmltv2html.rb
5
+
6
+ comment out debug lines
7
+ ------------------------------------------------------------------------
8
+ r136 | kvh | 2005-09-07 19:34:58 -0500 (Wed, 07 Sep 2005) | 1 line
9
+ Changed paths:
10
+ M /trunk/bin/xmltv2html.rb
11
+
12
+ fix when no --start/stop time given
13
+ ------------------------------------------------------------------------
14
+ r135 | kvh | 2005-09-07 01:21:30 -0500 (Wed, 07 Sep 2005) | 1 line
15
+ Changed paths:
16
+ M /trunk/bin/xmltv2html.rb
17
+ M /trunk/xmltv2html.gemspec
18
+
19
+ new version
20
+ ------------------------------------------------------------------------
21
+ r134 | kvh | 2005-09-07 00:55:43 -0500 (Wed, 07 Sep 2005) | 1 line
22
+ Changed paths:
23
+ M /trunk/MANIFEST
24
+ M /trunk/create_dists
25
+
26
+ adjustments for new contrib filenames and .gem
27
+ ------------------------------------------------------------------------
28
+ r133 | kvh | 2005-09-07 00:50:04 -0500 (Wed, 07 Sep 2005) | 1 line
29
+ Changed paths:
30
+ A /trunk/contrib/kvh/create_index.rb (from /trunk/contrib/kvh/tvlistings_index:132)
31
+ D /trunk/contrib/kvh/generate_html
32
+ A /trunk/contrib/kvh/generate_html.rb (from /trunk/contrib/kvh/generate_html:132)
33
+ D /trunk/contrib/kvh/tvlistings
34
+ A /trunk/contrib/kvh/tvlistings.sh (from /trunk/contrib/kvh/tvlistings:132)
35
+ D /trunk/contrib/kvh/tvlistings_index
36
+ D /trunk/contrib/kvh/update-tvlistings
37
+ A /trunk/contrib/kvh/update-tvlistings.rb (from /trunk/contrib/kvh/update-tvlistings:132)
38
+
39
+ adjust filenames; update to use new start/stop times
40
+ ------------------------------------------------------------------------
41
+ r132 | kvh | 2005-09-07 00:35:51 -0500 (Wed, 07 Sep 2005) | 1 line
42
+ Changed paths:
43
+ M /trunk/bin/xmltv2html.rb
44
+
45
+ check round_to_interval period for programmes at beginning of channel
46
+ ------------------------------------------------------------------------
47
+ r131 | kvh | 2005-09-07 00:16:17 -0500 (Wed, 07 Sep 2005) | 1 line
48
+ Changed paths:
49
+ M /trunk/bin/xmltv2html.rb
50
+
51
+ remove unused code
52
+ ------------------------------------------------------------------------
53
+ r130 | kvh | 2005-09-06 23:55:12 -0500 (Tue, 06 Sep 2005) | 1 line
54
+ Changed paths:
55
+ M /trunk/bin/xmltv2html.rb
56
+
57
+ --stoptime working
58
+ ------------------------------------------------------------------------
59
+ r129 | kvh | 2005-09-06 23:39:11 -0500 (Tue, 06 Sep 2005) | 1 line
60
+ Changed paths:
61
+ M /trunk/bin/xmltv2html.rb
62
+
63
+ --startime working
64
+ ------------------------------------------------------------------------
65
+ r128 | kvh | 2005-09-06 22:38:02 -0500 (Tue, 06 Sep 2005) | 1 line
66
+ Changed paths:
67
+ M /trunk/bin/xmltv2html.rb
68
+
69
+ check start times
70
+ ------------------------------------------------------------------------
71
+ r127 | kvh | 2005-07-31 12:55:08 -0500 (Sun, 31 Jul 2005) | 1 line
72
+ Changed paths:
73
+ M /trunk/bin/xmltv2html.rb
74
+
75
+ correct popups
76
+ ------------------------------------------------------------------------
77
+ r126 | kvh | 2005-07-31 12:42:34 -0500 (Sun, 31 Jul 2005) | 1 line
78
+ Changed paths:
79
+ M /trunk/bin/xmltv2html.rb
80
+
81
+ semi-working version
82
+ ------------------------------------------------------------------------
83
+ r125 | kvh | 2005-07-31 11:48:11 -0500 (Sun, 31 Jul 2005) | 1 line
84
+ Changed paths:
85
+ M /trunk/bin/xmltv2html.rb
86
+
87
+ re-coding classes
88
+ ------------------------------------------------------------------------
89
+ r124 | kvh | 2005-07-27 00:34:26 -0500 (Wed, 27 Jul 2005) | 1 line
90
+ Changed paths:
91
+ M /trunk/bin/xmltv2html.rb
92
+
93
+ correct deleting when span=0
94
+ ------------------------------------------------------------------------
95
+ r123 | kvh | 2005-07-03 22:35:51 -0500 (Sun, 03 Jul 2005) | 1 line
96
+ Changed paths:
97
+ M /trunk/create_dists
98
+
99
+ create a .gem package
100
+ ------------------------------------------------------------------------
2
101
  r122 | kvh | 2005-06-26 12:58:25 -0500 (Sun, 26 Jun 2005) | 1 line
3
102
  Changed paths:
4
103
  M /trunk/xmltv2html.gemspec
data/bin/xmltv2html.rb CHANGED
@@ -2,7 +2,7 @@
2
2
  #
3
3
  # xmltv2html.rb - A Ruby script to tranform the XMLTV output into HTML.
4
4
  #
5
- # Version : 0.5.3
5
+ # Version : 0.5.4
6
6
  # Author : Kurt V. Hindenburg <public@kurt.hindenburg.name>
7
7
  #
8
8
  # Copyright (C) 2003, 2004, 2005 Kurt V. Hindenburg
@@ -73,14 +73,33 @@ require "rexml/document"
73
73
  require 'singleton'
74
74
  require 'time'
75
75
 
76
- XMLTV2HTML_VERSION="0.5.3"
77
- XMLTV2HTML_DATE="Jun 20, 2005"
76
+ XMLTV2HTML_VERSION="0.5.4"
77
+ XMLTV2HTML_DATE="Sep 10, 2005"
78
+
79
+ module Xmltv2Html
80
+
81
+ def die(*args)
82
+ $stderr.print args
83
+ exit(1)
84
+ end
85
+
86
+ def info(*args)
87
+ $stderr.print args
88
+ end
89
+
90
+
91
+ end
92
+
93
+
78
94
 
79
- # die - print message to stderr and exit
80
95
  def die(*args)
81
96
  $stderr.print args
82
97
  exit(1)
83
98
  end
99
+ def info(*args)
100
+ $stderr.print args, "\n"
101
+ end
102
+
84
103
 
85
104
  class Config
86
105
  attr_reader(:times_interval, :channels_interval, :time_format_12)
@@ -100,6 +119,8 @@ class Config
100
119
  attr_accessor(:days, :total_hours, :total_span)
101
120
  attr_accessor(:url_next, :url_prev)
102
121
 
122
+ attr_accessor(:start_time, :stop_time)
123
+
103
124
  def initialize
104
125
  @opts = {}
105
126
  @keys = %w{ times_interval chanels_interval time_format_12 }
@@ -215,6 +236,9 @@ class Config
215
236
  # xmltv and xmltv2html home page links
216
237
  @output_links = true
217
238
 
239
+ @start_time = ""
240
+ @stop_time = ""
241
+
218
242
  ### END CONFIGURATION
219
243
  end
220
244
 
@@ -246,6 +270,9 @@ class Config
246
270
  opts.on("--noconfigfile","do NOT use any config file") {
247
271
  @use_config_file = false}
248
272
 
273
+ opts.on("--starttime=YYYYMMDDHHMM", String, "Start time") { |@start_time|}
274
+ opts.on("--stoptime=YYYYMMDDHHMM", String, "Stop time") { |@stop_time|}
275
+
249
276
  opts.on("--urlprev=URL", String, "URL for previous link") { |@url_prev|}
250
277
  opts.on("--urlnext=URL", String, "URL for next link") { |@url_next|}
251
278
 
@@ -271,6 +298,7 @@ class Config
271
298
  end
272
299
  end
273
300
  end
301
+
274
302
  end
275
303
 
276
304
  class Time
@@ -346,8 +374,81 @@ class ProgrammeTime
346
374
 
347
375
  end
348
376
 
377
+ class Programme
378
+ attr_reader :title, :subtitle, :span, :times, :desc, :rating, :category
379
+ attr_reader :previouslyShown, :spanSlots, :startSlot
380
+ attr_accessor :popupIndex
381
+ # attr_accessor :popupIndex
382
+
383
+ def initialize(title, subtitle, channel, start, stop, desc, rating, cats, rerun)
384
+ @title = title
385
+ @title.gsub!(/&/,'&amp;')
386
+ @subtitle = subtitle
387
+ @channelid = channel
388
+ @desc = desc
389
+ @rating = rating
390
+ @category = cats
391
+ @previouslyShown = rerun
392
+ @popupIndex = -1
393
+
394
+ @times = ProgrammeTime.new(start, stop)
395
+ end
396
+
397
+ # Slot interval = 12 (60 minutes / 5 minutes)
398
+ def calculateSlots
399
+ @startSlot = @times.calculateStartSlot
400
+ @stopSlot = @times.calculateStopSlot
401
+
402
+ return if not @startSlot
403
+ return if not @stopSlot
404
+
405
+ @spanSlots = @stopSlot - @startSlot
406
+ end
407
+
408
+ def start_time
409
+ @times.start_time
410
+ end
411
+
412
+ def stop_time
413
+ @times.stop_time
414
+ end
415
+
416
+ def to_s
417
+ @title
418
+ end
419
+
420
+ end
421
+
422
+
423
+ # channel id => [show1, show2, ...]
424
+ class Programmes < Hash
425
+
426
+ def []=(id, programme)
427
+ #info "Adding #{programme} to #{id}"
428
+ case programme
429
+ when Programme
430
+ begin
431
+ if empty? or not has_key?(id)
432
+ super id, Array.new << programme
433
+ else
434
+ super id, (fetch(id) << programme)
435
+ end
436
+ end
437
+ when Array
438
+ begin
439
+ delete id
440
+ super id, programme
441
+ end
442
+ else
443
+ $stderr.print "^^^ Programmes []= Unknown class=#{programme.class}\n"
444
+ end
445
+ end
446
+
447
+ end
448
+
349
449
  class Channel
350
- attr_reader(:programmeList, :name, :id, :fullname)
450
+ attr_reader(:name, :id, :fullname)
451
+ attr_reader(:programmes)
351
452
  attr_accessor(:totalSpan)
352
453
 
353
454
  def initialize(id, fn)
@@ -356,31 +457,47 @@ class Channel
356
457
  @number = ""
357
458
  @name = @fullname
358
459
  @totalSpan = 0 # 24 hours * 4 = 96
359
- @programmeList = nil
460
+ @programmes = Programmes.new
360
461
  end
361
462
 
362
463
  def <=>(o)
363
464
  fullname.to_i <=> o.fullname.to_i
364
465
  end
365
466
 
366
- def setProgrammes(l)
367
- @programmeList = l
467
+ def <<(p)
468
+ # info "#{@id} : Adding #{p}\n"
469
+ @programmes[@id] = p
470
+ end
471
+
472
+ def number_of_programmes
473
+ @programmes[@id].size
474
+ end
475
+
476
+ def programme_at(i)
477
+ @programmes[@id][i]
368
478
  end
369
479
 
370
480
  # Verify that each show's STOP date is the next show's START date
371
481
  # Should not be needed if tv_sort was used.
372
482
  # TODO: remove this once we can verify tv_sort was used on input data
373
483
  def verifyStopDate
374
- @programmeList.each_index { |si|
375
- s = @programmeList[si]
376
- next_show = @programmeList[si.succ]
377
- next if next_show == nil
378
- next if s.times.fullStopTime == next_show.times.fullStartTime
379
-
380
- die "\n * A programme's stop time does not match the next \n" +
381
- " * programme's start time. \n" +
382
- " * Use tv_sort from the xmltv distribution to correct!\n" +
383
- " * Exiting...\n\n" if !stop
484
+ # @programmeList.each_index { |si|
485
+ # s = @programmeList[si]
486
+ # next_show = @programmeList[si.succ]
487
+ # next if next_show == nil
488
+ # next if s.times.fullStopTime == next_show.times.fullStartTime
489
+ #
490
+ # die "\n * A programme's stop time does not match the next \n" +
491
+ # " * programme's start time. \n" +
492
+ # " * Use tv_sort from the xmltv distribution to correct!\n" +
493
+ # " * Exiting...\n\n" if !stop
494
+ # }
495
+ end
496
+
497
+ def calc_programme_slots
498
+
499
+ @programmes[@id].each { |p|
500
+ p.calculateSlots
384
501
  }
385
502
  end
386
503
 
@@ -448,13 +565,15 @@ class Channel
448
565
 
449
566
  slist = Array.new
450
567
 
451
- s = @programmeList[0]
568
+
569
+ s = @programmes[@id].first # 1st programme for this channel
570
+
452
571
  if s.startSlot() > 0 # Missing programme at start
453
572
  dummy_span = s.startSlot() - span_counter
454
573
  slist.push "D"+dummy_span.to_s
455
574
  end
456
575
 
457
- @programmeList.each { |s|
576
+ @programmes[@id].each { |s|
458
577
  slist.push "P"+s.spanSlots.to_s
459
578
  }
460
579
 
@@ -474,6 +593,12 @@ class Channel
474
593
  }
475
594
 
476
595
  slist = l.unshift("C0") # Add left-most channel
596
+ # Add left-most channel if not already there
597
+ # slist = l
598
+ # slist = l.unshift("C0") if l[0] != "C0"
599
+ # slist = l.unshift("C0") if l[0, 1] != "C0"
600
+ # $stderr.print slist[0, 3],"\n"
601
+ # $stderr.print l[0, 3],"\n"
477
602
 
478
603
  dinterval = $params.total_hours * 60 / $params.time_divisor
479
604
  if total < dinterval # Not enough programmes' data at end
@@ -486,37 +611,6 @@ class Channel
486
611
 
487
612
  end
488
613
 
489
- class Programme
490
- attr_reader :title, :subtitle, :span, :times, :desc, :rating, :category
491
- attr_reader :previouslyShown, :spanSlots, :startSlot
492
- attr_accessor :popupIndex
493
-
494
- def initialize(title, subtitle, channel, start, stop, desc, rating, cats, rerun)
495
- @title = title
496
- @title.gsub!(/&/,'&amp;')
497
- @subtitle = subtitle
498
- @channelid = channel
499
- @desc = desc
500
- @rating = rating
501
- @category = cats
502
- @previouslyShown = rerun
503
- @popupIndex = -1
504
-
505
- @times = ProgrammeTime.new(start, stop)
506
- end
507
-
508
- # Slot interval = 12 (60 minutes / 5 minutes)
509
- def calculateSlots
510
- @startSlot = @times.calculateStartSlot
511
- @stopSlot = @times.calculateStopSlot
512
-
513
- return if not @startSlot
514
- return if not @stopSlot
515
-
516
- @spanSlots = @stopSlot - @startSlot
517
- end
518
-
519
- end
520
614
 
521
615
  # [channel id] -> Channel
522
616
  class Channels < Hash
@@ -530,30 +624,11 @@ class Channels < Hash
530
624
  @output_stop_hour = 0 # Stop hours displayed
531
625
  end
532
626
 
533
- end
534
-
535
- # channel id => [show1, show2, ...]
536
- class Programmes < Hash
537
- include Singleton
627
+ def calc_programmes_slots
538
628
 
539
- def []=(id, programme)
540
- case programme
541
- when Programme
542
- begin
543
- if empty? or not has_key?(id)
544
- super id, Array.new << programme
545
- else
546
- super id, (fetch(id) << programme)
547
- end
548
- end
549
- when Array
550
- begin
551
- delete id
552
- super id, programme
553
- end
554
- else
555
- $stderr.print "^^^ Programmes []= Unknown class=#{programme.class}\n"
556
- end
629
+ each { |id, c|
630
+ c.calc_programme_slots
631
+ }
557
632
  end
558
633
  end
559
634
 
@@ -615,17 +690,15 @@ class XmlTV
615
690
  element.each_element { |e|
616
691
  if e.name == "display-name" # Use 1st entry
617
692
  fn = e.text()
618
- # $stderr.print "#{id}---#{fn}\n"
619
693
  break
620
694
  end
621
695
  }
622
- # $stderr.print "Using : #{id}---#{fn}\n"
623
696
  channels[id] = Channel.new(id, fn)
624
697
  }
625
698
  end
626
699
 
627
700
  def parseProgrammes
628
- plist = Programmes.instance
701
+ channels = Channels.instance
629
702
 
630
703
  @doc.elements.each("tv/programme") { |element|
631
704
  title=""
@@ -634,6 +707,7 @@ class XmlTV
634
707
  rating=""
635
708
  cats = nil
636
709
  rerun = false
710
+ ndesc = ""
637
711
  start = element.attributes["start"]
638
712
  stop = element.attributes["stop"]
639
713
  die "\n * No stop attribute in this programme...\n" +
@@ -641,15 +715,54 @@ class XmlTV
641
715
  " * Exiting...\n\n" if !stop
642
716
 
643
717
  dstart = start[0..13]
718
+ dstop = stop[0..13]
719
+ ext = start[14..-1]
720
+
721
+ if not $params.start_time.empty?
722
+ # $stderr.print "Desired start : #{$params.start_time}\n"
723
+ nstart = $params.start_time.clone
724
+ nstart[10..11] = $params.time_divisor.to_s
725
+
726
+ # If programme ends before the desired start time...
727
+ # Adjust for the time_divisor (round_to_interval)
728
+ if dstop < nstart
729
+ # $stderr.print "Delete programme - Desired start : #{$params.start_time}, "
730
+ # $stderr.print "programme stop : #{dstop}\n"
731
+ # $stderr.print "Old start time = #{$params.start_time}, new=#{nstart}\n"
732
+ next
733
+ end
734
+ end
735
+
736
+ # If programme starts after the desired stop time...
737
+ if (not $params.stop_time.empty?) and (dstart >= $params.stop_time)
738
+ # $stderr.print "Delete programme - Desired stop : #{$params.stop_time}, "
739
+ # $stderr.print "programme start : #{dstart}\n"
740
+ next
741
+ end
742
+
743
+ # If programme starts before the desired start time, change start
744
+ if (not $params.start_time.empty?) and (dstart < $params.start_time)
745
+ # $stderr.print "Change Start - new start : #{$params.start_time}, "
746
+ # $stderr.print "old start: #{dstart}\n"
747
+ # ndesc = "(" + start[8..9] + ":" + start[10..11] + ") "
748
+
749
+ start = $params.start_time + ext
750
+ dstart = start[0..13]
751
+ end
752
+
753
+
754
+ # If programme ends after the desired stop time, change stop
755
+ if (not $params.stop_time.empty?) and (dstop > $params.stop_time)
756
+ stop = $params.stop_time + ext
757
+ dstop = stop[0..13]
758
+ end
759
+
644
760
  @firstShowStartDate = dstart if @firstShowStartDate > dstart
645
761
  @lastShowStartDate = dstart if @lastShowStartDate < dstart
646
- dstop = stop[0..13]
647
762
  @lastShowStopDate = dstop if @lastShowStopDate < dstop
648
- #$stderr.print "Start Date=#{dstart}, firstShowStartDate=#{firstShowStartDate}\n"
649
763
 
650
764
  channel = element.attributes["channel"]
651
765
  element.each_element {|e|
652
- #$stderr.print e.text(),"\n"
653
766
  title = e.text() if e.name == "title"
654
767
  subtitle = e.text() if e.name == "sub-title"
655
768
  desc=e.text() if e.name == "desc"
@@ -678,15 +791,20 @@ class XmlTV
678
791
  desc = "" if not desc
679
792
  desc.gsub!(/[\"\'\`]/,'') # Remove "'`
680
793
  desc = desc.unpack("U*").pack("C*")
794
+ desc = ndesc + desc if ndesc
681
795
 
682
796
  rating = "" if not rating
683
797
  rating.gsub!(/[\"\'\`]/,'') # Remove "'`
684
798
  #$stderr.print "title=#{title}, desc=#{desc}, rating=#{rating}\n"
685
799
 
686
- plist[channel] = Programme.new(
800
+ p = Programme.new(
687
801
  title, subtitle, channel, start, stop, desc, rating, cats, rerun)
802
+ # plist[channel] = p
803
+ channels[channel] << p
688
804
  }
689
805
  end
806
+
807
+
690
808
  end
691
809
 
692
810
  class XMLTV2HTML
@@ -704,6 +822,7 @@ class XMLTV2HTML
704
822
  @xml.parseChannels
705
823
  @xml.parseProgrammes
706
824
 
825
+
707
826
  $params.start_date = @xml.firstShowStartDate
708
827
  $params.stop_date = @xml.lastShowStopDate
709
828
  # $stderr.print "Starting listings at #{$params.start_date}\n"
@@ -727,27 +846,8 @@ class XMLTV2HTML
727
846
  pstop = Time.parse($params.stop_date)
728
847
  $params.total_hours = ((pstop - pstart) / 3600).to_i
729
848
 
730
- # Traverse all channels' programmes and calculate their slots
731
- # Delete any programme with span < 1
732
- programmes = Programmes.instance
733
849
  channels = Channels.instance
734
-
735
- programmes.each { |id, programs|
736
- total = 0
737
- programs.each { |p|
738
- p.calculateSlots
739
- if p.spanSlots < 1
740
- $stderr.print "Deleting #{p} span=#{p.spanSlots}\n"
741
- delete p
742
- else
743
- total += p.spanSlots
744
- end
745
- }
746
- # $stderr.print "Total span = #{total}\n"
747
- channels[id].totalSpan = total
748
- channels[id].setProgrammes programmes[id]
749
- $params.total_span = total if total > $params.total_span
750
- }
850
+ channels.calc_programmes_slots
751
851
 
752
852
  fdate = $params.start_date[0,8]
753
853
  ldate = $params.stop_date[0,8]
@@ -786,6 +886,7 @@ class XMLTV2HTML
786
886
  sorted_channels.each { |id, c|
787
887
  @out.outputChannelBegin
788
888
  slot_list = c.createSlotList
889
+ next unless slot_list
789
890
  i = 0
790
891
  pi = -1
791
892
  slot_list.each { |entry|
@@ -793,26 +894,17 @@ class XMLTV2HTML
793
894
  span = entry.slice(1..-1).to_i
794
895
  case cmd
795
896
  when "D"
796
- # $stderr.print "Dummy #{entry}\n"
797
897
  @out.outputDummyProgramme(span)
798
898
  when "P" # Programme
799
899
  sindex += 1
800
900
  pi += 1
801
- # p = c.programmeList[pi]
802
- # $stderr.print "#{entry} #{p}\n"
803
- @out.outputProgramme(c.programmeList[pi], sindex, span)
901
+ @out.outputProgramme(c.programme_at(pi), sindex, span)
804
902
  when "Q" # Use previous Programme's info
805
- p = c.programmeList[pi]
806
- # $stderr.print "Programme- Use previous programme #{entry}\n"
807
- # p = c.programmeList[pi-1]
808
- @out.outputProgramme(c.programmeList[pi], sindex, span)
809
- # @out.outputProgramme(p, sindex, span)
903
+ @out.outputProgramme(c.programme_at(pi), sindex, span)
810
904
  when "C"
811
- # $stderr.print "Channel space #{cmd}\n"
812
905
  @out.outputChannel(c)
813
906
  else
814
907
  $stderr.print "Unknown slot entry #{entry}\n" ; exit
815
- $stderr.print "Using : #{id}---#{fn}\n"
816
908
  end
817
909
  i += 1
818
910
  }
@@ -908,8 +1000,7 @@ class Html
908
1000
 
909
1001
  def outputPopupDescs(c, cindex)
910
1002
  # The descriptions go here...Text[#]=["title","text"]
911
- id = c.id()
912
- c.programmeList.each { |s|
1003
+ c.programmes[c.id()].each { |s|
913
1004
  title = $params.popup_title_format.sub(/\%T/, s.title)
914
1005
  title.sub!(/\%R/, s.rating)
915
1006
  desc = $params.popup_body_format.gsub(/%T/, s.title)
File without changes
@@ -4,8 +4,8 @@ require 'date'
4
4
 
5
5
  tvlisting_dir = "/mnt/part5/www/tvlistings/"
6
6
 
7
- html_cmd = "/home/kvh/bin/xmltv2html.rb"
8
- index_cmd = "/home/kvh/bin/tvlistings_index"
7
+ html_cmd = "/home/kvh/bin/tvlistings/xmltv2html.rb"
8
+ index_cmd = "/home/kvh/bin/tvlistings/create_index.rb"
9
9
 
10
10
  conf = "/home/kvh/.xmltv2htmlrc"
11
11
 
@@ -43,21 +43,27 @@ files.each { |f|
43
43
 
44
44
  # $stderr.print "#{fdd}\n"
45
45
  # d = Date.new(fdate[0,4].to_i, fdate[4,2].to_i, fdate[6,2].to_i)
46
- d = Date.new(fdd[0,4].to_i, fdd[5,2].to_i, fdd[8,2].to_i)
47
- nextday = d + 1
48
- nextday_file = nextday.strftime("%Y-%m-%d") + ".html"
49
- prevday = d - 1
50
- prevday_file = prevday.strftime("%Y-%m-%d") + ".html"
46
+ d = Date.new(fdd[0,4].to_i, fdd[5,2].to_i, fdd[8,2].to_i)
47
+ nextday = d + 1
48
+ nextday_file = nextday.strftime("%Y-%m-%d") + ".html"
49
+ prevday = d - 1
50
+ prevday_file = prevday.strftime("%Y-%m-%d") + ".html"
51
51
 
52
52
  # $stderr.print "prev day #{prevday}; #{prevday_file}\n"
53
53
  # $stderr.print "next day #{nextday}; #{nextday_file}\n"
54
54
 
55
+ starttime = fdd[0,4] + fdd[5,2] + fdd[8,2] + "0000"
56
+ stoptime = nextday.strftime("%Y%m%d") + "0000"
57
+ # $stderr.print "starttime=#{starttime}\n"
58
+ # $stderr.print "stoptime =#{stoptime}\n"
55
59
 
56
60
  run_me = html_cmd
57
61
  run_me += " --configfile=" + conf if File.exists?(conf)
58
62
  run_me += " < " + f + " > " + output_file
59
63
  run_me += " --urlprev=" + prevday_file if prevday_file
60
64
  run_me += " --urlnext=" + nextday_file if nextday_file
65
+ run_me += " --starttime=" + starttime
66
+ run_me += " --stoptime=" + stoptime
61
67
 
62
68
  print run_me,"\n"
63
69
  status = system(run_me)
@@ -1,15 +1,17 @@
1
1
  #!/bin/bash
2
2
 
3
+ BIN=~/bin/tvlistings
4
+
3
5
  echo
4
6
  echo "* Updating TV listings using xmltv from zap2it.com..."
5
- ~/bin/update-tvlistings
7
+ ${BIN}/update-tvlistings.rb
6
8
 
7
9
  echo
8
10
  echo "* Generating HTML from the XMLTV output..."
9
- ~/bin/generate_html
11
+ ${BIN}/generate_html.rb
10
12
 
11
13
  echo
12
14
  echo "* Generating HTML index..."
13
- ~/bin/tvlistings_index
15
+ ${BIN}/create_index.rb
14
16
 
15
17
  echo
@@ -0,0 +1,106 @@
1
+ ######################################################################
2
+ ###
3
+ ### Auto-generated by create_rc
4
+ ###
5
+ ### Edit this file to suit your needs and then copy it somewhere.
6
+ ### Then use xmltv2html.rb --config-file=FILE
7
+ ###
8
+ ### Note that this file is actually Ruby code.
9
+ ###
10
+ ######################################################################
11
+
12
+ ### BEGIN CONFIGURATION
13
+ #
14
+
15
+ # Will output info to STDERR
16
+ @verbose = true
17
+
18
+ # Number of channels to repeat times horizontally; 0 to disable
19
+ @times_interval = 5
20
+
21
+ # Number of hours to repeat channels vertically; 0 to disable
22
+ @channels_interval = 4
23
+
24
+ # true = 12 hour format; false = 24 hour format
25
+ @time_format_12 = true
26
+
27
+ # Use channel favorites?
28
+ @use_favorites = true
29
+
30
+ # List favorite channels below (seperate by a ',')
31
+ # The titles must be exact, not regular expressions.
32
+ @favorite_list =
33
+ [
34
+ "CSI: Crime Scene Investigation", "Law & Order: Special Victims Unit", "Law & Order", "Law & Order: Criminal Intent", "Charmed", "The West Wing", "Desperate Housewives"
35
+ ]
36
+
37
+ # Name of CSS file
38
+ @css_filename = 'xmltv2html.css'
39
+
40
+ # Categories - use specified CSS class for given category.
41
+ # You must give the exact category for this to match. Look
42
+ # at the xml data file for a list of categories.
43
+ # Put the corresponding CSS class in your .css file
44
+ # .sports-event
45
+ # {
46
+ # color: red;
47
+ # background-color: white;
48
+ # }
49
+ @categories = {
50
+ "Sports event" => "sports-event",
51
+ "News" => "news"
52
+ }
53
+
54
+ # If true, will display date on the hour cell
55
+ # (helpful for multiple days).
56
+ # Color, etc in CSS file
57
+ @output_date_in_time = true
58
+
59
+ # The format to display the date
60
+ # %m = month (01..12); %d = day (01..31); %b = Abbr month (Jan)
61
+ # %a = Abbr weekday (Sun)
62
+ # @date_format = '%m-%d'
63
+ # @date_format = '%b %m-%d'
64
+ @date_format = '%a %d'
65
+
66
+ # Should the programme's description 'popup' on mouseover?
67
+ # This will enlarge the output by the size of all the programme's
68
+ # descriptions.
69
+ @use_programme_popup = true
70
+
71
+ # What method to use for popup? DHTML or STATUSBAR
72
+ # Some browsers disable pages from changing the statusbar.
73
+ @programme_popup_method = "DHTML" # "STATUSBAR"
74
+
75
+ # Title is the top line of popup; body is the below part.
76
+ # Define the popup: %T = title, %S = sub-title
77
+ # %D = description, %R = rating
78
+ # %P = previously-shown; will display (R)
79
+ # Example: @popup_title_format = "%T"
80
+ # Example: @popup_body_format = "%D<br />%R"
81
+ # DHTML: You can put *some* CSS/HTML stuff here as well...
82
+ # STATUSBAR: NO HTML
83
+ @popup_title_format = "%T"
84
+ @popup_body_format = "* %S %P<br />%D<br />Rating: %R"
85
+
86
+ # Attributes for the DHTML popup
87
+ @popup_title_color = "#FFFFFF"
88
+ @popup_title_font = "Bitstream Vera Sans" # "Utopia"
89
+ @popup_title_font_size = "4" # FONT SIZE=
90
+ @popup_title_background_color = "#000099"
91
+ @popup_body_color = "#000000"
92
+ @popup_body_font = "Bitstrea Vera Sans" # "Utopia"
93
+ @popup_body_font_size = "3" # FONT SIZE=
94
+ @popup_body_background_color = "#E8E8FF"
95
+ @popup_body_width = "350" # pixels
96
+
97
+ # xmltv and xmltv2html home page links
98
+ @output_links = true
99
+
100
+ # String for URL for prev and next page. Generally no need to
101
+ # set here; use --urlprev and --urlnext command line options to
102
+ # use in scripts that generate the HMTL pages.
103
+ @url_prev = nil
104
+ @url_next = nil
105
+ #
106
+ ### END CONFIGURATION
data/xmltv2htmlrc CHANGED
@@ -99,4 +99,7 @@
99
99
  # xmltv and xmltv2html home page links
100
100
  @output_links = true
101
101
 
102
+ @start_time = ""
103
+ @stop_time = ""
104
+
102
105
  ### END CONFIGURATION
metadata CHANGED
@@ -3,8 +3,8 @@ rubygems_version: 0.8.10
3
3
  specification_version: 1
4
4
  name: xmltv2html
5
5
  version: !ruby/object:Gem::Version
6
- version: 0.5.3
7
- date: 2005-07-03
6
+ version: 0.5.4
7
+ date: 2005-09-10
8
8
  summary: xmltv2html generates a HTML page from the output of XMLTV.
9
9
  require_paths:
10
10
  - lib
@@ -39,10 +39,11 @@ files:
39
39
  - xmltv2html.css
40
40
  - xmltv2htmlrc
41
41
  - contrib/README
42
- - contrib/kvh/generate_html
43
- - contrib/kvh/tvlistings
44
- - contrib/kvh/tvlistings_index
45
- - contrib/kvh/update-tvlistings
42
+ - contrib/kvh/create_index.rb
43
+ - contrib/kvh/tvlistings.sh
44
+ - contrib/kvh/xmltv2htmlrc
45
+ - contrib/kvh/generate_html.rb
46
+ - contrib/kvh/update-tvlistings.rb
46
47
  test_files: []
47
48
  rdoc_options: []
48
49
  extra_rdoc_files: []