meer opruimen

This commit is contained in:
Ward Wouts 2006-02-14 21:27:42 +00:00
parent 80f7c27c14
commit 5e553cdd9c

View file

@ -59,15 +59,9 @@ def deleteold(podcast)
} }
end end
for podcast in @podcasts.keys.sort def getenclosure(podcast, enclosure)
puts podcast if ! enclosure.attribute("url").nil?
res = fetch(@podcasts[podcast]["rss"]) cast = enclosure.attribute("url").to_s.dup
@filelist = {}
xmldoc = REXML::Document.new(res.body)
xmldoc.elements.each("rss/channel/*/enclosure") {|x|
if ! x.attribute("url").nil?
cast = x.attribute("url").to_s.dup
filename = cast.dup filename = cast.dup
filename.sub!(/^.*\//, "") filename.sub!(/^.*\//, "")
if @podcasts[podcast]["rename"] if @podcasts[podcast]["rename"]
@ -82,6 +76,16 @@ for podcast in @podcasts.keys.sort
} }
end end
end end
end
for podcast in @podcasts.keys.sort
puts podcast
res = fetch(@podcasts[podcast]["rss"])
@filelist = {}
xmldoc = REXML::Document.new(res.body)
xmldoc.elements.each("rss/channel/*/enclosure") {|enclosure|
getenclosure(podcast, enclosure)
} }
if @podcasts[podcast]["delete"] if @podcasts[podcast]["delete"]
deleteold(podcast) deleteold(podcast)