ook de eerste fetch moet bewaakt worden

This commit is contained in:
Ward Wouts 2006-08-10 11:23:08 +00:00
parent 9ba4b75823
commit be13cabfd8

View file

@ -128,21 +128,26 @@ end
for podcast in @podcasts.keys.sort
files = Array.new
puts podcast
res = fetch(@podcasts[podcast]["rss"])
@filelist = {}
begin
res = fetch(@podcasts[podcast]["rss"])
@filelist = {}
xmldoc = REXML::Document.new(res.body)
xmldoc.elements.each("rss/channel/item") {|item|
files.push getenclosure(podcast, item)
}
if @podcasts[podcast]["delete"]
deleteold(podcast)
end
if @podcasts[podcast]["m3u"]
File.open(@podcasts[podcast]["m3u"], "w"){|f|
files.each{|file|
f.puts file
}
xmldoc = REXML::Document.new(res.body)
xmldoc.elements.each("rss/channel/item") {|item|
files.push getenclosure(podcast, item)
}
if @podcasts[podcast]["delete"]
deleteold(podcast)
end
if @podcasts[podcast]["m3u"]
File.open(@podcasts[podcast]["m3u"], "w"){|f|
files.each{|file|
f.puts file
}
}
end
rescue
rescue Timeout::Error, Errno::EHOSTUNREACH, Errno::ECONNREFUSED, Errno::ECONNRESET, Errno::ETIMEDOUT, Net::HTTPFatalError
puts " error #{$!} fetching, skipping"
end
end