new symlinky magic and commented config

This commit is contained in:
Ward Wouts 2006-02-18 11:08:33 +00:00
parent 063394d20f
commit bd905b242e

View file

@ -19,11 +19,20 @@
# OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. # OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
# #
########################################
# the configuration bit
@podcasts = { @podcasts = {
# the podcast name
"distortedview" => { "distortedview" => {
# where's the rss file
"rss" => 'http://www.distortedview.com/show/index.xml', "rss" => 'http://www.distortedview.com/show/index.xml',
"savedir" => '/Users/ward/ipod_sync/[books]/Distorted View', # where should enclosures be saved
"savedir" => '/Users/ward/Private/mp3/[books]/Distorted View',
# rename magic, this is used on the file name with sub!
"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
"linkdir" => '/Users/ward/ipod_sync/[books]/Distorted View',
}, },
"tagesschau" => { "tagesschau" => {
"rss" => 'http://www.tagesschau.de/export/podcast', "rss" => 'http://www.tagesschau.de/export/podcast',
@ -32,6 +41,9 @@
}, },
} }
########################################
# code from here on
require 'net/http' require 'net/http'
require 'uri' require 'uri'
require 'rexml/document' require 'rexml/document'
@ -74,6 +86,9 @@ def getenclosure(podcast, enclosure)
File.open("#{@podcasts[podcast]["savedir"]}/#{filename}", "w"){|f| File.open("#{@podcasts[podcast]["savedir"]}/#{filename}", "w"){|f|
f.print(response.body) f.print(response.body)
} }
if @podcasts[podcast]["linkdir"]
File.symlink("#{@podcasts[podcast]["savedir"]}/#{filename}", "#{@podcasts[podcast]["linkdir"]}/#{filename}")
end
end end
end end
end end