xmltv2html 0.7.1 → 0.8.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/ChangeLog +8 -0
- data/bin/xmltv2html.rb +80 -6
- data/xmltv2htmlrc +7 -0
- metadata +2 -2
data/ChangeLog
CHANGED
@@ -1,4 +1,12 @@
|
|
1
1
|
------------------------------------------------------------------------
|
2
|
+
r192 | kvh | 2006-02-25 17:57:39 -0500 (Sat, 25 Feb 2006) | 1 line
|
3
|
+
Changed paths:
|
4
|
+
M /trunk/bin/xmltv2html.rb
|
5
|
+
M /trunk/xmltv2html.gemspec
|
6
|
+
M /trunk/xmltv2htmlrc
|
7
|
+
|
8
|
+
The programs' description can be search for any given string, such as actors names. The favorites' list is now case insensitive.
|
9
|
+
------------------------------------------------------------------------
|
2
10
|
r191 | kvh | 2006-02-19 17:01:20 -0500 (Sun, 19 Feb 2006) | 1 line
|
3
11
|
Changed paths:
|
4
12
|
M /trunk/bin/xmltv2html.rb
|
data/bin/xmltv2html.rb
CHANGED
@@ -4,7 +4,7 @@
|
|
4
4
|
#
|
5
5
|
# xmltv2html.rb - A Ruby script to transform the XMLTV output into HTML.
|
6
6
|
#
|
7
|
-
# Version : 0.
|
7
|
+
# Version : 0.8.0
|
8
8
|
# Author : Kurt V. Hindenburg <public@kurt.hindenburg.name>
|
9
9
|
#
|
10
10
|
# Copyright (C) 2003, 2004, 2005 Kurt V. Hindenburg
|
@@ -75,8 +75,8 @@ require 'time'
|
|
75
75
|
require 'set'
|
76
76
|
require 'ostruct'
|
77
77
|
|
78
|
-
XMLTV2HTML_VERSION="0.
|
79
|
-
XMLTV2HTML_DATE="Feb
|
78
|
+
XMLTV2HTML_VERSION="0.8.0"
|
79
|
+
XMLTV2HTML_DATE="Feb 26, 2006"
|
80
80
|
|
81
81
|
class Time
|
82
82
|
class << self
|
@@ -121,8 +121,16 @@ module XMLTV2HTML
|
|
121
121
|
read_conf if @@options[:use_config_file]
|
122
122
|
parse_command_line_options
|
123
123
|
|
124
|
+
# Downcase description search list for ease
|
125
|
+
@@options[:desc_search_list].each { |l|
|
126
|
+
l.downcase!
|
127
|
+
}
|
128
|
+
@@options[:favorites_list].each { |l|
|
129
|
+
l.downcase!
|
130
|
+
}
|
124
131
|
# convert favorites_list to Set for faster lookup
|
125
132
|
@@options[:favorites] = Set.new @@options[:favorites_list]
|
133
|
+
|
126
134
|
end
|
127
135
|
|
128
136
|
# Don't edit these, use an external xmltv2htmlrc file.
|
@@ -136,6 +144,8 @@ module XMLTV2HTML
|
|
136
144
|
:output_favorites => false,
|
137
145
|
:favorites_list => [],
|
138
146
|
:favorites_sort_by_date => true,
|
147
|
+
:desc_search_list => [],
|
148
|
+
:desc_search_sort_by_date => true,
|
139
149
|
:css_filename => 'xmltv2html.css',
|
140
150
|
:categories => {},
|
141
151
|
:output_date_in_time => false,
|
@@ -614,6 +624,7 @@ class XmlTV
|
|
614
624
|
attr_reader :HTML_title # Title of HTML page
|
615
625
|
attr_reader :top_title # Title of HTML page
|
616
626
|
attr_accessor(:firstShowStartDate, :lastShowStartDate, :lastShowStopDate)
|
627
|
+
attr_reader :desc_match_list
|
617
628
|
|
618
629
|
def initialize
|
619
630
|
@firstShowStartDate = "99999999999999"
|
@@ -831,6 +842,24 @@ class XmlTV
|
|
831
842
|
}
|
832
843
|
}
|
833
844
|
end
|
845
|
+
|
846
|
+
def searchProgrammesDesc
|
847
|
+
@desc_match_list = []
|
848
|
+
|
849
|
+
channels = Channels.instance
|
850
|
+
|
851
|
+
channels.each { |id, c|
|
852
|
+
programmes = c.programmes
|
853
|
+
|
854
|
+
programmes.each { | id, p|
|
855
|
+
p.each { |programme|
|
856
|
+
@@options[:desc_search_list].each { |s|
|
857
|
+
@desc_match_list << programme if programme.desc.downcase.include?(s)
|
858
|
+
}
|
859
|
+
}
|
860
|
+
}
|
861
|
+
}
|
862
|
+
end
|
834
863
|
|
835
864
|
end
|
836
865
|
|
@@ -868,6 +897,8 @@ class XMLTV2HTML2
|
|
868
897
|
|
869
898
|
@xml.setTitle(@dates)
|
870
899
|
|
900
|
+
@xml.searchProgrammesDesc
|
901
|
+
|
871
902
|
end
|
872
903
|
|
873
904
|
def generatePopups
|
@@ -923,8 +954,7 @@ class XMLTV2HTML2
|
|
923
954
|
end
|
924
955
|
|
925
956
|
@out.outputProgramme(prog, sindex, span)
|
926
|
-
if @@options[:use_favorites] and @@options[:output_favorites] and @@options[:favorites].include?(prog.title)
|
927
|
-
#$stderr.print "found a fav #{prog.title}\n"
|
957
|
+
if @@options[:use_favorites] and @@options[:output_favorites] and @@options[:favorites].include?(prog.title.downcase)
|
928
958
|
favorites_list << prog
|
929
959
|
end
|
930
960
|
when "Q" # Use previous Programme's info
|
@@ -954,6 +984,8 @@ class XMLTV2HTML2
|
|
954
984
|
|
955
985
|
@out.output_favorites_list(favorites_list) if not favorites_list.empty?
|
956
986
|
|
987
|
+
@out.output_desc_matches(@xml.desc_match_list) if not @xml.desc_match_list.empty?
|
988
|
+
|
957
989
|
@out.text_after_table
|
958
990
|
@out.footer
|
959
991
|
end
|
@@ -1212,7 +1244,7 @@ class Html
|
|
1212
1244
|
end
|
1213
1245
|
|
1214
1246
|
# Favorites override category.
|
1215
|
-
if @@options[:use_favorites] and @@options[:favorites].include?(s.title)
|
1247
|
+
if @@options[:use_favorites] and @@options[:favorites].include?(s.title.downcase)
|
1216
1248
|
print 'favorite">'
|
1217
1249
|
elsif s.category
|
1218
1250
|
print s.category,'">'
|
@@ -1284,6 +1316,48 @@ class Html
|
|
1284
1316
|
print '</table>'; nl
|
1285
1317
|
end
|
1286
1318
|
|
1319
|
+
def output_desc_matches(list)
|
1320
|
+
if @@options[:desc_search_sort_by_date]
|
1321
|
+
list = list.sort! { |a, b| a.startTime<=>b.startTime }
|
1322
|
+
else
|
1323
|
+
list = list.sort! { |a, b| a.title<=>b.title }
|
1324
|
+
end
|
1325
|
+
|
1326
|
+
print '<br><br>'; nl
|
1327
|
+
print '<table width="100%" border="3" cellpadding="3">'; nl
|
1328
|
+
print '<tr><td colspan="4" align="center">Description Search Matches</td></tr>'; nl
|
1329
|
+
print '<tr><td width="15%" align="center" nowrap>Channel</td>';
|
1330
|
+
print '<td width="45%" align="center" nowrap>Title</td>';
|
1331
|
+
print '<td width="20%" align="center">Start</td>';
|
1332
|
+
print '<td width="20%" align="center">Stop</td>';
|
1333
|
+
print '</tr>'; nl
|
1334
|
+
|
1335
|
+
channels = Channels.instance
|
1336
|
+
|
1337
|
+
list.each { |p|
|
1338
|
+
print '<tr>'; nl
|
1339
|
+
|
1340
|
+
print '<td class="channel">'; nl
|
1341
|
+
print channels[p.channelid].fullname
|
1342
|
+
print '</td>'; nl
|
1343
|
+
|
1344
|
+
outputProgramme(p, p.popupIndex, 1)
|
1345
|
+
|
1346
|
+
print '<td align="center">'; nl
|
1347
|
+
print p.startTime.strftime("%a %b %d %I:%M %p")
|
1348
|
+
print '</td>'; nl
|
1349
|
+
|
1350
|
+
print '<td align="center">'; nl
|
1351
|
+
print p.stopTime.strftime("%a %b %d %I:%M %p")
|
1352
|
+
print '</td>'; nl
|
1353
|
+
|
1354
|
+
print '</tr>'; nl
|
1355
|
+
}
|
1356
|
+
|
1357
|
+
print '</table>'; nl
|
1358
|
+
|
1359
|
+
end
|
1360
|
+
|
1287
1361
|
def outputInfo
|
1288
1362
|
print '<br>'
|
1289
1363
|
print '<span class="info">'
|
data/xmltv2htmlrc
CHANGED
@@ -31,6 +31,13 @@
|
|
31
31
|
# If true, sort favorite list by programme's start time (else by title)
|
32
32
|
#:favorites_sort_by_date: true
|
33
33
|
|
34
|
+
# List of strings to serach each program's description for.
|
35
|
+
#:desc_search_list: []
|
36
|
+
#Example :desc_search_list: [ "jessica alba", "Scarlett Johansson" ]
|
37
|
+
|
38
|
+
# If true, sort desc matches by programme's start time (else by title)
|
39
|
+
#:desc_search_sort_by_date: true
|
40
|
+
|
34
41
|
# Name of CSS file
|
35
42
|
#:css_filename: 'xmltv2html.css'
|
36
43
|
|
metadata
CHANGED
@@ -3,8 +3,8 @@ rubygems_version: 0.8.11
|
|
3
3
|
specification_version: 1
|
4
4
|
name: xmltv2html
|
5
5
|
version: !ruby/object:Gem::Version
|
6
|
-
version: 0.
|
7
|
-
date: 2006-02-
|
6
|
+
version: 0.8.0
|
7
|
+
date: 2006-02-25 00:00:00 -05:00
|
8
8
|
summary: xmltv2html generates a HTML page from the output of XMLTV.
|
9
9
|
require_paths:
|
10
10
|
- lib
|