m3u files optie, op verzoek van sven
This commit is contained in:
parent
fc1783c585
commit
8a9360e70d
1 changed files with 14 additions and 1 deletions
|
|
@ -33,6 +33,8 @@
|
||||||
"rename" => [ /_(\d\d\d\d)(\d\d)/, '\2\1' ],
|
"rename" => [ /_(\d\d\d\d)(\d\d)/, '\2\1' ],
|
||||||
# directory to put symlinks to the new files
|
# directory to put symlinks to the new files
|
||||||
"linkdir" => '/Users/ward/ipod_sync/[books]/Distorted View',
|
"linkdir" => '/Users/ward/ipod_sync/[books]/Distorted View',
|
||||||
|
# option to write an m3u file after fetching the mp3s
|
||||||
|
"m3u" => '/Users/ward/dv.m3u',
|
||||||
},
|
},
|
||||||
"tagesschau" => {
|
"tagesschau" => {
|
||||||
"rss" => 'http://www.tagesschau.de/export/podcast',
|
"rss" => 'http://www.tagesschau.de/export/podcast',
|
||||||
|
|
@ -91,23 +93,34 @@ def getenclosure(podcast, enclosure)
|
||||||
if @podcasts[podcast]["linkdir"]
|
if @podcasts[podcast]["linkdir"]
|
||||||
File.symlink("#{@podcasts[podcast]["savedir"]}/#{filename}", "#{@podcasts[podcast]["linkdir"]}/#{filename}")
|
File.symlink("#{@podcasts[podcast]["savedir"]}/#{filename}", "#{@podcasts[podcast]["linkdir"]}/#{filename}")
|
||||||
end
|
end
|
||||||
|
return "#{@podcasts[podcast]["savedir"]}/#{filename}"
|
||||||
rescue Timeout::Error, Errno::EHOSTUNREACH, Errno::ECONNREFUSED
|
rescue Timeout::Error, Errno::EHOSTUNREACH, Errno::ECONNREFUSED
|
||||||
puts " error fetching, skipping"
|
puts " error fetching, skipping"
|
||||||
end
|
end
|
||||||
|
else
|
||||||
|
return "#{@podcasts[podcast]["savedir"]}/#{filename}"
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
for podcast in @podcasts.keys.sort
|
for podcast in @podcasts.keys.sort
|
||||||
|
files = Array.new
|
||||||
puts podcast
|
puts podcast
|
||||||
res = fetch(@podcasts[podcast]["rss"])
|
res = fetch(@podcasts[podcast]["rss"])
|
||||||
@filelist = {}
|
@filelist = {}
|
||||||
|
|
||||||
xmldoc = REXML::Document.new(res.body)
|
xmldoc = REXML::Document.new(res.body)
|
||||||
xmldoc.elements.each("rss/channel/*/enclosure") {|enclosure|
|
xmldoc.elements.each("rss/channel/*/enclosure") {|enclosure|
|
||||||
getenclosure(podcast, enclosure)
|
files.push getenclosure(podcast, enclosure)
|
||||||
}
|
}
|
||||||
if @podcasts[podcast]["delete"]
|
if @podcasts[podcast]["delete"]
|
||||||
deleteold(podcast)
|
deleteold(podcast)
|
||||||
end
|
end
|
||||||
|
if @podcasts[podcast]["m3u"]
|
||||||
|
File.open(@podcasts[podcast]["m3u"], "w"){|f|
|
||||||
|
files.each{|file|
|
||||||
|
f.puts file
|
||||||
|
}
|
||||||
|
}
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue