robuuster
This commit is contained in:
parent
9c554638ff
commit
fc1783c585
1 changed files with 10 additions and 6 deletions
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue