daar heb ik vast over nagedacht
This commit is contained in:
parent
681f9e258e
commit
b45fd6ed8d
1 changed files with 11 additions and 5 deletions
|
|
@ -24,6 +24,7 @@ require 'uri'
|
||||||
require 'rexml/document'
|
require 'rexml/document'
|
||||||
require 'date'
|
require 'date'
|
||||||
require 'getoptlong'
|
require 'getoptlong'
|
||||||
|
require 'yaml'
|
||||||
|
|
||||||
@debug=false
|
@debug=false
|
||||||
|
|
||||||
|
|
@ -178,11 +179,16 @@ def getenclosure(podcast, item)
|
||||||
filename = cast.dup
|
filename = cast.dup
|
||||||
filename.sub!(/^.*\//, "")
|
filename.sub!(/^.*\//, "")
|
||||||
if @podcasts[podcast]["rename"]
|
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%%/)
|
if replacement.match(/%%DATE%%/)
|
||||||
replacement.gsub!(/%%DATE%%/, date)
|
replacement.gsub!(/%%DATE%%/, date)
|
||||||
end
|
end
|
||||||
filename.gsub!(@podcasts[podcast]["rename"][0], replacement)
|
filename.gsub!(pattern, replacement)
|
||||||
|
end
|
||||||
end
|
end
|
||||||
@filelist[filename] = true
|
@filelist[filename] = true
|
||||||
if ! File.exists?("#{@podcasts[podcast]["savedir"]}/#{filename}")
|
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
|
rescue Timeout::Error, Errno::EHOSTUNREACH, Errno::ECONNREFUSED, Errno::ECONNRESET, Errno::ETIMEDOUT, Net::HTTPFatalError
|
||||||
puts " error #{$!} fetching, skipping"
|
puts " error #{$!} fetching, skipping"
|
||||||
rescue
|
rescue
|
||||||
puts "WTF"
|
puts "WTF: #{$!}"
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
return "#{@podcasts[podcast]["savedir"]}/#{filename}"
|
return "#{@podcasts[podcast]["savedir"]}/#{filename}"
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue