daar heb ik vast over nagedacht

This commit is contained in:
Ward Wouts 2008-06-03 11:02:26 +00:00
parent 681f9e258e
commit b45fd6ed8d

View file

@ -24,6 +24,7 @@ require 'uri'
require 'rexml/document'
require 'date'
require 'getoptlong'
require 'yaml'
@debug=false
@ -178,11 +179,16 @@ def getenclosure(podcast, item)
filename = cast.dup
filename.sub!(/^.*\//, "")
if @podcasts[podcast]["rename"]
replacement = @podcasts[podcast]["rename"][1].dup
renames = Array.new
@podcasts[podcast]["rename"].collect{|x| renames.push(x.dup)}
while renames.length > 0
pattern = renames.shift
replacement = renames.shift
if replacement.match(/%%DATE%%/)
replacement.gsub!(/%%DATE%%/, date)
end
filename.gsub!(@podcasts[podcast]["rename"][0], replacement)
filename.gsub!(pattern, replacement)
end
end
@filelist[filename] = true
if ! File.exists?("#{@podcasts[podcast]["savedir"]}/#{filename}")
@ -199,7 +205,7 @@ def getenclosure(podcast, item)
rescue Timeout::Error, Errno::EHOSTUNREACH, Errno::ECONNREFUSED, Errno::ECONNRESET, Errno::ETIMEDOUT, Net::HTTPFatalError
puts " error #{$!} fetching, skipping"
rescue
puts "WTF"
puts "WTF: #{$!}"
end
else
return "#{@podcasts[podcast]["savedir"]}/#{filename}"