From bd905b242e23cd51ab4374757d2bb1215ef95c05 Mon Sep 17 00:00:00 2001 From: Ward Wouts Date: Sat, 18 Feb 2006 11:08:33 +0000 Subject: [PATCH] new symlinky magic and commented config --- getdistorted/getdistorted.rb | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/getdistorted/getdistorted.rb b/getdistorted/getdistorted.rb index 93a1e11..8d8ff8e 100755 --- a/getdistorted/getdistorted.rb +++ b/getdistorted/getdistorted.rb @@ -19,11 +19,20 @@ # OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. # +######################################## +# the configuration bit + @podcasts = { + # the podcast name "distortedview" => { + # where's the rss file "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' ], + # directory to put symlinks to the new files + "linkdir" => '/Users/ward/ipod_sync/[books]/Distorted View', }, "tagesschau" => { "rss" => 'http://www.tagesschau.de/export/podcast', @@ -32,6 +41,9 @@ }, } +######################################## +# code from here on + require 'net/http' require 'uri' require 'rexml/document' @@ -74,6 +86,9 @@ def getenclosure(podcast, enclosure) File.open("#{@podcasts[podcast]["savedir"]}/#{filename}", "w"){|f| f.print(response.body) } + if @podcasts[podcast]["linkdir"] + File.symlink("#{@podcasts[podcast]["savedir"]}/#{filename}", "#{@podcasts[podcast]["linkdir"]}/#{filename}") + end end end end