You can subscribe to this list here.
| 2005 |
Jan
|
Feb
|
Mar
|
Apr
|
May
(6) |
Jun
|
Jul
(2) |
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
|---|
|
From: Chilts <and...@us...> - 2005-07-18 09:03:16
|
Update of /cvsroot/pollpod/pollpod/docs In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv13738/pollpod/docs Modified Files: README Log Message: - README changes (from old sample.ini) Index: README =================================================================== RCS file: /cvsroot/pollpod/pollpod/docs/README,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- README 6 May 2005 13:57:38 -0000 1.1 +++ README 18 Jul 2005 09:03:06 -0000 1.2 @@ -0,0 +1,123 @@ + + +# ----------------------------------------------------------------------------- + +# This first section defines the default values for this installation of +# pollpod.pl. These values are read first, then your own configuration file, +# then any configuration file you choose to mention on the command line, then +# finally, any command line option you require. + +# See /etc/pollpod.ini for a more compact version. + +# Note on yes/no options. Usually, the default value is a no, but can be set to +# 'yes' if required. The option is turned on only if the value is 'yes' and it +# is all lowercase. Anything else (including 'YES', 'y', 'ON', 'True' or +# 'DoIt'), will be seen as 'no'. + +[Options] + +# This is the main directory where your feeds will be saved. Each feed will be +# saved into it's own directory, the name of which is the name before the comma +# in each of [Feeds]Feed lines. + +PodCastSaveDir=~/podcasts + +# If this option is set to 'yes', then pollpod.pl will attempt to only download +# the latest podcast in each feed. In this circumstance, the latest podcast is +# the one nearest the top of the file. + +SaveLatestOnly=no + +# If this option is set to 'yes', pollpod.pl will run pretty much as it should, +# except that just before trying to download each podcast, it will internally +# mark each one as done, hence when downloading is attempted, each podcast will +# be skipped. + +TestOnly=no + +# If this option is set to 'yes', then each podcast that is encountered will be +# marked as 'done'. This is achieved by 'touching' a file in the feed's +# directory which is the name of the file appended with a '.done'. E.g. for a +# file of the name '20050509_AShow.mp3', the file '20050509_AShow.mp3.done' +# will be created so that show won't try and be downloaded again. If you +# require to download that show in the future, just delete the '*.done' files +# you don't equire and re-run pollpod.pl with this option not set to 'yes'. + +CatchUpAll=no + +# This option means that pollpod.pl will try and create any directories it +# requires, including the PodCastSaveDir, any feed's directory and the DateDir. + +MakeDirs=no + +# This option allows you to save the podcasts with a filename taken from the +# feed. This will either be the name of the file taken from the last part of +# the URL (from the last /), or the title of the podcast taken from the title +# element in the enclosure. +# Valid values are 'url' or 'title'. +# If you are unsure of this, leave it as 'url'. + +FieldForFilename=url + +# This option tries to replace both spaces and /'s in any filename with an +# underscore. It is usually only useful if you have set the FieldForFilename +# option to 'title'. If you don't know anything about this, leave the +# FieldForFilename set to 'url' and NormaliseFilenames to 'no' and you should +# be fine. + +NormaliseFilenames=no + +# Again, this option is usually only useful when you wish to use the +# FieldForFilename set to 'title'. You can safely leave this as 'no' if you +# have the above set to 'url'. + +PrecedeFilenamesWithDate=no + +# If you require create a dated directory containing links to all of the most +# recently downloaded podcasts, set this option to 'yes' and be sure to set +# DateDir too. + +MakeDateLinks=no + +# This directory is the one in which dated directories will be created which +# will contain symbolic links to each of the latest podcasts that have been +# downloaded. + +DateDir=~/podcasts/dates + +# If you require an M3U playlist file of all the latest downloaded podcasts, +# set this option to 'yes'. + +CreateM3UPlayList=no + +# This specifies the file to save the playlist too if the above option is +# 'yes'. + +M3UPlayListFile=~/podcasts/podcasts.m3u + +# These final two options are for the curious rather than the normal user. +# This says whether to save the RSS XML feed. It is saved into each feed's +# directory. It is saved as 'feed.xml'. + +SaveRssXmlFeeds=no + +# This says whether to save the RSS XML feed as a dump of the Perl data +# structure. The files is saved into each feed's directory. Note: this is +# really only for people interested in developing something, learning a bit +# about Perl, or just the generally inquisitive person. The file is saved as +# 'feed.dmp'. + +DumpParsedXml=no + +# ----------------------------------------------------------------------------- + +# This final section is only an example which you may copy. Obviously, you need +# to uncomment the [Feeds] line, then uncomment any feed you like, or add your +# own. + +# [Feeds] +# Feed=NASA,http://science.nasa.gov/podcast.xml +# Feed=Brainwagon,http://brainwagon.org/feed/ +# Feed=InOurTime,http://www.bbc.co.uk/radio4/history/inourtime/mp3/podcast.xml + +# ----------------------------------------------------------------------------- |
|
From: Chilts <and...@us...> - 2005-07-18 09:03:14
|
Update of /cvsroot/pollpod/pollpod/conf In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv13738/pollpod/conf Modified Files: sample.ini Log Message: - README changes (from old sample.ini) Index: sample.ini =================================================================== RCS file: /cvsroot/pollpod/pollpod/conf/sample.ini,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- sample.ini 13 May 2005 12:59:44 -0000 1.1 +++ sample.ini 18 Jul 2005 09:03:05 -0000 1.2 @@ -46,7 +46,7 @@ # This option means that pollpod.pl will try and create any directories it # requires, including the PodCastSaveDir, any feed's directory and the DateDir. -MakeDirs=no +MakeDirs=yes # This option allows you to save the podcasts with a filename taken from the # feed. This will either be the name of the file taken from the last part of |
|
From: Chilts <and...@us...> - 2005-05-13 12:59:56
|
Update of /cvsroot/pollpod/pollpod/conf In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv4322/conf Modified Files: pollpod.ini Added Files: sample.ini Log Message: - added ability for program to first read /etc/pollpod.ini, then ~/.pollpod.ini, then an ability to override with new command line options - added sample.ini file for help and slight changes in pollpod.ini - a lot of re-arrangment to be nicer --- NEW FILE: sample.ini --- # ----------------------------------------------------------------------------- # This first section defines the default values for this installation of # pollpod.pl. These values are read first, then your own configuration file, # then any configuration file you choose to mention on the command line, then # finally, any command line option you require. # See /etc/pollpod.ini for a more compact version. # Note on yes/no options. Usually, the default value is a no, but can be set to # 'yes' if required. The option is turned on only if the value is 'yes' and it # is all lowercase. Anything else (including 'YES', 'y', 'ON', 'True' or # 'DoIt'), will be seen as 'no'. [Options] # This is the main directory where your feeds will be saved. Each feed will be # saved into it's own directory, the name of which is the name before the comma # in each of [Feeds]Feed lines. PodCastSaveDir=~/podcasts # If this option is set to 'yes', then pollpod.pl will attempt to only download # the latest podcast in each feed. In this circumstance, the latest podcast is # the one nearest the top of the file. SaveLatestOnly=no # If this option is set to 'yes', pollpod.pl will run pretty much as it should, # except that just before trying to download each podcast, it will internally # mark each one as done, hence when downloading is attempted, each podcast will # be skipped. TestOnly=no # If this option is set to 'yes', then each podcast that is encountered will be # marked as 'done'. This is achieved by 'touching' a file in the feed's # directory which is the name of the file appended with a '.done'. E.g. for a # file of the name '20050509_AShow.mp3', the file '20050509_AShow.mp3.done' # will be created so that show won't try and be downloaded again. If you # require to download that show in the future, just delete the '*.done' files # you don't equire and re-run pollpod.pl with this option not set to 'yes'. CatchUpAll=no # This option means that pollpod.pl will try and create any directories it # requires, including the PodCastSaveDir, any feed's directory and the DateDir. MakeDirs=no # This option allows you to save the podcasts with a filename taken from the # feed. This will either be the name of the file taken from the last part of # the URL (from the last /), or the title of the podcast taken from the title # element in the enclosure. # Valid values are 'url' or 'title'. # If you are unsure of this, leave it as 'url'. FieldForFilename=url # This option tries to replace both spaces and /'s in any filename with an # underscore. It is usually only useful if you have set the FieldForFilename # option to 'title'. If you don't know anything about this, leave the # FieldForFilename set to 'url' and NormaliseFilenames to 'no' and you should # be fine. NormaliseFilenames=no # Again, this option is usually only useful when you wish to use the # FieldForFilename set to 'title'. You can safely leave this as 'no' if you # have the above set to 'url'. PrecedeFilenamesWithDate=no # If you require create a dated directory containing links to all of the most # recently downloaded podcasts, set this option to 'yes' and be sure to set # DateDir too. MakeDateLinks=no # This directory is the one in which dated directories will be created which # will contain symbolic links to each of the latest podcasts that have been # downloaded. DateDir=~/podcasts/dates # If you require an M3U playlist file of all the latest downloaded podcasts, # set this option to 'yes'. CreateM3UPlayList=no # This specifies the file to save the playlist too if the above option is # 'yes'. M3UPlayListFile=~/podcasts/podcasts.m3u # These final two options are for the curious rather than the normal user. # This says whether to save the RSS XML feed. It is saved into each feed's # directory. It is saved as 'feed.xml'. SaveRssXmlFeeds=no # This says whether to save the RSS XML feed as a dump of the Perl data # structure. The files is saved into each feed's directory. Note: this is # really only for people interested in developing something, learning a bit # about Perl, or just the generally inquisitive person. The file is saved as # 'feed.dmp'. DumpParsedXml=no # ----------------------------------------------------------------------------- # This final section is only an example which you may copy. Obviously, you need # to uncomment the [Feeds] line, then uncomment any feed you like, or add your # own. # [Feeds] # Feed=NASA,http://science.nasa.gov/podcast.xml # Feed=Brainwagon,http://brainwagon.org/feed/ # Feed=InOurTime,http://www.bbc.co.uk/radio4/history/inourtime/mp3/podcast.xml # ----------------------------------------------------------------------------- Index: pollpod.ini =================================================================== RCS file: /cvsroot/pollpod/pollpod/conf/pollpod.ini,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- pollpod.ini 8 May 2005 03:29:56 -0000 1.2 +++ pollpod.ini 13 May 2005 12:59:43 -0000 1.3 @@ -1,18 +1,18 @@ [Options] PodCastSaveDir=~/podcasts -SaveRssXmlFeeds=yes -DumpParsedXml=yes SaveLatestOnly=no TestOnly=no CatchUpAll=no MakeDirs=yes -NormaliseFilenames=yes -PrecedeFilenamesWithDate=no FieldForFilename=url -DateBaseDir=~/podcasts/dates -MakeDateLinks=yes -CreateM3UPlayList=yes +NormaliseFilenames=no +PrecedeFilenamesWithDate=no +MakeDateLinks=no +DateDir=~/podcasts/dates +CreateM3UPlayList=no M3UPlayListFile=~/podcasts/podcasts.m3u +SaveRssXmlFeeds=no +DumpParsedXml=no [Feeds] Feed=FightingTalk,http://www.bbc.co.uk/fivelive/programmes/fightingtalk_podcast.xml |
|
From: Chilts <and...@us...> - 2005-05-13 12:59:56
|
Update of /cvsroot/pollpod/pollpod/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv4322/src Modified Files: pollpod.pl Log Message: - added ability for program to first read /etc/pollpod.ini, then ~/.pollpod.ini, then an ability to override with new command line options - added sample.ini file for help and slight changes in pollpod.ini - a lot of re-arrangment to be nicer Index: pollpod.pl =================================================================== RCS file: /cvsroot/pollpod/pollpod/src/pollpod.pl,v retrieving revision 1.3 retrieving revision 1.4 diff -u -d -r1.3 -r1.4 --- pollpod.pl 8 May 2005 10:32:36 -0000 1.3 +++ pollpod.pl 13 May 2005 12:59:44 -0000 1.4 @@ -27,89 +27,166 @@ use IO::File; use LWP::Simple; use XML::Simple; +use Getopt::Mixed "nextOption"; -my $cfg_file = "$ENV{HOME}/.pollpod.ini"; +my @options = qw( PodCastSaveDir + SaveLatestOnly + TestOnly + CatchUpAll + MakeDirs + FieldForFilename + NormaliseFilenames + PrecedeFilenamesWithDate + MakeDateLinks + DateDir + CreateM3UPlayList + M3UPlayListFile + SaveRssXmlFeeds + DumpParsedXml ); + +my $optionDesc = qq{s=s save-dir>s + l latest>l + t test-only>t + c catchup>c + m make-dirs>m + f=s filename>f + n normalise>n + p date-precede>p + d date-links>d + b=s date-dir>b + u create-m3u>u + e=s m3u-playlist-file>e + save-rssxml-feeds + dump-parsed-xml + config=s + h help>h +}; + +my $cmdLineToCfg = { + s => 'PodCastSaveDir', + l => 'SaveLatestOnly', + t => 'TestOnly', + c => 'CatchUpAll', + m => 'MakeDirs', + f => 'FieldForFilename', + n => 'NormaliseFilenames', + p => 'PrecedeFilenamesWithDate', + d => 'MakeDateLinks', + b => 'DateDir', + u => 'CreateM3UPlayList', + e => 'M3UPlayListFile', + 'save-rssxml-feeds' => 'SaveRssXmlFeeds', + 'dump-parsed-xml' => 'DumpParsedXml', + 'config' => 'ConfigFile', + h => 'help', +}; ## ---------------------------------------------------------------------------- MAIN: { - line('='); + my ($defaultCfg, $userCfg, $cmdLineCfg); - my ($data, $cfg); - $cfg = Config::IniFiles->new( -file => $cfg_file ); + # read the default config file, the command line, and the user (specified) config + $defaultCfg = readIniFileOptions('/etc/pollpod.ini'); + $cmdLineCfg = readCmdLineOptions(); + if ( defined $cmdLineCfg->{ConfigFile} ) { + $userCfg = readIniFileOptions($cmdLineCfg->{ConfigFile}); + } else { + $userCfg = readIniFileOptions("$ENV{HOME}/.pollpod.ini"); + } - $data = { - feeds => [], - }; - title('Reading in Options'); - readIniOptions($data, $cfg); + # see if they require help + if ( exists $cmdLineCfg->{help} ) { + usage(); + exit 2; + } + + # hierarchically save all the options + my $cfg = {}; + %$cfg = (%$defaultCfg, %$userCfg, %$cmdLineCfg); + + #print Data::Dumper->Dump( [$defaultCfg, $userCfg, $cmdLineCfg], + # ['default', 'user', 'cmdline'] ); + + # check the validity of the overall options + line('='); title('Validating Options'); - unless ( validateOptions($data) ) { - exit 0; + my $msg = validateOptions( $cfg ); + if ( defined $msg ) { + print STDERR $msg; + usage(); + exit 2; } + + # set up the main data structures for use in the program + my $data = { + feeds => [], + opts => $cfg, + }; + title('Reading in Feeds'); - readIniFeeds($data, $cfg); + readIniFeeds($data, "$ENV{HOME}/.pollpod.ini"); - # print Data::Dumper->Dumper([$data], ['data']); + # print Data::Dumper->Dump([$data], ['data']); title('Checking Save Directories'); checkSaveDirs($data) - if $data->{Options}{MakeDirs} eq 'yes'; + if $data->{opts}{MakeDirs} eq 'yes'; title('Fetching All Feeds'); fetchAllFeeds($data); title('Saving RSS XML Feeds'); saveRssXmlFeeds($data) - if $data->{Options}{SaveRssXmlFeeds} eq 'yes'; + if $data->{opts}{SaveRssXmlFeeds} eq 'yes'; title('Parsing Feeds'); parseFeeds($data); title('Dumping Parsed XML'); dumpParsedXml($data) - if $data->{Options}{DumpParsedXml} eq 'yes'; + if $data->{opts}{DumpParsedXml} eq 'yes'; title('Extracting Items'); extractItemsWithPodCasts($data); title('Extracting filenames'); - extractFilename($data, $data->{Options}{FieldForFilename}); + extractFilename($data, $data->{opts}{FieldForFilename}); title('Normalising Filenames'); normaliseFilenames($data) - if $data->{Options}{NormaliseFilenames} eq 'yes'; + if $data->{opts}{NormaliseFilenames} eq 'yes'; title('Preceeding Filenames with Date'); precedeFilenamesWithDate($data) - if $data->{Options}{PrecedeFilenamesWithDate} eq 'yes'; + if $data->{opts}{PrecedeFilenamesWithDate} eq 'yes'; title('Catching Up PodCasts'); catchUpAll($data) - if $data->{Options}{CatchUpAll} eq 'yes'; + if $data->{opts}{CatchUpAll} eq 'yes'; title('Skip Downloaded'); skipDownloaded($data); title('Save Latest Only'); saveLatestOnly($data) - if $data->{Options}{SaveLatestOnly} eq 'yes'; + if $data->{opts}{SaveLatestOnly} eq 'yes'; title('Testing Only'); testOnly($data) - if $data->{Options}{TestOnly} eq 'yes'; + if $data->{opts}{TestOnly} eq 'yes'; title('Fetching PodCasts'); fetchPodCasts($data); title('Making Date Links'); makeDateLinks($data) - if $data->{Options}{MakeDateLinks} eq 'yes'; + if $data->{opts}{MakeDateLinks} eq 'yes'; title('Creating Play List (m3u)'); createM3UPlayList($data) - if $data->{Options}{CreateM3UPlayList} eq 'yes'; + if $data->{opts}{CreateM3UPlayList} eq 'yes'; title('Finished'); fmsg('Exiting', 'Byeeee...!'); @@ -117,26 +194,94 @@ } ## ---------------------------------------------------------------------------- +# subs + +sub usage +{ + print <<EOF +Usage: $0 [options...] +Options: + -s,save-dir the main directory to save podcasts too + -l,--latest save only the most recent podast from each feed + -t,--test do not save anything (podcasts, catchup files) + -c,--catchup catchup all feeds and all podcasts + -m,--make-dirs create required directories when running + -f,--filename <name> field to create the filenames from ('url' or 'title') + -n,--normalise normalise filenames so spaces and slashes become spaces + -p,--date-precede precede all saved filenames with the date + -d,--date-links create dirs and link from date/YYYYMMDD directory + -b,--date-dir <dir> the directory to save the date directories and links in + -u,--create-m3u creates a file of type 'm3u' in the main dir + -e,--m3u-playlist-file name of the file in the above m3u discussion + --save-rssxml-feeds save the feeds in the main directory as 'feed.xml' + --dump-parsed-xml save the parsed feeds in the main directory as 'feed.dmp' + --config specify a config file to use instead of ~/.pollpod.ini + -h,--help this help screen + +Copyright Andrew Chilton (see http://www.chilts.org/software/) +EOF +} + +## ---------------------------------------------------------------------------- # processes +sub readIniFileOptions +{ + my ($filename) = @_; + + return {} unless -f $filename; + + my $cfg = {}; + + my $config; + $config = eval { Config::IniFiles->new( -file => $filename ); }; + if ( $@ ) { + warn "Couldn't open config file: $@"; + return {}; + } + + foreach ( @options ) { + my $value = $config->val('Options', $_); + $cfg->{$_} = $value if defined $value; + } + + return $cfg; +} + +sub readCmdLineOptions +{ + my $cmdLineCfg = {}; + Getopt::Mixed::init($optionDesc); + while (my ($option, $value, $pretty) = nextOption()) { + $cmdLineCfg->{$option} = $value || 'yes'; + } + Getopt::Mixed::cleanup(); + + my $cfg = {}; + foreach ( keys %$cmdLineCfg ) { + $cfg->{$cmdLineToCfg->{$_}} = $cmdLineCfg->{$_}; + } + + return $cfg; +} + sub readIniOptions { my ($data, $cfg) = @_; - $data->{Options}{PodCastSaveDir} = tilde($cfg->val('Options', 'PodCastSaveDir')); - $data->{Options}{MakeDateLinks} = $cfg->val('Options', 'MakeDateLinks'); - $data->{Options}{TestOnly} = $cfg->val('Options', 'TestOnly'); - $data->{Options}{SaveRssXmlFeeds} = $cfg->val('Options', 'SaveRssXmlFeeds'); - $data->{Options}{DumpParsedXml} = $cfg->val('Options', 'DumpParsedXml'); - $data->{Options}{CatchUpAll} = $cfg->val('Options', 'CatchUpAll'); - $data->{Options}{MakeDirs} = $cfg->val('Options', 'MakeDirs'); - $data->{Options}{Feed} = $cfg->val('Options', 'Feed'); - $data->{Options}{NormaliseFilenames} = $cfg->val('Options', 'NormaliseFilenames'); - $data->{Options}{SaveLatestOnly} = $cfg->val('Options', 'SaveLatestOnly'); - $data->{Options}{PrecedeFilenamesWithDate} = $cfg->val('Options', 'PrecedeFilenamesWithDate'); - $data->{Options}{FieldForFilename} = $cfg->val('Options', 'FieldForFilename'); - $data->{Options}{DateBaseDir} = tilde($cfg->val('Options', 'DateBaseDir')); - $data->{Options}{CreateM3UPlayList} = $cfg->val('Options', 'CreateM3UPlayList'); - $data->{Options}{M3UPlayListFile} = tilde($cfg->val('Options', 'M3UPlayListFile')); + $data->{opts}{PodCastSaveDir} = tilde($cfg->val('Options', 'PodCastSaveDir')); + $data->{opts}{SaveRssXmlFeeds} = $cfg->val('Options', 'SaveRssXmlFeeds'); + $data->{opts}{DumpParsedXml} = $cfg->val('Options', 'DumpParsedXml'); + $data->{opts}{SaveLatestOnly} = $cfg->val('Options', 'SaveLatestOnly'); + $data->{opts}{TestOnly} = $cfg->val('Options', 'TestOnly'); + $data->{opts}{CatchUpAll} = $cfg->val('Options', 'CatchUpAll'); + $data->{opts}{MakeDirs} = $cfg->val('Options', 'MakeDirs'); + $data->{opts}{NormaliseFilenames} = $cfg->val('Options', 'NormaliseFilenames'); + $data->{opts}{PrecedeFilenamesWithDate} = $cfg->val('Options', 'PrecedeFilenamesWithDate'); + $data->{opts}{FieldForFilename} = $cfg->val('Options', 'FieldForFilename'); + $data->{opts}{MakeDateLinks} = $cfg->val('Options', 'MakeDateLinks'); + $data->{opts}{DateDir} = tilde($cfg->val('Options', 'DateDir')); + $data->{opts}{CreateM3UPlayList} = $cfg->val('Options', 'CreateM3UPlayList'); + $data->{opts}{M3UPlayListFile} = tilde($cfg->val('Options', 'M3UPlayListFile')); fmsg('Options', "Read in all the options"); } @@ -144,18 +289,21 @@ sub validateOptions { my ($data) = @_; - # ??? fmsg('Options', "All validated"); - return 1; + return; } sub readIniFeeds { - my ($data, $cfg) = @_; + my ($data, $inifile) = @_; + + return {} unless -f $inifile; my $error=0; my $ok=0; + my $cfg = eval { Config::IniFiles->new( -file => $inifile ); }; + my @feeds = $cfg->val('Feeds', 'Feed'); foreach my $feedline ( @feeds ) { # IniFiles BUG? get 1 undefined element even if no feeds in ini file @@ -169,7 +317,7 @@ } push @{$data->{feeds}}, { feedName => $feedName, - fullDir => "$data->{Options}{PodCastSaveDir}/$feedName", + fullDir => "$data->{opts}{PodCastSaveDir}/$feedName", url => $feed, }; @@ -349,8 +497,6 @@ next; } - # print Data::Dumper->Dump([$item], ['item']); - # save the item we have left to the podcasts push @{$feed->{podcasts}}, { title => $item->{title}, @@ -449,10 +595,10 @@ my $no_dir=0; my $ok=0; - if ( check_dir_exists($data->{Options}{PodCastSaveDir}) ) { - tmsg('SaveDirExists', $data->{Options}{PodCastSaveDir}); + if ( check_dir_exists($data->{opts}{PodCastSaveDir}) ) { + tmsg('SaveDirExists', $data->{opts}{PodCastSaveDir}); } else { - tmsg('NoSaveDir', " $data->{Options}{PodCastSaveDir} - couldn't create"); + tmsg('NoSaveDir', " $data->{opts}{PodCastSaveDir} - couldn't create"); foreach my $feed ( @{$data->{feeds}} ) { $feed->{done} = 1; } @@ -662,18 +808,18 @@ return; } - if ( check_dir_exists($data->{Options}{DateBaseDir}) ) { - tmsg('DateDirExists', "$data->{Options}{DateBaseDir}"); + if ( check_dir_exists($data->{opts}{DateDir}) ) { + tmsg('DateDirExists', "$data->{opts}{DateDir}"); } else { - tmsg('NoDateDir', " $data->{Options}{DateBaseDir} - couldn't create"); + tmsg('NoDateDir', " $data->{opts}{DateDir} - couldn't create"); return; } my $date = get_date(); - if ( check_dir_exists("$data->{Options}{DateBaseDir}/$date") ) { - tmsg('DateDirExists', "$data->{Options}{DateBaseDir}/$date"); + if ( check_dir_exists("$data->{opts}{DateDir}/$date") ) { + tmsg('DateDirExists', "$data->{opts}{DateDir}/$date"); } else { - tmsg('NoDateDir', " $data->{Options}{DateBaseDir}/$date - couldn't create"); + tmsg('NoDateDir', " $data->{opts}{DateDir}/$date - couldn't create"); return; } @@ -688,15 +834,15 @@ next if $podcast->{done}; # see if there already is a symlink - if ( -l "$data->{Options}{DateBaseDir}/$date/$podcast->{filename}" ) { + if ( -l "$data->{opts}{DateDir}/$date/$podcast->{filename}" ) { tmsg( 'ExistsAlready', - "$data->{Options}{DateBaseDir}/$date/$podcast->{filename}" ); + "$data->{opts}{DateDir}/$date/$podcast->{filename}" ); $exists++; next; } # link to downloaded file - unless ( symlink "$feed->{fullDir}/$podcast->{filename}", "$data->{Options}{DateBaseDir}/$date/$podcast->{filename}" ) { + unless ( symlink "$feed->{fullDir}/$podcast->{filename}", "$data->{opts}{DateDir}/$date/$podcast->{filename}" ) { tmsg( 'Failed', "Linking $date/ -> $podcast->{filename}" ); $failed++; @@ -719,7 +865,7 @@ { my ($data) = @_; - my $filename = $data->{Options}{M3UPlayListFile}; + my $filename = $data->{opts}{M3UPlayListFile}; unless ( open(PLAYLIST, ">$filename") ) { tmsg( 'Failed', "Can't open file $filename for writing: $!" ); @@ -755,21 +901,13 @@ sub title { my ($title) = @_; - print "--- $title ---", ('-' x (71-length($title))); - print "\n"; + print "--- $title ---", '-' x (71-length($title)), "\n"; } sub line { my ($char) = @_; - print ($char x 79); - print "\n"; -} - -sub dump_feed -{ - my ($ref) = @_; - print Data::Dumper->Dump([$ref], ['ref']); + print $char x 79, "\n"; } sub check_dir_exists |
|
From: Chilts <and...@us...> - 2005-05-08 10:33:15
|
Update of /cvsroot/pollpod/pollpod/scripts In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv31096/scripts Log Message: Directory /cvsroot/pollpod/pollpod/scripts added to the repository |
|
From: Chilts <and...@us...> - 2005-05-08 10:32:45
|
Update of /cvsroot/pollpod/pollpod/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv30978 Modified Files: pollpod.pl Log Message: - added header with copyright information Index: pollpod.pl =================================================================== RCS file: /cvsroot/pollpod/pollpod/src/pollpod.pl,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- pollpod.pl 8 May 2005 03:29:56 -0000 1.2 +++ pollpod.pl 8 May 2005 10:32:36 -0000 1.3 @@ -1,4 +1,22 @@ #!/usr/bin/perl +## -------------------------------------------------------------------*-perl-*- +# Created : 20050506 +# By : Andrew Chilton +# Email : < apc AT chilts DOT org > +# Website : http://www.chilts.org/ +# Copyright : (c) Andrew Chilton 2005 +# +# File : $RCSfile$ +# LastModBy : $Author$ +# On : $Date$ +# Revision : $Revision$ +# +# Copyright (C) 2005 Andrew Chilton. All Rights Reserved. +# +# This module is free software; you can redistribute it and/or modify it under +# the same terms as Perl itself. +# +# See http://www.perl.com/language/misc/Artistic.html ## ---------------------------------------------------------------------------- use strict; @@ -155,7 +173,7 @@ url => $feed, }; - tmsg( 'NewFeed', + tmsg( 'Feed', "$feedName/$feed"); $ok++; } |
|
From: Chilts <and...@us...> - 2005-05-08 03:30:05
|
Update of /cvsroot/pollpod/pollpod/conf In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv12230/pollpod/conf Modified Files: pollpod.ini Log Message: - added ability to save both the XML feed and parsed (XML::Simple) version - added example options to config file - Minor: made a couple of tmsg()s to be fmsg()s Index: pollpod.ini =================================================================== RCS file: /cvsroot/pollpod/pollpod/conf/pollpod.ini,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- pollpod.ini 6 May 2005 13:57:38 -0000 1.1 +++ pollpod.ini 8 May 2005 03:29:56 -0000 1.2 @@ -1,8 +1,9 @@ [Options] PodCastSaveDir=~/podcasts +SaveRssXmlFeeds=yes +DumpParsedXml=yes SaveLatestOnly=no TestOnly=no -DumpItemsInFeed=no CatchUpAll=no MakeDirs=yes NormaliseFilenames=yes |
|
From: Chilts <and...@us...> - 2005-05-08 03:30:05
|
Update of /cvsroot/pollpod/pollpod/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv12230/pollpod/src Modified Files: pollpod.pl Log Message: - added ability to save both the XML feed and parsed (XML::Simple) version - added example options to config file - Minor: made a couple of tmsg()s to be fmsg()s Index: pollpod.pl =================================================================== RCS file: /cvsroot/pollpod/pollpod/src/pollpod.pl,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- pollpod.pl 6 May 2005 13:57:38 -0000 1.1 +++ pollpod.pl 8 May 2005 03:29:56 -0000 1.2 @@ -42,9 +42,17 @@ title('Fetching All Feeds'); fetchAllFeeds($data); + title('Saving RSS XML Feeds'); + saveRssXmlFeeds($data) + if $data->{Options}{SaveRssXmlFeeds} eq 'yes'; + title('Parsing Feeds'); parseFeeds($data); + title('Dumping Parsed XML'); + dumpParsedXml($data) + if $data->{Options}{DumpParsedXml} eq 'yes'; + title('Extracting Items'); extractItemsWithPodCasts($data); @@ -99,7 +107,8 @@ $data->{Options}{PodCastSaveDir} = tilde($cfg->val('Options', 'PodCastSaveDir')); $data->{Options}{MakeDateLinks} = $cfg->val('Options', 'MakeDateLinks'); $data->{Options}{TestOnly} = $cfg->val('Options', 'TestOnly'); - $data->{Options}{DumpItemsInFeed} = $cfg->val('Options', 'DumpItemsInFeed'); + $data->{Options}{SaveRssXmlFeeds} = $cfg->val('Options', 'SaveRssXmlFeeds'); + $data->{Options}{DumpParsedXml} = $cfg->val('Options', 'DumpParsedXml'); $data->{Options}{CatchUpAll} = $cfg->val('Options', 'CatchUpAll'); $data->{Options}{MakeDirs} = $cfg->val('Options', 'MakeDirs'); $data->{Options}{Feed} = $cfg->val('Options', 'Feed'); @@ -181,6 +190,33 @@ "- $failed failed" ); } +sub saveRssXmlFeeds +{ + my ($data) = @_; + + my $failed=0; + my $ok=0; + + foreach my $feed ( @{$data->{feeds}} ) { + next if $feed->{done}; + + my $fh = IO::File->new("$feed->{fullDir}/feed.xml", O_WRONLY|O_CREAT); + unless ( defined $fh ) { + tmsg('Failed', "Couldn't open file $feed->{fullDir}/feed.xml"); + $failed++; + next; + } + + print $fh $feed->{xml}; + undef $fh; + tmsg('Written', "$feed->{feedName}/feed.xml"); + $ok++; + } + fmsg( 'SaveXmlFeeds', + "Saved $ok feeds", + "- $failed failed writing" ); +} + sub parseFeeds { my ($data) = @_; @@ -206,10 +242,37 @@ $ok++; } fmsg( 'ParseXml', - "Parsed $ok valid RSS feed(s):", + "Parsed $ok well-formed RSS feed(s):", "- $failed failed" ); } +sub dumpParsedXml +{ + my ($data) = @_; + + my $failed=0; + my $ok=0; + + foreach my $feed ( @{$data->{feeds}} ) { + next if $feed->{done}; + + my $fh = IO::File->new("$feed->{fullDir}/feed.dmp", O_WRONLY|O_CREAT); + unless ( defined $fh ) { + tmsg('Failed', "Couldn't open file $feed->{feedName}/feed.dmp"); + $failed++; + next; + } + + print $fh Data::Dumper->Dump([$feed->{struct}], ['feed']); + undef $fh; + tmsg('Written', "$feed->{feedName}/feed.dmp"); + $ok++; + } + fmsg( 'DumpParsedXml', + "Saved $ok feeds", + "- $failed failed writing" ); +} + sub extractItemsWithPodCasts { my ($data) = @_; @@ -529,7 +592,7 @@ next if $podcast->{done}; tmsg( 'Fetching', - "$podcast->{orig_filename}..." ); + "$podcast->{orig_filename} ($podcast->{length})..." ); # get it my $filename = "$feed->{fullDir}/$podcast->{filename}"; @@ -628,7 +691,7 @@ } } - tmsg( 'DateLinks', + fmsg( 'DateLinks', "Created ($ok) links to podcasts:", "- $exists links already exist", "- $failed links failed" ); @@ -664,7 +727,7 @@ close(PLAYLIST); - tmsg( 'PlayList', + fmsg( 'PlayList', "Created ($ok) entries in playlist ($filename)" ); } |