diff --git a/getdistorted/getdistorted.rb b/getdistorted/getdistorted.rb index c0abc73..14ffff0 100755 --- a/getdistorted/getdistorted.rb +++ b/getdistorted/getdistorted.rb @@ -83,12 +83,16 @@ def getenclosure(podcast, enclosure) @filelist[filename] = true if ! File.exists?("#{@podcasts[podcast]["savedir"]}/#{filename}") puts " getting #{@podcasts[podcast]["savedir"]}/#{filename}" - response = fetch(cast) - 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}") + begin + response = fetch(cast) + 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}") + end + rescue Timeout::Error, Errno::EHOSTUNREACH, Errno::ECONNREFUSED + puts " error fetching, skipping" end end end