xmltv 0.8.4 → 0.8.5

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.
@@ -113,7 +113,8 @@ module XMLTV
113
113
  progdata['subtitles']['type'] = 'teletext' if p['subtitles']
114
114
  progdata['star-rating']['value'] = "#{p['star_rating']}/5" if p['star_rating']
115
115
  if (cast = p['cast'])
116
- progdata['credits']['actor'] =
116
+ cast = cast.split("\r")[0]
117
+ progdata['credits']['actor'] = blob =
117
118
  cast.index('|') ?
118
119
  cast.split('|').map {|x| x.gsub(/^.*[*]/,'') } :
119
120
  cast.split(',')
@@ -150,10 +150,11 @@ module XMLTV
150
150
 
151
151
  def parse_times(str)
152
152
  rsl = nil
153
+ # STDERR.puts str
153
154
  md = /(\d+)\s(\w+)\s(\d+),\s(\d+):(\d+)/.match(str)
154
155
  if md
155
156
  rsl = md.captures.map do |x|
156
- x =~ /\d/ ? x.to_i : Date::Maanden.index(x)
157
+ x =~ /\d/ ? x.to_i : Date::Maanden.index(x.downcase)
157
158
  end
158
159
  mdstop = /(\d+):(\d+)/.match(str[md.offset(0)[1]..-1])
159
160
  if mdstop
@@ -161,6 +162,7 @@ module XMLTV
161
162
  end
162
163
  rsl.flatten!
163
164
  end
165
+ raise DateError.new(str) if rsl.index(nil)
164
166
  rsl
165
167
  end
166
168
  def transform(chan_id)
@@ -209,7 +211,10 @@ module XMLTV
209
211
  progdata[Titeltrans[key]] = entry[key] if entry[key]
210
212
  end
211
213
  progdata_array << progdata
212
-
214
+ rescue DateError => exc
215
+ STDERR.puts exc.class, exc.message
216
+ PP.pp(entry, STDERR)
217
+ next
213
218
  rescue StandardError => exc
214
219
  STDERR.puts exc, exc.message, exc.backtrace
215
220
  PP.pp(entry, STDERR)
data/lib/xmltv/xmltv.rb CHANGED
@@ -88,6 +88,7 @@ end
88
88
 
89
89
  module XMLTV
90
90
  class ValidateError < Exception; end
91
+ class DateError < Exception; end
91
92
  class BadChannelError < Exception; end
92
93
  class BadSiteError < Exception; end
93
94
  class Progdata < Hash
@@ -95,7 +96,7 @@ module XMLTV
95
96
  super {|h,v| h[v] = Hash.new }
96
97
  end
97
98
  end
98
- VERSION = '0.8.4'
99
+ VERSION = '0.8.5'
99
100
  Progdir = ($LOAD_PATH.find {|x| test(?f, "#{x}/xmltv/xmltv.rb")} || 'lib') + '/xmltv/sites'
100
101
  Sites = Dir["#{Progdir}/*.rb"].map{|x| x[0..-4]}.map{|x| File.basename(x)}
101
102
  class XmltvOptparser
@@ -513,6 +514,9 @@ module XMLTV
513
514
  reject('invalid', x) if rsl
514
515
  rsl
515
516
  end
517
+ if pda.empty?
518
+ return 0
519
+ end
516
520
  starttimes = pda.sort do |x, y|
517
521
  if (a = x['start']) != (b = y['start'])
518
522
  a <=> b
@@ -547,7 +551,7 @@ module XMLTV
547
551
  tries = 0
548
552
  begin
549
553
  open(url) { |h| Hpricot(h) }
550
- rescue Errno::ECONNREFUSED, ::Timeout::Error
554
+ rescue Errno::ECONNREFUSED, ::Timeout::Error, EOFError
551
555
  tries += 1
552
556
  sleep 2
553
557
  retry if tries <= 3
@@ -707,7 +711,8 @@ module XMLTV
707
711
  report(channel, nprogs, errors)
708
712
  end
709
713
  rescue SystemExit
710
-
714
+ rescue ValidateError => exc
715
+ STDERR.puts exc.class, exc.message, exc.backtrace
711
716
  rescue ::Exception => exc
712
717
  STDERR.puts exc.class, exc.message, exc.backtrace
713
718
  if XmltvOptions.mailto
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.4
4
+ version: 0.8.5
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-01-20 00:00:00 +01:00
12
+ date: 2008-03-02 00:00:00 +01: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.4.0
31
+ version: 1.5.0
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