xmltv 0.8.5 → 0.8.6

Sign up to get free protection for your applications and to get access to all the features.
data/bin/xmltv CHANGED
File without changes
@@ -162,7 +162,9 @@ module XMLTV
162
162
  end
163
163
  rsl.flatten!
164
164
  end
165
- raise DateError.new(str) if rsl.index(nil)
165
+ if rsl
166
+ raise DateError.new(str) if rsl.index(nil)
167
+ end
166
168
  rsl
167
169
  end
168
170
  def transform(chan_id)
@@ -176,14 +178,19 @@ module XMLTV
176
178
  shift = entry['period'] == 'Nacht' ? Dag : 0
177
179
  dag, maand, jaar, startuur, startmin, stopuur, stopmin = parse_times(a)
178
180
  next if dag.nil?
179
- progdata['start'] = start = Time.local(jaar, maand, dag, startuur, startmin) + shift
180
-
181
- if stopuur
182
- stop = Time.local(jaar, maand, dag, stopuur, stopmin) + shift
183
- if start > stop && start.hour >= 21 && stop.hour <= 7
184
- stop += Dag
181
+ begin
182
+ progdata['start'] = start = Time.local(jaar, maand, dag, startuur, startmin) + shift
183
+ if stopuur
184
+ stop = Time.local(jaar, maand, dag, stopuur, stopmin) + shift
185
+ if start > stop && start.hour >= 21 && stop.hour <= 7
186
+ stop += Dag
187
+ end
188
+ progdata['stop'] = stop
185
189
  end
186
- progdata['stop'] = stop
190
+ rescue ArgumentError
191
+ STDERR.puts 'ArgumentError'
192
+ STDERR.puts jaar, maand, dag, stopuur, stopmin
193
+ next
187
194
  end
188
195
  date_stats(chan_id, progdata['start'])
189
196
  if (b = entry['bijzonderheden'])
@@ -162,7 +162,10 @@ module XMLTV
162
162
  if year && year > 1900
163
163
  progdata['date'] = year.to_s
164
164
  elsif role
165
- (progdata['credits'][role] ||= Array.new) << det.gsub(/\(.*\)/,'').strip
165
+ content = det.gsub(/\(.*\)/,'').strip
166
+ unless content.empty?
167
+ (progdata['credits'][role] ||= Array.new) << content
168
+ end
166
169
  end
167
170
  end
168
171
  progdata['audio']['stereo'] = 'stereo' if entry['Stereo']
@@ -89,7 +89,7 @@ module XMLTV
89
89
  datum = Date.dutch(page.at('//div.epg_listings_bar1//span').inner_text)
90
90
  rescue NoMethodError
91
91
  save(url, page)
92
- raise
92
+ raise BadChannelError.new
93
93
  end
94
94
  if day == 'today' && datum != Date.today
95
95
  # @all_days = Hash.new ## Invalidate cache
@@ -56,8 +56,13 @@ module XMLTV
56
56
  program['category'] = detail.at('//p').inner_text.strip.split("\n")[-1]
57
57
  program['desc'] = detail.at('//p.summary').inner_text.to_utf.strip rescue ''
58
58
  rescue NoMethodError => exc
59
- STDERR.puts info, detail
60
- raise
59
+ errfile = '/tmp/vpro.errors'
60
+ STDERR.puts "Some detail problem, see #{errfile}"
61
+ File.open(errfile, 'a') do |h|
62
+ h.puts Time.now
63
+ h.puts info,'===', detail, '++++++++++++'
64
+ end
65
+
61
66
  end
62
67
  program
63
68
  end
data/lib/xmltv/xmltv.rb CHANGED
@@ -96,7 +96,7 @@ module XMLTV
96
96
  super {|h,v| h[v] = Hash.new }
97
97
  end
98
98
  end
99
- VERSION = '0.8.5'
99
+ VERSION = '0.8.6'
100
100
  Progdir = ($LOAD_PATH.find {|x| test(?f, "#{x}/xmltv/xmltv.rb")} || 'lib') + '/xmltv/sites'
101
101
  Sites = Dir["#{Progdir}/*.rb"].map{|x| x[0..-4]}.map{|x| File.basename(x)}
102
102
  class XmltvOptparser
@@ -283,7 +283,7 @@ module XMLTV
283
283
  end
284
284
  end
285
285
  file = ">#{@grabber.outputfile(chan_id)}"
286
- errorfile = '/var/tmp/xmllint-errors'
286
+ errorfile = "/var/tmp/xmllint-errors-#{Time.now.to_i}"
287
287
  if XmltvOptions.validate
288
288
  IO.popen(" ( xmllint --valid - | tv_sort #{file} ) 2>#{errorfile}", 'w') do |h|
289
289
  write_xml h
@@ -551,7 +551,7 @@ module XMLTV
551
551
  tries = 0
552
552
  begin
553
553
  open(url) { |h| Hpricot(h) }
554
- rescue Errno::ECONNREFUSED, ::Timeout::Error, EOFError
554
+ rescue Errno::ECONNREFUSED, ::Timeout::Error, EOFError, Errno::ETIMEDOUT
555
555
  tries += 1
556
556
  sleep 2
557
557
  retry if tries <= 3
@@ -703,6 +703,9 @@ module XMLTV
703
703
  nprogs = grab_channel(channel)
704
704
  pda = transform(channel)
705
705
  errors = fix_times(pda)
706
+ rescue Timeout::Error, Errno::ECONNRESET
707
+ STDERR.puts "Timeout grab_channel#{channel}"
708
+ next
706
709
  rescue BadChannelError
707
710
  STDERR.puts "Zie #{reject_file_name}"
708
711
  next
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: xmltv
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.8.5
4
+ version: 0.8.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Han Holl
@@ -9,7 +9,7 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2008-03-02 00:00:00 +01:00
12
+ date: 2008-05-16 00:00:00 +02:00
13
13
  default_executable:
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
@@ -28,7 +28,7 @@ dependencies:
28
28
  requirements:
29
29
  - - ">="
30
30
  - !ruby/object:Gem::Version
31
- version: 1.5.0
31
+ version: 1.5.1
32
32
  version:
33
33
  description: "Xmltv consists of a single base grabber and a bunch of site specific grabbers. The base grabber provides: - a driver - option parsing - start/stop time fixing - xml production - helper functions that site specific grabbers might want to use"
34
34
  email: hanholl@rubyforge.org
@@ -81,7 +81,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
81
81
  requirements: []
82
82
 
83
83
  rubyforge_project: xmltv
84
- rubygems_version: 1.0.1
84
+ rubygems_version: 1.1.1
85
85
  signing_key:
86
86
  specification_version: 2
87
87
  summary: fetches tv program data from various sites