ook de eerste fetch moet bewaakt worden
This commit is contained in:
parent
9ba4b75823
commit
be13cabfd8
1 changed files with 20 additions and 15 deletions
|
|
@ -128,21 +128,26 @@ end
|
||||||
for podcast in @podcasts.keys.sort
|
for podcast in @podcasts.keys.sort
|
||||||
files = Array.new
|
files = Array.new
|
||||||
puts podcast
|
puts podcast
|
||||||
res = fetch(@podcasts[podcast]["rss"])
|
begin
|
||||||
@filelist = {}
|
res = fetch(@podcasts[podcast]["rss"])
|
||||||
|
@filelist = {}
|
||||||
|
|
||||||
xmldoc = REXML::Document.new(res.body)
|
xmldoc = REXML::Document.new(res.body)
|
||||||
xmldoc.elements.each("rss/channel/item") {|item|
|
xmldoc.elements.each("rss/channel/item") {|item|
|
||||||
files.push getenclosure(podcast, 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
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
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
|
||||||
end
|
end
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue