make it work with BSDtalk, why didn't this just work\?
This commit is contained in:
parent
be13cabfd8
commit
499fff6602
1 changed files with 26 additions and 14 deletions
|
|
@ -42,14 +42,18 @@
|
||||||
# # delete files that aren't in the rss anylonger
|
# # delete files that aren't in the rss anylonger
|
||||||
# "delete" => true,
|
# "delete" => true,
|
||||||
# },
|
# },
|
||||||
"pennradio" => {
|
# "pennradio" => {
|
||||||
# "rss" => 'http://www.923freefm.com/pages/podcast/80.rss',
|
# "rss" => 'http://penn.freefm.com/pages/podcast/431.rss',
|
||||||
"rss" => 'http://penn.freefm.com/pages/podcast/431.rss',
|
# # %%DATE%% is a magic word here, gets replaced by the pubdate in
|
||||||
# %%DATE%% is a magic word here, gets replaced by the pubdate in
|
# # YYYYMMDD format. Won't work if there is no pubDate in the rss feed
|
||||||
# YYYYMMDD format. Won't work if there is no pubDate in the rss feed
|
# "rename" => [ /^/, '%%DATE%%-' ],
|
||||||
"rename" => [ /^/, '%%DATE%%-' ],
|
# "savedir" => '/Users/ward/Private/mp3/[books]/PennRadio',
|
||||||
"savedir" => '/Users/ward/Private/mp3/[books]/PennRadio',
|
# "linkdir" => '/Users/ward/ipod_sync/[books]/PennRadio',
|
||||||
"linkdir" => '/Users/ward/ipod_sync/[books]/PennRadio',
|
# },
|
||||||
|
"bsdtalk" => {
|
||||||
|
"rss" => 'http://feeds.feedburner.com/Bsdtalk',
|
||||||
|
"savedir" => '/Users/ward/Private/mp3/[books]/BSDTalk',
|
||||||
|
"linkdir" => '/Users/ward/ipod_sync/[books]/BSDTalk',
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -85,11 +89,14 @@ def deleteold(podcast)
|
||||||
end
|
end
|
||||||
|
|
||||||
def getenclosure(podcast, item)
|
def getenclosure(podcast, item)
|
||||||
enclosure = item.get_elements("enclosure")[0]
|
enclosure = nil
|
||||||
|
item.each_element{|x|
|
||||||
|
if x.name == "enclosure"
|
||||||
|
enclosure = x
|
||||||
|
end
|
||||||
|
}
|
||||||
pubdate = item.get_elements("pubDate")[0]
|
pubdate = item.get_elements("pubDate")[0]
|
||||||
date = nil
|
date = nil
|
||||||
if ! enclosure.nil?
|
|
||||||
end
|
|
||||||
if ! pubdate.nil?
|
if ! pubdate.nil?
|
||||||
date = Date.parse(pubdate.text).strftime("%Y%m%d")
|
date = Date.parse(pubdate.text).strftime("%Y%m%d")
|
||||||
end
|
end
|
||||||
|
|
@ -131,10 +138,15 @@ for podcast in @podcasts.keys.sort
|
||||||
begin
|
begin
|
||||||
res = fetch(@podcasts[podcast]["rss"])
|
res = fetch(@podcasts[podcast]["rss"])
|
||||||
@filelist = {}
|
@filelist = {}
|
||||||
|
|
||||||
|
# body.gsub!(/#{13.chr}#{10.chr}/, "#{10.chr}")
|
||||||
xmldoc = REXML::Document.new(res.body)
|
xmldoc = REXML::Document.new(res.body)
|
||||||
xmldoc.elements.each("rss/channel/item") {|item|
|
xmldoc.elements.each("rss/channel") {|item|
|
||||||
files.push getenclosure(podcast, item)
|
item.each_element{|x|
|
||||||
|
if x.name == "item"
|
||||||
|
files.push getenclosure(podcast, x)
|
||||||
|
end
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if @podcasts[podcast]["delete"]
|
if @podcasts[podcast]["delete"]
|
||||||
deleteold(podcast)
|
deleteold(podcast)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue