robuuster

This commit is contained in:
Ward Wouts 2006-03-15 12:00:53 +00:00
parent 9c554638ff
commit fc1783c585

View file

@ -83,12 +83,16 @@ def getenclosure(podcast, enclosure)
@filelist[filename] = true @filelist[filename] = true
if ! File.exists?("#{@podcasts[podcast]["savedir"]}/#{filename}") if ! File.exists?("#{@podcasts[podcast]["savedir"]}/#{filename}")
puts " getting #{@podcasts[podcast]["savedir"]}/#{filename}" puts " getting #{@podcasts[podcast]["savedir"]}/#{filename}"
response = fetch(cast) begin
File.open("#{@podcasts[podcast]["savedir"]}/#{filename}", "w"){|f| response = fetch(cast)
f.print(response.body) File.open("#{@podcasts[podcast]["savedir"]}/#{filename}", "w"){|f|
} f.print(response.body)
if @podcasts[podcast]["linkdir"] }
File.symlink("#{@podcasts[podcast]["savedir"]}/#{filename}", "#{@podcasts[podcast]["linkdir"]}/#{filename}") if @podcasts[podcast]["linkdir"]
File.symlink("#{@podcasts[podcast]["savedir"]}/#{filename}", "#{@podcasts[podcast]["linkdir"]}/#{filename}")
end
rescue Timeout::Error, Errno::EHOSTUNREACH, Errno::ECONNREFUSED
puts " error fetching, skipping"
end end
end end
end end