xmltv2html 0.5.5 → 0.6.0
Sign up to get free protection for your applications and to get access to all the features.
- data/ChangeLog +113 -0
- data/README +5 -4
- data/bin/xmltv2html.rb +282 -328
- data/xmltv2htmlrc +43 -47
- metadata +34 -43
data/ChangeLog
CHANGED
@@ -1,4 +1,117 @@
|
|
1
1
|
------------------------------------------------------------------------
|
2
|
+
r161 | kvh | 2005-12-17 17:49:07 -0500 (Sat, 17 Dec 2005) | 1 line
|
3
|
+
Changed paths:
|
4
|
+
M /trunk/INSTALL
|
5
|
+
|
6
|
+
minor corrections
|
7
|
+
------------------------------------------------------------------------
|
8
|
+
r160 | kvh | 2005-12-17 17:48:08 -0500 (Sat, 17 Dec 2005) | 1 line
|
9
|
+
Changed paths:
|
10
|
+
M /trunk/setup.rb
|
11
|
+
|
12
|
+
update setup.rb to v3.4.1
|
13
|
+
------------------------------------------------------------------------
|
14
|
+
r159 | kvh | 2005-12-17 17:36:40 -0500 (Sat, 17 Dec 2005) | 1 line
|
15
|
+
Changed paths:
|
16
|
+
M /trunk/bin/xmltv2html.rb
|
17
|
+
M /trunk/xmltv2htmlrc
|
18
|
+
|
19
|
+
check for old xmltv2htmlrc format
|
20
|
+
------------------------------------------------------------------------
|
21
|
+
r158 | kvh | 2005-12-17 17:06:48 -0500 (Sat, 17 Dec 2005) | 1 line
|
22
|
+
Changed paths:
|
23
|
+
M /trunk/make_distribution_files
|
24
|
+
|
25
|
+
stop creating tar.bz2, no longer autocreate xmltv2htmlrc
|
26
|
+
------------------------------------------------------------------------
|
27
|
+
r157 | kvh | 2005-12-17 17:06:14 -0500 (Sat, 17 Dec 2005) | 1 line
|
28
|
+
Changed paths:
|
29
|
+
M /trunk/xmltv2html.gemspec
|
30
|
+
|
31
|
+
update gem specs
|
32
|
+
------------------------------------------------------------------------
|
33
|
+
r156 | kvh | 2005-12-17 17:05:20 -0500 (Sat, 17 Dec 2005) | 1 line
|
34
|
+
Changed paths:
|
35
|
+
M /trunk/INSTALL
|
36
|
+
M /trunk/README
|
37
|
+
|
38
|
+
update docs
|
39
|
+
------------------------------------------------------------------------
|
40
|
+
r155 | kvh | 2005-12-17 17:05:01 -0500 (Sat, 17 Dec 2005) | 1 line
|
41
|
+
Changed paths:
|
42
|
+
M /trunk/xmltv2htmlrc
|
43
|
+
|
44
|
+
comment out defaults
|
45
|
+
------------------------------------------------------------------------
|
46
|
+
r154 | kvh | 2005-12-16 13:43:30 -0500 (Fri, 16 Dec 2005) | 1 line
|
47
|
+
Changed paths:
|
48
|
+
M /trunk/bin/xmltv2html.rb
|
49
|
+
|
50
|
+
set release date
|
51
|
+
------------------------------------------------------------------------
|
52
|
+
r153 | kvh | 2005-12-16 13:43:07 -0500 (Fri, 16 Dec 2005) | 1 line
|
53
|
+
Changed paths:
|
54
|
+
M /trunk/xmltv2htmlrc
|
55
|
+
|
56
|
+
comment out defaults
|
57
|
+
------------------------------------------------------------------------
|
58
|
+
r152 | kvh | 2005-12-16 13:31:49 -0500 (Fri, 16 Dec 2005) | 1 line
|
59
|
+
Changed paths:
|
60
|
+
M /trunk/bin/xmltv2html.rb
|
61
|
+
|
62
|
+
add trap to catch CTRL-C, fix DHTML
|
63
|
+
------------------------------------------------------------------------
|
64
|
+
r151 | kvh | 2005-12-16 12:20:31 -0500 (Fri, 16 Dec 2005) | 1 line
|
65
|
+
Changed paths:
|
66
|
+
M /trunk/bin/xmltv2html.rb
|
67
|
+
|
68
|
+
ignore programes < 10 minutes
|
69
|
+
------------------------------------------------------------------------
|
70
|
+
r150 | kvh | 2005-12-15 00:55:30 -0500 (Thu, 15 Dec 2005) | 1 line
|
71
|
+
Changed paths:
|
72
|
+
M /trunk/bin/xmltv2html.rb
|
73
|
+
|
74
|
+
fix command line issues
|
75
|
+
------------------------------------------------------------------------
|
76
|
+
r149 | kvh | 2005-12-12 13:49:35 -0500 (Mon, 12 Dec 2005) | 1 line
|
77
|
+
Changed paths:
|
78
|
+
M /trunk/bin/xmltv2html.rb
|
79
|
+
|
80
|
+
remove old code
|
81
|
+
------------------------------------------------------------------------
|
82
|
+
r148 | kvh | 2005-12-12 12:59:34 -0500 (Mon, 12 Dec 2005) | 1 line
|
83
|
+
Changed paths:
|
84
|
+
M /trunk/bin/xmltv2html.rb
|
85
|
+
|
86
|
+
command line options work; remove old config code
|
87
|
+
------------------------------------------------------------------------
|
88
|
+
r147 | kvh | 2005-12-12 12:44:07 -0500 (Mon, 12 Dec 2005) | 1 line
|
89
|
+
Changed paths:
|
90
|
+
M /trunk/bin/xmltv2html.rb
|
91
|
+
M /trunk/xmltv2htmlrc
|
92
|
+
|
93
|
+
yaml config file almost complete
|
94
|
+
------------------------------------------------------------------------
|
95
|
+
r146 | kvh | 2005-12-12 02:44:26 -0500 (Mon, 12 Dec 2005) | 1 line
|
96
|
+
Changed paths:
|
97
|
+
M /trunk/bin/xmltv2html.rb
|
98
|
+
|
99
|
+
use Set for favorites
|
100
|
+
------------------------------------------------------------------------
|
101
|
+
r145 | kvh | 2005-12-12 01:08:47 -0500 (Mon, 12 Dec 2005) | 1 line
|
102
|
+
Changed paths:
|
103
|
+
M /trunk/bin/xmltv2html.rb
|
104
|
+
|
105
|
+
Make module; move to yaml config file
|
106
|
+
------------------------------------------------------------------------
|
107
|
+
r144 | kvh | 2005-09-16 17:24:41 -0500 (Fri, 16 Sep 2005) | 1 line
|
108
|
+
Changed paths:
|
109
|
+
M /trunk/make_distribution_files
|
110
|
+
M /trunk/xmltv2html.gemspec
|
111
|
+
M /trunk/xmltv2htmlrc
|
112
|
+
|
113
|
+
update version/options
|
114
|
+
------------------------------------------------------------------------
|
2
115
|
r143 | kvh | 2005-09-16 17:21:44 -0500 (Fri, 16 Sep 2005) | 1 line
|
3
116
|
Changed paths:
|
4
117
|
M /trunk/bin/xmltv2html.rb
|
data/README
CHANGED
@@ -7,12 +7,11 @@ xmltv2html is a Ruby script that transforms the output of XMLTV into HTML.
|
|
7
7
|
This is different from other XMLTV -> HTML programs in that the times
|
8
8
|
are on the horizontal axis and the channels on the vertical axis.
|
9
9
|
|
10
|
-
http://
|
10
|
+
HOMEPAGE: http://xmltv2html.rubyforge.org/
|
11
11
|
|
12
12
|
XMLTV : http://sourceforge.net/projects/xmltv
|
13
13
|
RUBY : http://www.ruby-lang.org/en/
|
14
|
-
|
15
|
-
|
14
|
+
With version 1.8.3+, Ruby includes rexml.
|
16
15
|
|
17
16
|
INSTALLATION
|
18
17
|
------------
|
@@ -26,8 +25,10 @@ USAGE
|
|
26
25
|
% xmltv2html.rb < xmltv-output.xml > listing.html
|
27
26
|
% xmltv2html.rb --help
|
28
27
|
|
29
|
-
Please see the man page or HTML documentation for more details.
|
30
28
|
|
29
|
+
AUTHOR
|
30
|
+
------
|
31
|
+
Kurt V. Hindenburg (khindenburg@rubyforge.org)
|
31
32
|
|
32
33
|
LICENCE
|
33
34
|
-------
|
data/bin/xmltv2html.rb
CHANGED
@@ -1,8 +1,9 @@
|
|
1
|
-
#!/usr/bin/ruby
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
#!/usr/bin/ruby -w # With Ruby 1.8.3, yaml gives a lot of warnings... :-((
|
2
3
|
#
|
3
|
-
# xmltv2html.rb - A Ruby script to
|
4
|
+
# xmltv2html.rb - A Ruby script to transform the XMLTV output into HTML.
|
4
5
|
#
|
5
|
-
# Version : 0.
|
6
|
+
# Version : 0.6.0
|
6
7
|
# Author : Kurt V. Hindenburg <public@kurt.hindenburg.name>
|
7
8
|
#
|
8
9
|
# Copyright (C) 2003, 2004, 2005 Kurt V. Hindenburg
|
@@ -68,229 +69,207 @@ Written by Kurt V. Hindenburg <public@kurt.hindenburg.name>
|
|
68
69
|
|
69
70
|
=end
|
70
71
|
|
71
|
-
require
|
72
|
-
require
|
72
|
+
require 'optparse'
|
73
|
+
require 'yaml'
|
74
|
+
require 'rexml/document'
|
73
75
|
require 'singleton'
|
74
76
|
require 'time'
|
77
|
+
require 'set'
|
75
78
|
|
76
|
-
XMLTV2HTML_VERSION="0.5.5"
|
77
|
-
XMLTV2HTML_DATE="Sep 17, 2005"
|
78
79
|
|
79
|
-
|
80
|
+
XMLTV2HTML_VERSION="0.6.0"
|
81
|
+
XMLTV2HTML_DATE="Dec 18, 2005"
|
80
82
|
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
end
|
83
|
+
class Time
|
84
|
+
class << self
|
85
|
+
### Time.<method>
|
85
86
|
|
86
|
-
|
87
|
-
|
87
|
+
# time string in format 'yyyymmddhhmmss (+/-xxxx)'
|
88
|
+
def parse_xmltv_time(str)
|
89
|
+
begin
|
90
|
+
Time::parse(str.split(' ')[0])
|
91
|
+
rescue ArgumentError
|
92
|
+
die "Unable to parse #{str}\n\n"
|
93
|
+
end
|
94
|
+
end
|
88
95
|
end
|
89
96
|
|
97
|
+
### object.<method>
|
98
|
+
|
99
|
+
def round_to_interval
|
100
|
+
self - (self.min % @@options['time_divisor']) * 60
|
101
|
+
end
|
90
102
|
|
91
103
|
end
|
92
104
|
|
105
|
+
module XMLTV2HTML
|
106
|
+
@@options = nil
|
93
107
|
|
94
|
-
|
95
|
-
def die(*args)
|
96
|
-
$stderr.print args
|
97
|
-
exit(1)
|
98
|
-
end
|
99
108
|
def info(*args)
|
100
109
|
$stderr.print args, "\n"
|
101
110
|
end
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
attr_reader(:times_interval, :channels_interval, :time_format_12)
|
106
|
-
attr_reader(:use_config_file, :verbose, :output_links)
|
107
|
-
attr_reader(:date_format, :categories)
|
108
|
-
attr_reader(:use_favorites, :favorites)
|
109
|
-
attr_reader(:output_date_in_time, :css_filename)
|
110
|
-
attr_reader(:use_programme_popup, :programme_popup_method)
|
111
|
-
attr_reader(:popup_title_format, :popup_body_format)
|
112
|
-
attr_reader(:popup_title_background_color, :popup_title_color)
|
113
|
-
attr_reader(:popup_title_font_size, :popup_body_font_size)
|
114
|
-
attr_reader(:popup_body_background_color, :popup_body_color)
|
115
|
-
attr_reader(:popup_body_width)
|
116
|
-
attr_reader(:popup_title_font, :popup_body_font)
|
117
|
-
attr_reader(:time_divisor)
|
118
|
-
attr_accessor(:start_date, :stop_date)
|
119
|
-
attr_accessor(:days, :total_hours, :total_span)
|
120
|
-
attr_accessor(:url_next, :url_prev)
|
121
|
-
attr_accessor(:start_time, :stop_time)
|
122
|
-
attr_accessor(:output_favorites)
|
123
|
-
|
124
|
-
def initialize
|
125
|
-
@opts = {}
|
126
|
-
@keys = %w{ times_interval chanels_interval time_format_12 }
|
127
|
-
@favorites = Hash.new
|
128
|
-
@use_config_file = true
|
129
|
-
@config_file="xmltv2htmlrc"
|
130
|
-
@total_hours = 0
|
131
|
-
@total_span = 0
|
132
|
-
@time_divisor = 10; # Divide programmes' times in X minute slots
|
133
|
-
@url_prev = nil
|
134
|
-
@url_next = nil
|
135
|
-
|
136
|
-
setDefaults
|
137
|
-
handleOpts
|
138
|
-
readConfigFile if @config_file and @use_config_file
|
139
|
-
|
140
|
-
# Convert favorite_list to Hash for fast lookup.
|
141
|
-
@favorite_list.each { |f|
|
142
|
-
f.gsub!(/&/,'&')
|
143
|
-
@favorites[f] = true
|
144
|
-
}
|
145
|
-
@days = 1
|
111
|
+
def die(*args)
|
112
|
+
info args
|
113
|
+
exit(1)
|
146
114
|
end
|
147
115
|
|
148
|
-
def
|
149
|
-
|
150
|
-
|
151
|
-
|
152
|
-
|
153
|
-
|
154
|
-
|
155
|
-
|
156
|
-
@times_interval = 4
|
157
|
-
|
158
|
-
# Number of hours to repeat channels vertically; 0 to disable
|
159
|
-
@channels_interval = 4
|
160
|
-
|
161
|
-
# true = 12 hour format; false = 24 hour format
|
162
|
-
@time_format_12 = true
|
163
|
-
|
164
|
-
# Use channel favorites?
|
165
|
-
@use_favorites = true
|
166
|
-
|
167
|
-
# List favorite channels below (seperate by a ',')
|
168
|
-
# The titles must be exact, not regular expressions.
|
169
|
-
@favorite_list = [
|
170
|
-
"CSI: Crime Scene Investigation",
|
171
|
-
"Law & Order: Special Victims Unit", "Angel", "Law & Order",
|
172
|
-
"The Shield", "Law & Order: Criminal Intent",
|
173
|
-
"Charmed", "The West Wing"
|
174
|
-
]
|
175
|
-
# Print out list of favorites beneath the listings?
|
176
|
-
@output_favorites = false
|
177
|
-
|
178
|
-
# Name of CSS file
|
179
|
-
@css_filename = 'xmltv2html.css'
|
180
|
-
|
181
|
-
# Categories - use specified CSS class for given category.
|
182
|
-
# You must give the exact category for this to match. Look
|
183
|
-
# at the xml data file for a list of categories.
|
184
|
-
# Put the corresponding CSS class in your .css file
|
185
|
-
# .sports-event
|
186
|
-
# {
|
187
|
-
# color: red;
|
188
|
-
# background-color: white;
|
189
|
-
# }
|
190
|
-
@categories = {
|
191
|
-
"Sports event" => "sports-event",
|
192
|
-
"News" => "news"
|
193
|
-
}
|
194
|
-
|
195
|
-
# If true, will display date on the hour cell
|
196
|
-
# (helpful for multiple days).
|
197
|
-
# Color, etc in CSS file
|
198
|
-
@output_date_in_time = true
|
199
|
-
|
200
|
-
# The format to display the date
|
201
|
-
# %m = month (01..12); %d = day (01..31); %b = Abbr month (Jan)
|
202
|
-
# %a = Abbr weekday (Sun)
|
203
|
-
# @date_format = '%m-%d'
|
204
|
-
# @date_format = '%b %m-%d'
|
205
|
-
@date_format = '%a %d'
|
206
|
-
|
207
|
-
# Should the programme's description 'popup' on mouseover?
|
208
|
-
# This will enlarge the output by the size of all the programme's
|
209
|
-
# descriptions.
|
210
|
-
@use_programme_popup = true
|
211
|
-
|
212
|
-
# What method to use for popup? DHTML or STATUSBAR
|
213
|
-
# Some browsers disable pages from changing the statusbar.
|
214
|
-
@programme_popup_method = "DHTML" # "STATUSBAR"
|
215
|
-
|
216
|
-
# Title is the top line of popup; body is the below part.
|
217
|
-
# Define the popup: %T = title, %S = sub-title
|
218
|
-
# %D = description, %R = rating
|
219
|
-
# %P = previously-shown; will display (R)
|
220
|
-
# Example: @popup_title_format = "%T"
|
221
|
-
# Example: @popup_body_format = "%D<br />%R"
|
222
|
-
# DHTML: You can put *some* CSS/HTML stuff here as well...
|
223
|
-
# STATUSBAR: NO HTML
|
224
|
-
@popup_title_format = "%T"
|
225
|
-
@popup_body_format = "%S %P<br />%D<br />Rating: %R"
|
226
|
-
|
227
|
-
# Attributes for the DHTML popup
|
228
|
-
@popup_title_color = "#FFFFFF"
|
229
|
-
@popup_title_font = "" # "Utopia"
|
230
|
-
@popup_title_font_size = "2" # FONT SIZE=
|
231
|
-
@popup_title_background_color = "#000099"
|
232
|
-
@popup_body_color = "#000000"
|
233
|
-
@popup_body_font = "" # "Utopia"
|
234
|
-
@popup_body_font_size = "1" # FONT SIZE=
|
235
|
-
@popup_body_background_color = "#E8E8FF"
|
236
|
-
@popup_body_width = "200" # pixels
|
237
|
-
|
238
|
-
# xmltv and xmltv2html home page links
|
239
|
-
@output_links = true
|
240
|
-
|
241
|
-
@start_time = ""
|
242
|
-
@stop_time = ""
|
243
|
-
|
244
|
-
### END CONFIGURATION
|
116
|
+
def test
|
117
|
+
# info "The West Wing=", @@options['favorites'].include?('The West Wing')
|
118
|
+
# info "EXTRA=", @@options['favorites'].include?('EXTRA')
|
119
|
+
# info "Lay & Order=", @@options['favorites'].include?("Law & Order")
|
120
|
+
# info "Categories=", @@options['categories'].class
|
121
|
+
# info "Categories=", @@options['categories']
|
122
|
+
# info "start_time=",@@options['start_time']
|
123
|
+
# info "stop_time=",@@options['stop_time']
|
245
124
|
end
|
246
125
|
|
247
|
-
|
248
|
-
|
249
|
-
|
250
|
-
|
251
|
-
|
252
|
-
|
253
|
-
|
254
|
-
|
255
|
-
|
256
|
-
|
126
|
+
class ConfReader
|
127
|
+
def initialize
|
128
|
+
@@options = self # set Module variable
|
129
|
+
@cmd_line_options = nil
|
130
|
+
clear
|
131
|
+
set_defaults
|
132
|
+
# info "default config_file=",@@options['config_file']
|
133
|
+
parse_command_line_options_for_config_file
|
134
|
+
# info "cmd_line config_file=",@@options['config_file']
|
135
|
+
# info "cmd_line start_time=",@@options['start_time']
|
136
|
+
# info "cmd_line stop_time=",@@options['stop_time']
|
137
|
+
|
138
|
+
|
139
|
+
read_conf if @@options['use_config_file']
|
140
|
+
# info "start_time=",@@options['start_time']
|
141
|
+
# info "stop_time=",@@options['stop_time']
|
142
|
+
parse_command_line_options
|
143
|
+
# info "start_time=",@@options['start_time']
|
144
|
+
# info "stop_time=",@@options['stop_time']
|
145
|
+
# info "config_file=",@@options['config_file']
|
146
|
+
|
147
|
+
# convert favorites_list to Set for faster lookup
|
148
|
+
@@options['favorites'] = Set.new @@options['favorites_list' ]
|
149
|
+
|
150
|
+
test
|
257
151
|
end
|
258
|
-
end
|
259
|
-
|
260
|
-
def handleOpts
|
261
|
-
|
262
|
-
ARGV.options do
|
263
|
-
|opts|
|
264
|
-
opts.banner = "Usage: #{File.basename($0)} < xmltv.xml > tv.html\n"
|
265
152
|
|
266
|
-
|
267
|
-
|
268
|
-
|
153
|
+
# Don't edit these, use an external xmltv2htmlrc file.
|
154
|
+
def set_defaults
|
155
|
+
@tree = {
|
156
|
+
'verbose' => false,
|
157
|
+
'times_interval' => 4,
|
158
|
+
'channels_interval' => 4,
|
159
|
+
'time_format_12' => true,
|
160
|
+
'use_favorites' => false,
|
161
|
+
'output_favorites' => false,
|
162
|
+
'favorites_list' => [],
|
163
|
+
'css_filename' => 'xmltv2html.css',
|
164
|
+
'categories' => {},
|
165
|
+
'output_date_in_time' => false,
|
166
|
+
'date_format' => '%a %d',
|
167
|
+
'use_programme_popup' => true,
|
168
|
+
'programme_popup_method' => "DHTML",
|
169
|
+
'popup_title_format' => "%T",
|
170
|
+
'popup_body_format' => "%S %P<br />%D<br />Rating: %R",
|
171
|
+
'popup_title_color' => "#FFFFFF",
|
172
|
+
'popup_title_font' => "",
|
173
|
+
'popup_title_font_size' => "2",
|
174
|
+
'popup_title_background_color' => "#000099",
|
175
|
+
'popup_body_color' => "#000000",
|
176
|
+
'popup_body_font' => "",
|
177
|
+
'popup_body_font_size' => "1",
|
178
|
+
'popup_body_background_color' => "#E8E8FF",
|
179
|
+
'popup_body_width' => "200",
|
180
|
+
'output_links' => false,
|
181
|
+
'start_time' => "",
|
182
|
+
'stop_time' => "",
|
183
|
+
'start_date' => "",
|
184
|
+
'stop_date' => "",
|
185
|
+
'time_divisor' => 10, # Divide programmes' times in X minute slots
|
186
|
+
'total_hours' => 0,
|
187
|
+
'config_file' => "",
|
188
|
+
'use_config_file' => true,
|
189
|
+
}
|
190
|
+
end
|
269
191
|
|
270
|
-
|
271
|
-
|
272
|
-
|
273
|
-
@use_config_file = false}
|
192
|
+
def [](key)
|
193
|
+
@tree[key]
|
194
|
+
end
|
274
195
|
|
275
|
-
|
276
|
-
|
196
|
+
def []=(key, value)
|
197
|
+
@tree[key] = value
|
198
|
+
end
|
277
199
|
|
278
|
-
|
279
|
-
|
200
|
+
def clear
|
201
|
+
@tree = Hash.new
|
202
|
+
end
|
280
203
|
|
281
|
-
|
282
|
-
|
204
|
+
def read_conf
|
205
|
+
return if @@options['config_file'].empty?
|
206
|
+
f=File.expand_path(@@options['config_file'])
|
207
|
+
if not File.exists?(f) or not File.stat(f).readable_real?
|
208
|
+
info "* Unable to read #{f}\n"
|
209
|
+
return
|
210
|
+
end
|
211
|
+
new_xmltv2htmlrc_format = false
|
212
|
+
File.open(f, "r") do |aFile|
|
213
|
+
first_line = aFile.gets
|
214
|
+
new_xmltv2htmlrc_format = true if first_line =~ /^#config_version: 1/
|
215
|
+
end
|
216
|
+
if new_xmltv2htmlrc_format == false
|
217
|
+
info "\nWhoa! You are using an old xmltv2htmlrc format file (v0.5.x)."
|
218
|
+
info "Please update your xmltv2htmlrc using the sample file provided"
|
219
|
+
info "with xmltv2html-0.6.0+."
|
220
|
+
die "\n"
|
221
|
+
end
|
222
|
+
info "^ Reading #{f}\n"
|
223
|
+
@tree.merge!(YAML::load(File.open(f)))
|
224
|
+
end
|
283
225
|
|
284
|
-
|
226
|
+
# Check to see if --configfile= is present.
|
227
|
+
# TODO: Should be a way to do with with OptionParser
|
228
|
+
def parse_command_line_options_for_config_file
|
229
|
+
ARGV.each do
|
230
|
+
|opts|
|
231
|
+
if opts =~ /--configfile=/
|
232
|
+
@@options['config_file'] = opts.split(/=/)[1]
|
233
|
+
end
|
234
|
+
end
|
235
|
+
end
|
285
236
|
|
286
|
-
|
287
|
-
|
288
|
-
|
289
|
-
|
290
|
-
|
291
|
-
|
292
|
-
|
293
|
-
|
237
|
+
# TODO: This has to be a better way to do this...
|
238
|
+
def parse_command_line_options
|
239
|
+
ARGV.options do
|
240
|
+
|opts|
|
241
|
+
opts.banner = "Usage: #{File.basename($0)} < xmltv.xml > tv.html\n"
|
242
|
+
|
243
|
+
# separater
|
244
|
+
opts.on_tail
|
245
|
+
opts.on_tail("common options:")
|
246
|
+
|
247
|
+
opts.on("--configfile=FILE", String, "config file to use") {
|
248
|
+
|@@options['config_file']|}
|
249
|
+
|
250
|
+
opts.on("--starttime=YYYYMMDDHHMM", String, "Start time") {
|
251
|
+
|@@options['start_time']|}
|
252
|
+
opts.on("--stoptime=YYYYMMDDHHMM", String, "Stop time") {
|
253
|
+
|@@options['stop_time']|}
|
254
|
+
|
255
|
+
opts.on("--urlprev=URL", String, "URL for previous link") {
|
256
|
+
|@@options['url_prev']|}
|
257
|
+
opts.on("--urlnext=URL", String, "URL for next link") {
|
258
|
+
|@@options['url_next']|}
|
259
|
+
|
260
|
+
# no argument, shows at tail
|
261
|
+
opts.on_tail("-h", "--help", "show this message") {puts opts; exit}
|
262
|
+
|
263
|
+
opts.on_head("specific options:")
|
264
|
+
|
265
|
+
# no argument
|
266
|
+
opts.on_tail("-v", "--version", "show version") do
|
267
|
+
print <<EOF
|
268
|
+
xmltv2html.rb v#{XMLTV2HTML_VERSION} (#{XMLTV2HTML_DATE})\n
|
269
|
+
Copyright (C) 2003, 2004, 2005 Kurt V. Hindenburg (public@kurt.hindenburg.name)
|
270
|
+
This is free software; see the source for copying conditions. There is NO
|
271
|
+
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
272
|
+
EOF
|
294
273
|
exit
|
295
274
|
end
|
296
275
|
begin
|
@@ -301,32 +280,8 @@ class Config
|
|
301
280
|
end
|
302
281
|
end
|
303
282
|
|
304
|
-
end
|
305
|
-
|
306
|
-
class Time
|
307
|
-
|
308
|
-
class << self
|
309
|
-
### Time.<method>
|
310
|
-
|
311
|
-
# time string in format 'yyyymmddhhmmss (+/-xxxx)'
|
312
|
-
def parse_xmltv_time(str)
|
313
|
-
begin
|
314
|
-
Time.parse(str.split(' ')[0])
|
315
|
-
rescue ArgumentError
|
316
|
-
die "Unable to parse #{str}\n\n"
|
317
|
-
end
|
318
|
-
end
|
319
|
-
end
|
320
|
-
|
321
|
-
### object.<method>
|
322
|
-
|
323
|
-
# TODO: cache $params.time_divisor
|
324
|
-
def round_to_interval
|
325
|
-
self - (self.min % $params.time_divisor) * 60
|
326
283
|
end
|
327
284
|
|
328
|
-
end
|
329
|
-
|
330
285
|
class ProgrammeTime
|
331
286
|
attr_reader(:fullStartTime, :fullStopTime)
|
332
287
|
|
@@ -353,21 +308,21 @@ class ProgrammeTime
|
|
353
308
|
end
|
354
309
|
|
355
310
|
def calculateStartSlot
|
356
|
-
return if
|
357
|
-
@start_date = returnParsedTime(
|
311
|
+
return if @@options['start_date'] == nil # 1st pass
|
312
|
+
@start_date = returnParsedTime(@@options['start_date']) if not @start_date
|
358
313
|
|
359
314
|
start_diff_min = ((@fullStartTime - @start_date) / 60).to_i
|
360
315
|
# $stderr.print ", diff #{start_diff_min}"
|
361
|
-
start_slot = start_diff_min /
|
316
|
+
start_slot = start_diff_min / @@options['time_divisor']
|
362
317
|
# $stderr.print "starting slot #{start_slot}\n"
|
363
318
|
start_slot
|
364
319
|
end
|
365
320
|
def calculateStopSlot
|
366
|
-
return if
|
321
|
+
return if @@options['stop_date'] == nil # 1st pass
|
367
322
|
|
368
|
-
@start_date = returnParsedTime(
|
323
|
+
@start_date = returnParsedTime(@@options['start_date']) if not @start_date
|
369
324
|
stop_diff_min = ((@fullStopTime - @start_date) / 60).to_i
|
370
|
-
stop_slot = stop_diff_min /
|
325
|
+
stop_slot = stop_diff_min / @@options['time_divisor']
|
371
326
|
# $stderr.print " stoping slot #{stop_slot}\n"
|
372
327
|
|
373
328
|
# (@fullStopTime.hour * 60 / $timeDivisor) + (@fullStopTime.min / $timeDivisor)
|
@@ -380,11 +335,9 @@ class Programme
|
|
380
335
|
attr_reader :title, :subtitle, :span, :times, :desc, :rating, :category
|
381
336
|
attr_reader :previouslyShown, :spanSlots, :startSlot
|
382
337
|
attr_accessor :popupIndex
|
383
|
-
# attr_accessor :popupIndex
|
384
338
|
|
385
339
|
def initialize(title, subtitle, channel, start, stop, desc, rating, cats, rerun)
|
386
340
|
@title = title
|
387
|
-
@title.gsub!(/&/,'&')
|
388
341
|
@subtitle = subtitle
|
389
342
|
@channelid = channel
|
390
343
|
@desc = desc
|
@@ -407,14 +360,6 @@ class Programme
|
|
407
360
|
@spanSlots = @stopSlot - @startSlot
|
408
361
|
end
|
409
362
|
|
410
|
-
# def start_time
|
411
|
-
# @times.start_time
|
412
|
-
# end
|
413
|
-
|
414
|
-
# def stop_time
|
415
|
-
# @times.stop_time
|
416
|
-
# end
|
417
|
-
|
418
363
|
def to_s
|
419
364
|
@title
|
420
365
|
end
|
@@ -504,7 +449,7 @@ class Channel
|
|
504
449
|
end
|
505
450
|
|
506
451
|
def calculateSlots(slist)
|
507
|
-
tinterval =
|
452
|
+
tinterval = @@options['channels_interval'] * 60 / @@options['time_divisor']
|
508
453
|
left = []
|
509
454
|
right = slist.dup
|
510
455
|
index = 0
|
@@ -550,7 +495,7 @@ class Channel
|
|
550
495
|
end
|
551
496
|
|
552
497
|
# Create a slot list to account for displaying channel info
|
553
|
-
#
|
498
|
+
# channel_interval = # of hours to display channel info
|
554
499
|
# Handle empty programmes at start/end of channel.
|
555
500
|
def createSlotList
|
556
501
|
l = Array.new
|
@@ -558,8 +503,8 @@ class Channel
|
|
558
503
|
times_counter = 1
|
559
504
|
sindex = 0
|
560
505
|
total = 0
|
561
|
-
if
|
562
|
-
tinterval =
|
506
|
+
if @@options['channels_interval'] > 0
|
507
|
+
tinterval = @@options['channels_interval'] * 60 / @@options['time_divisor']
|
563
508
|
else
|
564
509
|
tinterval = 9999
|
565
510
|
end
|
@@ -579,7 +524,7 @@ class Channel
|
|
579
524
|
slist.push "P"+s.spanSlots.to_s
|
580
525
|
}
|
581
526
|
|
582
|
-
if
|
527
|
+
if @@options['channels_interval'] > 0
|
583
528
|
sl = calculateSlots(slist)
|
584
529
|
while sl != slist
|
585
530
|
slist = sl.dup
|
@@ -591,7 +536,7 @@ class Channel
|
|
591
536
|
span = entry.slice(1..-1).to_i
|
592
537
|
l.push entry
|
593
538
|
total += span
|
594
|
-
l.push("C0") if (total % tinterval) == 0 and
|
539
|
+
l.push("C0") if (total % tinterval) == 0 and @@options['channels_interval'] > 0
|
595
540
|
}
|
596
541
|
|
597
542
|
slist = l.unshift("C0") # Add left-most channel
|
@@ -602,7 +547,7 @@ class Channel
|
|
602
547
|
# $stderr.print slist[0, 3],"\n"
|
603
548
|
# $stderr.print l[0, 3],"\n"
|
604
549
|
|
605
|
-
dinterval =
|
550
|
+
dinterval = @@options['total_hours'] * 60 / @@options['time_divisor']
|
606
551
|
if total < dinterval # Not enough programmes' data at end
|
607
552
|
slist.push("D"+(dinterval - total).to_s)
|
608
553
|
slist.push("C0") if dinterval % tinterval == 0
|
@@ -701,7 +646,6 @@ class XmlTV
|
|
701
646
|
|
702
647
|
def parseProgrammes
|
703
648
|
channels = Channels.instance
|
704
|
-
|
705
649
|
@doc.elements.each("tv/programme") { |element|
|
706
650
|
title=""
|
707
651
|
subtitle=""
|
@@ -720,42 +664,47 @@ class XmlTV
|
|
720
664
|
dstop = stop[0..13]
|
721
665
|
ext = start[14..-1]
|
722
666
|
|
723
|
-
|
724
|
-
#
|
725
|
-
|
726
|
-
|
667
|
+
# info "start_time=",@@options['start_time']
|
668
|
+
# info "stop_time=",@@options['stop_time']
|
669
|
+
# info "empty?" ,@@options['start_time'].empty?
|
670
|
+
if not @@options['start_time'].empty?
|
671
|
+
nstart = @@options['start_time'].clone
|
672
|
+
nstart[10..11] = @@options['time_divisor'].to_s
|
727
673
|
|
728
674
|
# If programme ends before the desired start time...
|
729
675
|
# Adjust for the time_divisor (round_to_interval)
|
730
676
|
if dstop < nstart
|
677
|
+
# info "Delete programme - Desired start : #{@@options['start_time']}, "
|
731
678
|
# $stderr.print "Delete programme - Desired start : #{$params.start_time}, "
|
732
679
|
# $stderr.print "programme stop : #{dstop}\n"
|
733
680
|
# $stderr.print "Old start time = #{$params.start_time}, new=#{nstart}\n"
|
734
681
|
next
|
735
682
|
end
|
736
683
|
end
|
737
|
-
|
738
684
|
# If programme starts after the desired stop time...
|
739
|
-
if (not
|
685
|
+
if (not @@options['stop_time'].empty?) and (dstart >= @@options['stop_time'])
|
740
686
|
# $stderr.print "Delete programme - Desired stop : #{$params.stop_time}, "
|
741
687
|
# $stderr.print "programme start : #{dstart}\n"
|
688
|
+
# info "programme start : #{dstart}\n"
|
742
689
|
next
|
743
690
|
end
|
744
691
|
|
745
692
|
# If programme starts before the desired start time, change start
|
746
|
-
if (not
|
693
|
+
if (not @@options['start_time'].empty?) and (dstart < @@options['start_time'])
|
694
|
+
# info "Change Start - new start : "
|
747
695
|
# $stderr.print "Change Start - new start : #{$params.start_time}, "
|
748
696
|
# $stderr.print "old start: #{dstart}\n"
|
749
697
|
# ndesc = "(" + start[8..9] + ":" + start[10..11] + ") "
|
750
698
|
|
751
|
-
start =
|
699
|
+
start = @@options['start_time'] + ext
|
752
700
|
dstart = start[0..13]
|
753
701
|
end
|
754
702
|
|
755
703
|
|
756
704
|
# If programme ends after the desired stop time, change stop
|
757
|
-
if (not
|
758
|
-
stop =
|
705
|
+
if (not @@options['stop_time'].empty?) and (dstop > @@options['stop_time'])
|
706
|
+
stop = @@options['stop_time'] + ext
|
707
|
+
# info "Change Stop - new stopt : "
|
759
708
|
dstop = stop[0..13]
|
760
709
|
end
|
761
710
|
|
@@ -777,9 +726,8 @@ class XmlTV
|
|
777
726
|
# Check to see if user want to use special CSS class for category
|
778
727
|
# FIXME: What happens when more than 1 category is triggered?
|
779
728
|
if e.name == "category"
|
780
|
-
if
|
781
|
-
|
782
|
-
cats = $params.categories[e.text()];
|
729
|
+
if @@options['categories'].has_key?(e.text())
|
730
|
+
cats = @@options['categories'][e.text()];
|
783
731
|
end
|
784
732
|
end
|
785
733
|
}
|
@@ -809,7 +757,7 @@ class XmlTV
|
|
809
757
|
|
810
758
|
end
|
811
759
|
|
812
|
-
class
|
760
|
+
class XMLTV2HTML2
|
813
761
|
attr_accessor(:dates)
|
814
762
|
|
815
763
|
def initialize
|
@@ -825,34 +773,32 @@ class XMLTV2HTML
|
|
825
773
|
@xml.parseProgrammes
|
826
774
|
|
827
775
|
|
828
|
-
|
829
|
-
|
830
|
-
# $stderr.print "Starting listings at #{$params.start_date}\n"
|
831
|
-
# $stderr.print "Stopping listings at #{$params.stop_date}\n"
|
776
|
+
@@options['start_date'] = @xml.firstShowStartDate
|
777
|
+
@@options['stop_date'] = @xml.lastShowStopDate
|
832
778
|
|
833
779
|
# Force start/stop time on hour
|
834
|
-
|
780
|
+
@@options['start_date'][10,4] = "0000"
|
835
781
|
|
836
|
-
|
837
|
-
|
782
|
+
# info "start_date=",@@options['start_date']
|
783
|
+
# info "stop_date= ",@@options['stop_date']
|
784
|
+
if @@options['stop_date'][10,2] != "00"
|
785
|
+
hour = (@@options['stop_date'][8,2]).to_i + 1
|
838
786
|
if hour > 23
|
839
787
|
$stderr.print "yuck #{hour}\n"
|
840
788
|
end
|
841
|
-
|
789
|
+
@@options['stop_date'][8,2] = hour.to_s.rjust(2).sub(/\s/,'0')
|
842
790
|
end
|
843
|
-
|
844
|
-
# $stderr.print "Starting listings at #{$params.start_date}\n"
|
845
|
-
# $stderr.print "Stopping listings at #{$params.stop_date}\n"
|
791
|
+
@@options['stop_date'][10,4] = "0000"
|
846
792
|
|
847
|
-
pstart = Time.parse(
|
848
|
-
pstop = Time.parse(
|
849
|
-
|
793
|
+
pstart = Time.parse(@@options['start_date'])
|
794
|
+
pstop = Time.parse(@@options['stop_date'])
|
795
|
+
@@options['total_hours'] = ((pstop - pstart) / 3600).to_i
|
850
796
|
|
851
797
|
channels = Channels.instance
|
852
798
|
channels.calc_programmes_slots
|
853
799
|
|
854
|
-
fdate =
|
855
|
-
ldate =
|
800
|
+
fdate = @@options['start_date'][0,8]
|
801
|
+
ldate = @@options['stop_date'][0,8]
|
856
802
|
|
857
803
|
@xml.setTitle(@dates)
|
858
804
|
|
@@ -878,7 +824,7 @@ class XMLTV2HTML
|
|
878
824
|
|
879
825
|
@out.doctype
|
880
826
|
@out.header(@xml.HTML_title)
|
881
|
-
generatePopups if
|
827
|
+
generatePopups if @@options['use_programme_popup']
|
882
828
|
@out.text_before_table(@xml.top_title)
|
883
829
|
@out.table_start
|
884
830
|
@out.table_times
|
@@ -904,7 +850,7 @@ class XMLTV2HTML
|
|
904
850
|
prog = c.programme_at(pi)
|
905
851
|
@out.outputProgramme(prog, sindex, span)
|
906
852
|
# @out.outputProgramme(c.programme_at(pi), sindex, span)
|
907
|
-
if
|
853
|
+
if @@options['use_favorites'] and @@options['output_favorites'] and @@options['favorites'].include?(prog.title)
|
908
854
|
#$stderr.print "found a fav #{prog.title}\n"
|
909
855
|
favorites_list << prog
|
910
856
|
end
|
@@ -918,7 +864,7 @@ class XMLTV2HTML
|
|
918
864
|
i += 1
|
919
865
|
}
|
920
866
|
@out.outputChannelEnd
|
921
|
-
@out.table_times if times_counter %
|
867
|
+
@out.table_times if times_counter % @@options['times_interval'] == 0
|
922
868
|
times_counter += 1
|
923
869
|
}
|
924
870
|
|
@@ -958,11 +904,11 @@ class Html
|
|
958
904
|
print '<title>'
|
959
905
|
print title if title
|
960
906
|
print '</title>'; nl
|
961
|
-
print '<link rel="stylesheet" href="',
|
907
|
+
print '<link rel="stylesheet" href="', @@options['css_filename']
|
962
908
|
print '" type="text/css">'; nl
|
963
909
|
|
964
|
-
if
|
965
|
-
if
|
910
|
+
if @@options['use_programme_popup']
|
911
|
+
if @@options['programme_popup_method'] == "DHTML"
|
966
912
|
print '<script language="JavaScript1.2" src="popup.js" type="text/javascript"></script>'; nl
|
967
913
|
else
|
968
914
|
print '<script language="JavaScript1.2" type="text/javascript">'
|
@@ -987,23 +933,22 @@ class Html
|
|
987
933
|
|
988
934
|
# Styles
|
989
935
|
print 'Style[1]=['
|
990
|
-
print '"',
|
991
|
-
print '"',
|
992
|
-
print '"',
|
993
|
-
print '"',
|
936
|
+
print '"', @@options['popup_title_color'], '",'
|
937
|
+
print '"', @@options['popup_body_color'], '",'
|
938
|
+
print '"', @@options['popup_title_background_color'], '",'
|
939
|
+
print '"', @@options['popup_body_background_color'], '",'
|
994
940
|
print '"","","","",'
|
995
|
-
print '"',
|
996
|
-
print '"',
|
941
|
+
print '"', @@options['popup_title_font'], '",'
|
942
|
+
print '"', @@options['popup_body_font'], '",'
|
997
943
|
print '"center","",'
|
998
|
-
print '"',
|
999
|
-
print '"',
|
1000
|
-
print
|
944
|
+
print '"', @@options['popup_title_font_size'], '",'
|
945
|
+
print '"', @@options['popup_body_font_size'], '",'
|
946
|
+
print @@options['popup_body_width'], ','
|
1001
947
|
print '"",'
|
1002
948
|
print '3,' # Border width
|
1003
949
|
print '10,' # Padding around body text
|
1004
950
|
print '20, 20, "", "", "", "", ""]'
|
1005
|
-
|
1006
|
-
|
951
|
+
nl
|
1007
952
|
print 'applyCssFilter()'; nl
|
1008
953
|
print '</script>'; nl
|
1009
954
|
nl
|
@@ -1013,9 +958,9 @@ class Html
|
|
1013
958
|
def outputPopupDescs(c, cindex)
|
1014
959
|
# The descriptions go here...Text[#]=["title","text"]
|
1015
960
|
c.programmes[c.id()].each { |s|
|
1016
|
-
title =
|
961
|
+
title = @@options['popup_title_format'].sub(/\%T/, s.title)
|
1017
962
|
title.sub!(/\%R/, s.rating)
|
1018
|
-
desc =
|
963
|
+
desc = @@options['popup_body_format'].gsub(/%T/, s.title)
|
1019
964
|
desc.sub!(/\%S/, s.subtitle)
|
1020
965
|
if (s.previouslyShown) # rerun
|
1021
966
|
desc.sub!(/\%P/, "(R)")
|
@@ -1045,32 +990,32 @@ class Html
|
|
1045
990
|
print text
|
1046
991
|
print '</h3></center>'; nl
|
1047
992
|
end
|
1048
|
-
if
|
993
|
+
if @@options['url_prev']
|
1049
994
|
print '<a class="links" href="'
|
1050
|
-
print
|
995
|
+
print @@options['url_prev']
|
1051
996
|
print '"><<< Previous</a> | '
|
1052
997
|
end
|
1053
|
-
if
|
998
|
+
if @@options['url_next']
|
1054
999
|
print '<a class="links" href="'
|
1055
|
-
print
|
1000
|
+
print @@options['url_next']
|
1056
1001
|
print '">Next >>></a>'
|
1057
1002
|
end
|
1058
1003
|
end
|
1059
1004
|
|
1060
1005
|
def text_after_table
|
1061
|
-
if
|
1006
|
+
if @@options['url_prev']
|
1062
1007
|
print '<a class="links" href="'
|
1063
|
-
print
|
1008
|
+
print @@options['url_prev']
|
1064
1009
|
print '"><<< Previous</a> | '
|
1065
1010
|
end
|
1066
|
-
if
|
1011
|
+
if @@options['url_next']
|
1067
1012
|
print '<a class="links" href="'
|
1068
|
-
print
|
1013
|
+
print @@options['url_next']
|
1069
1014
|
print '">Next >>></a>'
|
1070
1015
|
end
|
1071
1016
|
print '<br />'
|
1072
1017
|
outputInfo
|
1073
|
-
outputLinks if
|
1018
|
+
outputLinks if @@options['output_links']
|
1074
1019
|
end
|
1075
1020
|
|
1076
1021
|
def table_start
|
@@ -1088,7 +1033,7 @@ class Html
|
|
1088
1033
|
def outputDate
|
1089
1034
|
days = @hours/24
|
1090
1035
|
colspan = 96
|
1091
|
-
colspan += 96 /
|
1036
|
+
colspan += 96 / @@options['channels_interval'] if @@options['channels_interval'] > 0
|
1092
1037
|
|
1093
1038
|
print '<tr class="date">'; nl
|
1094
1039
|
(0 .. days-1).each { |d|
|
@@ -1098,14 +1043,12 @@ class Html
|
|
1098
1043
|
end
|
1099
1044
|
|
1100
1045
|
def table_times
|
1101
|
-
intervals = 60 /
|
1046
|
+
intervals = 60 / @@options['time_divisor']
|
1102
1047
|
|
1103
|
-
# $stderr.print "Starting time #{$params.start_date}\n"
|
1104
|
-
# $stderr.print "Stoping time #{$params.stop_date}\n"
|
1105
1048
|
|
1106
1049
|
# Need hour to start.... we'll force it to be on an hour later
|
1107
|
-
starting_day =
|
1108
|
-
starting_hour =
|
1050
|
+
starting_day = @@options['start_date'][6,2].to_i
|
1051
|
+
starting_hour = @@options['start_date'][8,2].to_i
|
1109
1052
|
# $stderr.print "Day to start: #{starting_day}\n"
|
1110
1053
|
# $stderr.print "Hour to start: #{starting_hour}\n"
|
1111
1054
|
# $stderr.print "Total hours: #{$params.total_hours}\n"
|
@@ -1114,13 +1057,13 @@ class Html
|
|
1114
1057
|
output_channel_space
|
1115
1058
|
|
1116
1059
|
cs = 0
|
1117
|
-
(starting_hour .. starting_hour +
|
1060
|
+
(starting_hour .. starting_hour + @@options['total_hours'] - 1).each { |h|
|
1118
1061
|
(0 .. intervals-1).each { |hh|
|
1119
1062
|
print '<td>';
|
1120
|
-
printf "%02d", hh *
|
1063
|
+
printf "%02d", hh * @@options['time_divisor']; print '</td>';
|
1121
1064
|
}
|
1122
1065
|
cs += 1
|
1123
|
-
output_channel_space if
|
1066
|
+
output_channel_space if @@options['channels_interval'] > 0 and cs % @@options['channels_interval'] == 0
|
1124
1067
|
}
|
1125
1068
|
print '</tr>'; nl
|
1126
1069
|
|
@@ -1128,17 +1071,17 @@ class Html
|
|
1128
1071
|
output_channel_space
|
1129
1072
|
days = @hours/24
|
1130
1073
|
cs = 0
|
1131
|
-
cdate = Time.parse(
|
1074
|
+
cdate = Time.parse(@@options['start_date'])
|
1132
1075
|
|
1133
|
-
(starting_hour .. starting_hour +
|
1076
|
+
(starting_hour .. starting_hour + @@options['total_hours'] - 1).each { |hi|
|
1134
1077
|
h = hi % 24
|
1135
1078
|
print '<td colspan="',intervals,'" class="time">';
|
1136
1079
|
|
1137
|
-
if
|
1080
|
+
if @@options['output_date_in_time']
|
1138
1081
|
nl; print '<table width="100%" border="0" cellpadding="0">'; nl
|
1139
1082
|
print '<tr><td align="left" class="time">';
|
1140
1083
|
end
|
1141
|
-
if
|
1084
|
+
if @@options['time_format_12']
|
1142
1085
|
if h < 12
|
1143
1086
|
out = "#{h} am"
|
1144
1087
|
else
|
@@ -1149,16 +1092,16 @@ class Html
|
|
1149
1092
|
out = sprintf "%02d", h
|
1150
1093
|
end
|
1151
1094
|
print out
|
1152
|
-
if
|
1095
|
+
if @@options['output_date_in_time']
|
1153
1096
|
print '<td align="right" class="date_in_time">';
|
1154
|
-
print cdate.strftime(
|
1097
|
+
print cdate.strftime(@@options['date_format'])
|
1155
1098
|
print '</td></tr>'; nl; print '</table></td>'; nl
|
1156
1099
|
else
|
1157
1100
|
print '</td>';
|
1158
1101
|
end
|
1159
1102
|
cs += 1
|
1160
1103
|
cdate += 3600 # Add 1 hour
|
1161
|
-
output_channel_space if
|
1104
|
+
output_channel_space if @@options['channels_interval'] > 0 and cs % @@options['channels_interval'] == 0
|
1162
1105
|
}
|
1163
1106
|
print '</tr>'; nl
|
1164
1107
|
end
|
@@ -1179,6 +1122,7 @@ class Html
|
|
1179
1122
|
end
|
1180
1123
|
|
1181
1124
|
def outputProgramme(s, index, slots)
|
1125
|
+
return if s.spanSlots == 0 # Invalid programme - too short
|
1182
1126
|
if slots > 0
|
1183
1127
|
print '<td colspan="', slots, '" class="'
|
1184
1128
|
else
|
@@ -1186,7 +1130,7 @@ class Html
|
|
1186
1130
|
end
|
1187
1131
|
|
1188
1132
|
# Favorites override category.
|
1189
|
-
if
|
1133
|
+
if @@options['use_favorites'] and @@options['favorites'].include?(s.title)
|
1190
1134
|
print 'favorite">'
|
1191
1135
|
elsif s.category
|
1192
1136
|
print s.category,'">'
|
@@ -1194,9 +1138,9 @@ class Html
|
|
1194
1138
|
print 'programme">'
|
1195
1139
|
end
|
1196
1140
|
# Styles : 12=right; 1=center; 2=left; 3=float
|
1197
|
-
if
|
1141
|
+
if @@options['use_programme_popup']
|
1198
1142
|
if s.popupIndex >= 0
|
1199
|
-
if
|
1143
|
+
if @@options['programme_popup_method'] == "DHTML"
|
1200
1144
|
print '<a onmouseover="stm(Text[', s.popupIndex
|
1201
1145
|
print '],Style[1])" onmouseout="htm()">'; nl
|
1202
1146
|
else
|
@@ -1270,18 +1214,28 @@ class Html
|
|
1270
1214
|
|
1271
1215
|
end
|
1272
1216
|
|
1273
|
-
|
1274
|
-
|
1217
|
+
end
|
1218
|
+
|
1219
|
+
include XMLTV2HTML
|
1220
|
+
|
1221
|
+
trap("INT") do
|
1222
|
+
info "\n Received user interrupt...exiting.\n"
|
1223
|
+
exit
|
1224
|
+
end
|
1225
|
+
|
1226
|
+
confreader = ConfReader.new
|
1227
|
+
|
1228
|
+
xmltv2html = XMLTV2HTML2.new
|
1275
1229
|
|
1276
1230
|
time1 = Time.new
|
1277
1231
|
xmltv2html.parseXML
|
1278
1232
|
time2 = Time.new
|
1279
|
-
$stderr.print "^ Parsing XML took #{time2-time1} seconds.\n"
|
1233
|
+
$stderr.print "^ Parsing XML took #{time2-time1} seconds.\n"
|
1280
1234
|
|
1281
1235
|
time3 = Time.new
|
1282
1236
|
xmltv2html.generateHTML
|
1283
1237
|
time4 = Time.new
|
1284
|
-
$stderr.print "^ Generating HTML took #{time4-time3} seconds.\n"
|
1238
|
+
$stderr.print "^ Generating HTML took #{time4-time3} seconds.\n"
|
1285
1239
|
|
1286
1240
|
exit
|
1287
1241
|
|
data/xmltv2htmlrc
CHANGED
@@ -1,45 +1,39 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
### Then use xmltv2html.rb --config-file=FILE
|
7
|
-
###
|
8
|
-
### Note that this file is actually Ruby code.
|
9
|
-
###
|
10
|
-
######################################################################
|
1
|
+
#config_version: 1
|
2
|
+
# To check to make sure user is using correct xmltv2htmlrc format.
|
3
|
+
|
4
|
+
# There must be at least one item which is not commented out...
|
5
|
+
# seems like a bug. kvh 12/2005
|
11
6
|
|
12
7
|
### BEGIN CONFIGURATION
|
13
8
|
#
|
9
|
+
# Lines that start with # are comments. The defaults are commented out.
|
14
10
|
|
15
11
|
# Will output info to STDERR
|
16
|
-
|
12
|
+
#verbose: false
|
13
|
+
verbose: false
|
17
14
|
|
18
15
|
# Number of channels to repeat times horizontally; 0 to disable
|
19
|
-
|
16
|
+
#times_interval: 4
|
20
17
|
|
21
18
|
# Number of hours to repeat channels vertically; 0 to disable
|
22
|
-
|
19
|
+
#channels_interval: 4
|
23
20
|
|
24
21
|
# true = 12 hour format; false = 24 hour format
|
25
|
-
|
22
|
+
#time_format_12: true
|
26
23
|
|
27
24
|
# Use channel favorites?
|
28
|
-
|
25
|
+
#use_favorites: false
|
29
26
|
|
30
27
|
# List favorite channels below (seperate by a ',')
|
31
28
|
# The titles must be exact, not regular expressions.
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
"The Shield", "Law & Order: Criminal Intent",
|
36
|
-
"Charmed", "The West Wing"
|
37
|
-
]
|
29
|
+
#favorites_list: []
|
30
|
+
# Example: favorites_list: [ 'EXTRA', 'The West Wing', 'Law & Order' ]
|
31
|
+
|
38
32
|
# Print out list of favorites beneath the listings?
|
39
|
-
|
33
|
+
#output_favorites: false
|
40
34
|
|
41
35
|
# Name of CSS file
|
42
|
-
|
36
|
+
#css_filename: 'xmltv2html.css'
|
43
37
|
|
44
38
|
# Categories - use specified CSS class for given category.
|
45
39
|
# You must give the exact category for this to match. Look
|
@@ -50,31 +44,33 @@
|
|
50
44
|
# color: red;
|
51
45
|
# background-color: white;
|
52
46
|
# }
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
47
|
+
# Example:
|
48
|
+
#categories: {
|
49
|
+
# Sports event: "sports-event",
|
50
|
+
# News: "news"
|
51
|
+
#}
|
57
52
|
|
58
53
|
# If true, will display date on the hour cell
|
59
54
|
# (helpful for multiple days).
|
60
55
|
# Color, etc in CSS file
|
61
|
-
|
56
|
+
#output_date_in_time: false
|
62
57
|
|
63
58
|
# The format to display the date
|
64
59
|
# %m = month (01..12); %d = day (01..31); %b = Abbr month (Jan)
|
65
60
|
# %a = Abbr weekday (Sun)
|
66
|
-
#
|
67
|
-
#
|
68
|
-
|
61
|
+
# date_format: '%m-%d'
|
62
|
+
# date_format: '%b %m-%d'
|
63
|
+
#date_format: '%a %d'
|
69
64
|
|
70
65
|
# Should the programme's description 'popup' on mouseover?
|
71
66
|
# This will enlarge the output by the size of all the programme's
|
72
67
|
# descriptions.
|
73
|
-
|
68
|
+
#use_programme_popup: true
|
69
|
+
#use_programme_popup: true
|
74
70
|
|
75
71
|
# What method to use for popup? DHTML or STATUSBAR
|
76
72
|
# Some browsers disable pages from changing the statusbar.
|
77
|
-
|
73
|
+
#programme_popup_method: "DHTML" # "STATUSBAR"
|
78
74
|
|
79
75
|
# Title is the top line of popup; body is the below part.
|
80
76
|
# Define the popup: %T = title, %S = sub-title
|
@@ -84,24 +80,24 @@
|
|
84
80
|
# Example: @popup_body_format = "%D<br />%R"
|
85
81
|
# DHTML: You can put *some* CSS/HTML stuff here as well...
|
86
82
|
# STATUSBAR: NO HTML
|
87
|
-
|
88
|
-
|
83
|
+
#popup_title_format: "%T"
|
84
|
+
#popup_body_format: "%S %P<br />%D<br />Rating: %R"
|
89
85
|
|
90
86
|
# Attributes for the DHTML popup
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
87
|
+
#popup_title_color: "#FFFFFF"
|
88
|
+
#popup_title_font: "" # "Utopia"
|
89
|
+
#popup_title_font_size: "2" # FONT SIZE=
|
90
|
+
#popup_title_background_color: "#000099"
|
91
|
+
#popup_body_color: "#000000"
|
92
|
+
#popup_body_font: "" # "Utopia"
|
93
|
+
#popup_body_font_size: "1" # FONT SIZE=
|
94
|
+
#popup_body_background_color: "#E8E8FF"
|
95
|
+
#popup_body_width: "200" # pixels
|
100
96
|
|
101
97
|
# xmltv and xmltv2html home page links
|
102
|
-
|
98
|
+
#output_links: false
|
103
99
|
|
104
|
-
|
105
|
-
|
100
|
+
#start_time: ""
|
101
|
+
#stop_time: ""
|
106
102
|
|
107
103
|
### END CONFIGURATION
|
metadata
CHANGED
@@ -1,65 +1,56 @@
|
|
1
|
-
|
2
|
-
rubygems_version: 0.8.
|
1
|
+
!ruby/object:Gem::Specification
|
2
|
+
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: 2005-
|
6
|
+
version: 0.6.0
|
7
|
+
date: 2005-12-17 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
|
11
11
|
email: khindenburg@rubyforge.org
|
12
12
|
homepage: http://xmltv2html.rubyforge.org
|
13
13
|
rubyforge_project: xmltv2html
|
14
|
-
description:
|
15
|
-
of XMLTV. This is different from other XMLTV -> HTML programs in that the times
|
16
|
-
are on the horizontal axis and the channels on the vertical axis. The HTML
|
17
|
-
output can be modified using a CSS file. The prefered method to view a show's
|
18
|
-
info is via DHTML (the default). With version 0.5.3+, the attributes (fonts,
|
19
|
-
colors, size) of the DHTML can be modified."
|
14
|
+
description: xmltv2html is a Ruby script that generates a static HTML page from the output of XMLTV. This is different from other XMLTV -> HTML programs in that the times are on the horizontal axis and the channels on the vertical axis. The HTML output can be modified using a CSS file. The prefered method to view a show's info is via DHTML (the default). With version 0.5.3+, the attributes (fonts, colors, size) of the DHTML can be modified.
|
20
15
|
autorequire:
|
21
16
|
default_executable:
|
22
17
|
bindir: bin
|
23
|
-
has_rdoc:
|
18
|
+
has_rdoc: false
|
24
19
|
required_ruby_version: !ruby/object:Gem::Version::Requirement
|
25
20
|
requirements:
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
version: 1.8.0
|
21
|
+
- - ">="
|
22
|
+
- !ruby/object:Gem::Version
|
23
|
+
version: 1.8.3
|
30
24
|
version:
|
31
25
|
platform: ruby
|
26
|
+
signing_key:
|
27
|
+
cert_chain:
|
32
28
|
authors:
|
33
|
-
|
29
|
+
- Kurt V. Hindenburg
|
34
30
|
files:
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
31
|
+
- COPYING
|
32
|
+
- README
|
33
|
+
- ChangeLog
|
34
|
+
- popup.js
|
35
|
+
- xmltv2html.css
|
36
|
+
- xmltv2htmlrc
|
37
|
+
- contrib/README
|
38
|
+
- contrib/kvh/create_index.rb
|
39
|
+
- contrib/kvh/tvlistings.sh
|
40
|
+
- contrib/kvh/xmltv2htmlrc
|
41
|
+
- contrib/kvh/generate_html.rb
|
42
|
+
- contrib/kvh/update-tvlistings.rb
|
47
43
|
test_files: []
|
44
|
+
|
48
45
|
rdoc_options: []
|
46
|
+
|
49
47
|
extra_rdoc_files: []
|
48
|
+
|
50
49
|
executables:
|
51
|
-
|
50
|
+
- xmltv2html.rb
|
52
51
|
extensions: []
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
version_requirement:
|
59
|
-
version_requirements: !ruby/object:Gem::Version::Requirement
|
60
|
-
requirements:
|
61
|
-
-
|
62
|
-
- ">="
|
63
|
-
- !ruby/object:Gem::Version
|
64
|
-
version: 3.0.2
|
65
|
-
version:
|
52
|
+
|
53
|
+
requirements: []
|
54
|
+
|
55
|
+
dependencies: []
|
56
|
+
|