diff -Nru scr/archive/mp3db2/VERSION mp3db2/VERSION --- scr/archive/mp3db2/VERSION 2009-09-07 01:10:18.000000000 -0400 +++ mp3db2/VERSION 2009-09-29 22:04:07.000000000 -0400 @@ -1 +1 @@ -3.0.3 Mon Sep 7 01:10:06 EDT 2009 +3.1.7 Tue Sep 29 22:03:54 EDT 2009 diff -Nru scr/archive/mp3db2/changes mp3db2/changes --- scr/archive/mp3db2/changes 2009-09-06 23:15:57.000000000 -0400 +++ mp3db2/changes 2009-09-20 19:49:22.000000000 -0400 @@ -1,3 +1,18 @@ +Sun Sep 20 16:11:57 EDT 2009 ground/X +configure: Removed comments from the configuration file. +mp3gen mp3dupe: Fixed a bug triggered by a dash as the first character +in a directory name. +mp3dupe: Updated scan_dir function. Still needs testing. +mp3gen mp3dupe: default source directory now defaults to the current +directory instead of /cdrom +mp3gen: Fix typo scandir is now scan_dir + +Tue Sep 8 20:10:29 EDT 2009 ground/X +mp3gen: import fixes to scan_dir function from utils package. + +Mon Sep 7 02:28:42 EDT 2009 ground/X +Version 3.0 released. + Sun Sep 6 17:26:44 EDT 2009 ground/X mp3: Remove code to display database last modification time-buggy. mp3size: Better sanity checking of the datafile. diff -Nru scr/archive/mp3db2/ckrelease mp3db2/ckrelease --- scr/archive/mp3db2/ckrelease 2003-04-03 20:16:25.000000000 -0500 +++ mp3db2/ckrelease 2009-09-29 21:56:55.000000000 -0400 @@ -8,11 +8,11 @@ # Right now this mostly serves to check for syntax errors in the scripts # that would keep them from running. -ident='ckrelease (V2.72) Sat Mar 22 22:57:50 EST 2003 ground/X' +ident='ckrelease (V3.11) Tue Sep 29 21:40:24 EDT 2009 ground/X' scripts="mp3 mp3gen mp3ndx makeplete mp3size mp3dupe configure \ get_dev_version \ utils/genrmd5 utils/renlower utils/rt.rec utils/vercd utils/riffstrip \ -utils/makewav" +utils/makewav utils/rr/rr.lib" function check_script { if ! $1 --version diff -Nru scr/archive/mp3db2/configure mp3db2/configure --- scr/archive/mp3db2/configure 2003-10-25 00:57:34.000000000 -0400 +++ mp3db2/configure 2009-09-20 19:33:30.000000000 -0400 @@ -14,7 +14,7 @@ program_path="$0" pkg_files='mp3 mp3gen mp3ndx makeplete mp3size mp3dupe' debug='0' -ident='configure (V2.88) Fri Oct 24 23:57:01 EST 2003 ground/X' +ident='configure (V3.11) Sun Sep 20 19:32:46 EDT 2009 ground/X' function init_variables { # hstarting values for configuration variables. @@ -374,8 +374,6 @@ # End function. function write_cfg_file { # write the configuration file to disk. -# The formatting is kind of strange here because I tried to keep the format from -# the original configuration file. # Notice all multiple lines are in double quotes to process the new line # escape char. local write_date=`date` @@ -386,85 +384,23 @@ echo "Error: Could not write to configuration file: $cfg_file" return 1 fi +write_comment "MP3DB2 configuration file .mp3db2rc" write_comment "Auto-generated by $ident" write_comment "Settings last saved: $write_date" write_comment -write_comment 'The mp3 database project II' -write_comment 'Configuration file.' -write_comment "This file contains variables that are used by more than \ -one of the programs." -write_comment 'This includes database directory ect.' -write_comment -write_comment "This is the directory where the MP3 database will be \ -stored." -write_comment "It should start out pointing to an empty directory. The \ -mp3gen script" -write_comment 'will creat the needed files as required.' write_variable data_dir "$data_dir" -write_comment -write_comment "This is the directory where the mp3ndx script will store \ -the main and" -write_comment '# default search indexes.' -write_comment "It should start out pointing to an empty directory, the \ -mp3ndx script will" -write_comment 'create the needed files the first time it is run.' write_variable ndx_dir "$ndx_dir" -write_comment -write_comment "This is a filenask in standerd shell format that should \ -match every filename" -write_comment 'that you give to mp3gen when adding CDs to the database.' -write_comment 'For example I use names like "mp3_cd_001" etc' -write_comment 'See the README file for more info on this variable.' write_variable mask "$mask" -write_comment -write_comment 'The path where these (the mp3 DB) scripts are installed.' write_variable script_path "$script_path" -write_comment -write_comment 'The pager to use to display matches' write_variable pager "$pager" -write_comment -write_comment "This is the index file used to speed up searches. It is \ -not created" -write_comment 'unless you use the mp3ndx script.' write_variable ndx '$ndx_dir/main.ndx' -write_comment -write_comment "This is the file that makeplete will generate. it will \ -be a listing of" -write_comment 'complete albums including bitrate.' write_variable pletes_file "$pletes_file" -write_comment -write_comment "The fields we search by default if we aren't given a \ -search on the" -write_comment 'command line. look at the spec file for a listing.' -write_comment 'These must be given as field numbers separated with ","' -write_comment 'We currently search the following fields:' -write_comment "# 1: Filename, 2: title, 3: artist, 4:album, 11: \ -directory." -write_comment "Note that if you are using an index you must regenerate \ -it after changing this" -write_comment 'option for the changes to take affect.' write_variable default_search_fields "$default_search_fields" -write_comment -write_comment 'Optional contributed packages:' -write_comment -write_comment "If you would like to use the database to HTML converter \ -in the" -write_comment "contrib/mp3dbhtml directory you must define a location \ -for the HTML" -write_comment 'indexes.' -write_comment "This should start out pointing to an empty directory to \ -which you have" -write_comment 'write permission.' write_variable html_dir '$ndx_dir/html' -write_comment -write_comment "These are sub directories that will be created in the \ -html_dir path." write_variable cd_index_dir "$cd_index_dir" write_variable alb_index_dir "$alb_index_dir" write_variable art_index_dir "$art_index_dir" write_variable file_index_dir "$file_index_dir" -write_comment -write_comment 'End of configuration file...' echo "Configuration settings saved to: $cfg_file." return 0 } diff -Nru scr/archive/mp3db2/mp3dupe mp3db2/mp3dupe --- scr/archive/mp3db2/mp3dupe 2004-02-16 13:27:40.000000000 -0500 +++ mp3db2/mp3dupe 2009-09-20 19:47:48.000000000 -0400 @@ -2,14 +2,14 @@ # The mP3 database project II # duplicate checker -# This script will check a cd mounted in /cdrom by default to see which -# of the albums are already mlisted in the database. +# This script will check a path to see which of the albums in that directory +# are already listed in the database. # This script depends on the mp3 module for access to the mp3 database. mp3db2_cfg_file="$HOME/.mp3db2rc" -ident='mp3dupe (V2.91) Mon Feb 16 13:27:07 EST 2004 ground/X' +ident='mp3dupe (V3.13) Sun Sep 20 16:11:57 EDT 2009 ground/X' have_cd='1' # set to 0 if this CD is not in the DB -default_source='/cdrom' +default_source=`pwd` check_files='0' #cmdline bool use_pletes='0' #cmdline, bool @@ -157,35 +157,42 @@ } # End function. function scan_dir { -# Recurses through directories calling the handle_dir function on each one +# Recurses through directories calling the handle_dir function. # Also keeps $cwd updated to the current working directory. -cwd=`pwd` -local search_path -if [ "$cwd" = '/' -o "$cwd" = '//' ] +# Function version 1.4 20090920 +local cwd current_scanning cxpath +cwd="`pwd`" +# Do we need to exclude this path +if [ "$exclude_paths" != '' ] then -search_path='' -else -search_path="$cwd" +for cxpath in $exclude_paths +do +if [ "$cwd" = "$cxpath" -o "$cwd" = "/${cxpath}" ] +then +echo "Skipping $cwd at user request." +return 0 +fi +done fi handle_dir -for current in $search_path/* +for current_scanning in * do -if test -d "$current" -a ! -L "$current" +if test -d "$current_scanning" -a ! -L "$current_scanning" then -if cd "$current" +if cd -- "$current_scanning" then -cwd=`pwd` +cwd="`pwd`" scan_dir -cd .. -cwd=`pwd` +cd '..' +cwd="`pwd`" else -echo "$current: Error couldn't chdir." +echo "$current_scanning: Error couldn't chdir." fi fi done return 0 } - # End function. +# End function. function handle_dir { # Does the actual checking on this dir and filename # Check to see if we got called on an empty dir: diff -Nru scr/archive/mp3db2/mp3gen mp3db2/mp3gen --- scr/archive/mp3db2/mp3gen 2009-09-06 19:26:05.000000000 -0400 +++ mp3db2/mp3gen 2009-09-20 17:15:17.000000000 -0400 @@ -6,9 +6,9 @@ # Updated to vercd2.02 to fix bugs found by digigod # The mp3info command line utility is required to use this program. -ident='mp3gen (V3.02) Sun Sep 6 19:25:33 EDT 2009 ground/X' +ident='mp3gen (V3.13) Sun Sep 20 16:11:57 EDT 2009 ground/X' mp3db2_cfg_file="$HOME/.mp3db2rc" -default_source='/cdrom' +default_source=`pwd` outfile='' # cmdline auto_update='0' # cmdline base_file='' # set in parse_cmdline @@ -100,30 +100,37 @@ return 0 } # End function. -function scandir { -# Recurses through directories calling the handle_dir function on each one +function scan_dir { +# Recurses through directories calling the handle_dir function. # Also keeps $cwd updated to the current working directory. -cwd=`pwd` -local search_path -if [ "$cwd" = '/' -o "$cwd" = '//' ] +# Function version 1.4 20090920 +local cwd current_scanning cxpath +cwd="`pwd`" +# Do we need to exclude this path +if [ "$exclude_paths" != '' ] then -search_path='' -else -search_path="$cwd" +for cxpath in $exclude_paths +do +if [ "$cwd" = "$cxpath" -o "$cwd" = "/${cxpath}" ] +then +echo "Skipping $cwd at user request." +return 0 +fi +done fi handle_dir -for current in $search_path/* +for current_scanning in * do -if test -d "$current" -a ! -L "$current" +if test -d "$current_scanning" -a ! -L "$current_scanning" then -if cd "$current" +if cd -- "$current_scanning" then -cwd=`pwd` -scandir -cd .. -cwd=`pwd` +cwd="`pwd`" +scan_dir +cd '..' +cwd="`pwd`" else -echo "$current: Error couldn't chdir." +echo "$current_scanning: Error couldn't chdir." fi fi done @@ -207,7 +214,7 @@ echo "Source path $default_source does not exist" exit 1 fi -scandir +scan_dir echo "$base_file successfully added to database." if [ "$auto_update" = '1' ] then diff -Nru scr/archive/mp3db2/todo mp3db2/todo --- scr/archive/mp3db2/todo 2009-09-06 18:49:00.000000000 -0400 +++ mp3db2/todo 2009-09-29 22:03:26.000000000 -0400 @@ -1,4 +1,6 @@ -id: todo Sun Sep 6 18:48:36 EDT 2009 ground/X +id: todo Tue Sep 29 21:40:24 EDT 2009 ground/X + +mp3gen: Make exclude option work. already in scan_dir function. configure offer option to check the config file in the menu. diff -Nru scr/archive/mp3db2/utils/README mp3db2/utils/README --- scr/archive/mp3db2/utils/README 2002-10-27 02:57:14.000000000 -0500 +++ mp3db2/utils/README 2009-09-29 21:49:51.000000000 -0400 @@ -1,4 +1,4 @@ -ID: utils/README Sun Oct 27 02:42:55 EST 2002 ground/X +ID: utils/README Tue Sep 29 21:40:24 EDT 2009 ground/X The MP3 Database Project II extra support utilities @@ -36,3 +36,7 @@ checksum.md5 files. If you use md5sum to generate checksum.md5 files on your MP3 cDs this script will verify that the CD is error free. +rr: Scripts for scheduling live recordings using the included rt.rec +script. Look at the README file in the utils/rr subdirectory for more +information. + diff -Nru scr/archive/mp3db2/utils/changes mp3db2/utils/changes --- scr/archive/mp3db2/utils/changes 2009-03-01 17:38:35.000000000 -0500 +++ mp3db2/utils/changes 2009-09-29 21:47:33.000000000 -0400 @@ -1,3 +1,22 @@ +Tue Sep 29 21:40:24 EDT 2009 ground/X +Murged radio recording project in rr subdirectory. + +Sun Sep 20 17:23:36 EDT 2009 ground/X +genrmd5 vercd renlower: Fixed a bug triggered by a dash as the first +character in a directory name. + +Fri Sep 18 18:20:44 EDT 2009 ground/X +genrmd5: Can now limit the included files by extension. +genrmd5: sfv file now called 000.sfv +genrmd5: Empty directories no longer contain blank sfv files. + +Tue Sep 8 19:34:34 EDT 2009 +genrmd5 renlower vercd: Update scan_dir function to fix a bug that would +cause the program to fail to recurse directories if the parent directory +contained a space. +renlower: ` is now removed from filenames. +renlower: Files are no longer renamed if there is a conflict. + Sun Mar 1 17:37:04 EST 2009 ground/X rt.rec: -enco option for extra encoder options. rt.rec: Fix to log function-recursion diff -Nru scr/archive/mp3db2/utils/genrmd5 mp3db2/utils/genrmd5 --- scr/archive/mp3db2/utils/genrmd5 2007-09-09 11:18:23.000000000 -0400 +++ mp3db2/utils/genrmd5 2009-09-20 17:19:25.000000000 -0400 @@ -11,13 +11,15 @@ # checksums in to one file. # Global variables: -ident='genrmd5 (V2.09) Sun Sep 9 11:17:47 EDT 2007 ground/X' +ident='genrmd5 (V2.14) Sun Sep 20 16:11:57 EDT 2009 ground/X' nohdr='./checksum.md5-noheader' final='./checksum.md5' exclude_paths='' # cmdline remove_only='0' # cmdline update='0' # cmdline +file_mask='*' # cmdline create_sfv='0' # cmdline,requires cksfv +sfv_name='000.sfv' function abort_cleanup { # This function is called on ctrl-c @@ -27,7 +29,7 @@ rm -f $nohdr rm -f $final else -rm -f 00.sfv +rm -f "$sfv_name" fi if [ "$1" = 'exit' ] then @@ -38,17 +40,17 @@ } # End function. function scan_dir { -# Recurses through directories calling the handle_dir function on each one +# Recurses through directories calling the handle_dir function. # Also keeps $cwd updated to the current working directory. -local cwd current search_mask -cwd=`pwd` +# Function version 1.4 20090920 +local cwd current_scanning cxpath +cwd="`pwd`" # Do we need to exclude this path -if [ "$exclude_paths" != "" ] +if [ "$exclude_paths" != '' ] then -local cpath -for cpath in $exclude_paths +for cxpath in $exclude_paths do -if [ "$cwd" = "$cpath" -o "$cwd" = "/${cpath}" ] +if [ "$cwd" = "$cxpath" -o "$cwd" = "/${cxpath}" ] then echo "Skipping $cwd at user request." return 0 @@ -56,27 +58,18 @@ done fi handle_dir -# Don't add an extra / if we are in the root directory. -# This was causing problems under cygwin -# genrmd5 is first to have this fix it should be folded back. -if [ "$cwd" = "/" ] -then -search_mask='/*' -else -search_mask="$cwd/*" -fi -for current in $search_mask +for current_scanning in * do -if test -d "$current" -a ! -L "$current" +if test -d "$current_scanning" -a ! -L "$current_scanning" then -if cd "$current" +if cd -- "$current_scanning" then -cwd=`pwd` +cwd="`pwd`" scan_dir -cd .. -cwd=`pwd` +cd '..' +cwd="`pwd`" else -echo "$current: Error couldn't chdir." +echo "$current_scanning: Error couldn't chdir." fi fi done @@ -86,24 +79,24 @@ function handle_dir { # Generates the checksum.md5 file for this directory. # Also takes care of removing the file at the end if it is empty. -local filesize +local filesize hkbsize sfv_last_line local date=`date` echo "$cwd" -abort_cleanup +abort_cleanup # Just to remove the old file does not exit. if [ "$remove_only" = '1' ] then return 0 fi if [ "$create_sfv" = '0' ] then -md5sum -- * > $nohdr +md5sum -- $file_mask > $nohdr filesize=`du -b $nohdr |cut -f1` if [ "$filesize" = "0" ] then rm -f $nohdr # guess we don't need it after all. return 0 fi -local hkbsize=`du -ms |cut -f1` +hkbsize=`du -ms |cut -f1` echo "# MD5 file generated: $date" > $final echo "# Generating host: $HOSTNAME" >> $final echo "# Directory: $cwd" >> $final @@ -112,9 +105,10 @@ cat $nohdr >> $final rm -f $nohdr else -cksfv * > 00.sfv -filesize=`wc -l 00.sfv |cut -d " " -f7` # number of lines in file -if [ "$filesize" = '3' ] +rm -f "$sfv_name" +cksfv $file_mask > "$sfv_name" +sfv_last_line=`tail -n1 "$sfv_name"` +if [ "$sfv_last_line" = ';' ] then abort_cleanup fi @@ -133,27 +127,11 @@ then usage_info exit 0 -elif [ "$1" = "-x" ] +elif [ "$1" = '-x' ] then shift -if [ "$1" = "" ] -then -echo '-x: Option requires an argument ' -exit 1 -fi -if test -d "$1" -then -if [ "$exclude_paths" = "" ] -then -exclude_paths="$1" -else -exclude_paths="$exclude_paths $1" -fi +cmdline_add_exclude_path "$1" shift -else -echo "$1: Not a directory" -exit 1 -fi elif [ "$1" = '-c' ] then shift @@ -166,6 +144,16 @@ then shift create_sfv='1' +elif [ "$1" = '-e' ] +then +shift +if [ "$1" = '' ] +then +echo '-e: Option requires an argument ' +exit 1 +fi +if cd "$*" +then +if [ "$exclude_paths" = '' ] +then +exclude_paths="`pwd`" +else +exclude_paths="$exclude_paths `pwd`" +fi +cd "$add_exp_orig" +else +echo "$*: Not a directory" +exit 1 +fi +return 0 +} +# End function function usage_info { local prgname=`basename $0` echo $ident @@ -182,6 +195,8 @@ echo "Usage: $prgname [-options]" echo 'Options are:' echo '-c: Clean (remove checksum.md5 files and do not regenerate)' +echo '-e : Only include files of the matching extension' +echo 'Do not include wildcards with the extention. ' echo '-s: Generate SFV file instead of MD5' echo '-u: Update (verify files with vercd before regeneration)' echo '-x: Exclude given directory (can be given multiple times)' diff -Nru scr/archive/mp3db2/utils/renlower mp3db2/utils/renlower --- scr/archive/mp3db2/utils/renlower 2006-11-09 14:33:02.000000000 -0500 +++ mp3db2/utils/renlower 2009-09-20 17:21:53.000000000 -0400 @@ -12,7 +12,7 @@ # More special chars are removed # V1.5: Added -f option -ident="renlower (V1.5) Sat Sep 2 00:51:01 EDT 2006 ground/X" +ident="renlower (V1.9) Sun Sep 20 16:11:57 EDT 2009 ground/X" changed="0" not_changed="0" recursive="0" # cmdline -r @@ -75,7 +75,7 @@ # I think I have all special characters removed now save - # next two lines execute as one trname=`echo "$cfile" |tr "A-Z" "a-z" |tr " " "_" |tr "(" "_" \ -|tr -d "'),~!@#\$%^&;:[]{}<>?*|=\\\\\\+\""` +|tr -d "'),~!@#\$%^&;:[]{}<>?*|=\\\\\\+\"\\\`"` if [ "$cfile" = "$trname" ] then let not_changed="$not_changed+1" @@ -115,24 +115,37 @@ return 0 } # End function - function scan_dir { -# Recurses through directories calling the handle_dir function on each one +function scan_dir { +# Recurses through directories calling the handle_dir function. # Also keeps $cwd updated to the current working directory. - local cwd current -cwd=`pwd` +# Function version 1.4 20090920 +local cwd current_scanning cxpath +cwd="`pwd`" +# Do we need to exclude this path +if [ "$exclude_paths" != '' ] +then +for cxpath in $exclude_paths +do +if [ "$cwd" = "$cxpath" -o "$cwd" = "/${cxpath}" ] +then +echo "Skipping $cwd at user request." +return 0 +fi +done +fi handle_dir -for current in $cwd/* +for current_scanning in * do -if test -d "$current" +if test -d "$current_scanning" -a ! -L "$current_scanning" then -if cd "$current" +if cd -- "$current_scanning" then -cwd=`pwd` +cwd="`pwd`" scan_dir -cd .. -cwd=`pwd` +cd '..' +cwd="`pwd`" else -echo "$current: Error couldn't chdir." +echo "$current_scanning: Error couldn't chdir." fi fi done diff -Nru scr/archive/mp3db2/utils/rr/README mp3db2/utils/rr/README --- scr/archive/mp3db2/utils/rr/README 1969-12-31 19:00:00.000000000 -0500 +++ mp3db2/utils/rr/README 2009-09-29 21:46:13.000000000 -0400 @@ -0,0 +1,9 @@ +ID: rr/README Tue Sep 29 21:40:24 EDT 2009 ground/X + +These are working example scripts that I use to record streaming media +from broadcast sources. Documentation is very thin at this point. Look +at rr.skel for a short example that you can use to build your own +scheduling scripts and look at recsiri for a complex example. + +Eventually the functions declared in rr.lib should be listed in this +document. diff -Nru scr/archive/mp3db2/utils/rr/changes mp3db2/utils/rr/changes --- scr/archive/mp3db2/utils/rr/changes 1969-12-31 19:00:00.000000000 -0500 +++ mp3db2/utils/rr/changes 2009-09-29 21:52:59.000000000 -0400 @@ -0,0 +1,23 @@ +Tue Sep 29 21:40:24 EDT 2009 ground/X +rr.lib: rt_rec_path variable that points to rt.rec script. +rr.lib: Removed change comments-moved to this file. +rr.skel: Added comments and sleep_lvl +rr.skel: Added all function. +rr.skel: more examples of bropts +recsiri: Imported script. +Imported this package to mp3db2 project. + +rr.lib: V1.2: introduced sleep levels + +rr.lib: V1.1: One recording event per scheduler run + +rr.lib: V1.0: declared stable. +rr.lib: Added support to specify id3 artist, album, and comment +rr.lib: New set_show function + +rr.lib: V0.8 Add -n command line option. +rr.lib: New trigger_cmd function +rr.lib: prompt variable is now ignored. + +rr.lib:V0.7 First really stable version. + diff -Nru scr/archive/mp3db2/utils/rr/recsiri mp3db2/utils/rr/recsiri --- scr/archive/mp3db2/utils/rr/recsiri 1969-12-31 19:00:00.000000000 -0500 +++ mp3db2/utils/rr/recsiri 2009-09-29 21:25:59.000000000 -0400 @@ -0,0 +1,295 @@ +#!/bin/bash + +# ID: recsiri Tue Sep 29 21:16:42 EDT 2009 ground/X + +# Complex scheduling script to record sirius programming. +# You are probably better off starting with the rr.skel example script for +# writing your own scheduling script. This is a much larger example. + +source rr.lib + +# Variables that control which shows we record. +# just a simple way to quickly enable/disable recording of specific shows. +howard_100=0 +howard_101=0 +howard_replay=0 +howard_wrapup=0 +bubba=1 +bubba_replay=0 +bubba_fm=0 +bubba_fm_replay=1 +jason=1 +special=0 +master=0 +master_replay=0 +hjay=1 +hjay_replay=0 +miserablemen=1 +rec_20=0 + +debug=1 +sleep_lvl=4 + +bropts='-vq 9 -mp siri.pls -pcmskip 32' +#bropts='-vq 9' + +function sched_main { +if [ "$dayweek" = 'Mon' ] +then +mon +elif [ "$dayweek" = 'Tue' ] +then +tue +elif [ "$dayweek" = 'Wed' ] +then +wed +elif [ "$dayweek" = 'Thu' ] +then +thu +elif [ "$dayweek" = 'Fri' ] +then +fri +elif [ "$dayweek" = 'Sat' ] +then +sat +elif [ "$dayweek" = 'Sun' ] +then +sun +else +echo 'Error this day is not scheduled.' +return 1 +fi +return 0 +} +# End function. +function mon { +rec_howard +rec_jason +rec_hspecial +rec_20 +if [ "$master_replay" = '1' ] +then +set_show 'mastertape' 'Howard Stern' 'Master Tape Theator replay' +event '05:00' +event '06:00' +event '07:00' +event '08:00' +fi # end master replay +return 0 +} +# End function. +function tue { +debug 'Using tue schedule' +rec_howard +rec_btls_fm +rec_jason +rec_hspecial +rec_20 +return 0 +} +# End function. +function wed { +debug 'Using wed schedule' +rec_howard +rec_btls_fm +rec_jason +rec_hspecial +rec_20 +return 0 +} +# End function. +function thu { +debug 'Using thu schedule' +rec_howard +rec_btls_fm +rec_jason +rec_hspecial +rec_20 +return 0 +} +# End function. +function fri { +debug 'Using Fri schedule.' +rec_20 +# jay thomass show h101 +if [ "$hjay" = '1' ] +then +set_show 'hjay' 'Jay Thomas' 'The Jay Thomas Show' +event '07:00' +event '08:00' +event '09:00' +trigger_cmd 10:00 /home/ground/bin/fs2post hjay +fi # end hjay +if [ "$bubba" = '1' ] +then +set_show 'btls' 'Bubba The Love Sponge' 'Sirius Unsensored' +event '10:00' +event '11:00' +event '12:00' +event '13:00' +trigger_cmd 14:00 /home/ground/bin/fs2post btls +fi # end bubba 1 +rec_jason +if [ "$bubba_replay" = '1' ] +then +set_show 'btls' 'Bubba The Love Sponge' 'Sirius Unsensored replay' +event '15:00' +event '16:00' +event '17:00' +event '18:00' +trigger_cmd 19:00 /home/ground/bin/fs2post btls +fi # end bubba_replay +rec_btls_fm +return 0 +} +# End function. +function sat { +debug 'Using sat schedule.' +if [ "$bubba_replay" = '1' ] +then +set_show 'btls' 'Bubba The Love Sponge' 'Sirius Unsensored replay' +event '01:00' +event '02:00' +event '03:00' +event '04:00' +trigger_cmd 05:00 /home/ground/bin/fs2post btls +fi # end bubba_replay +if [ "$hjay_replay" = '1' ] +then +set_show 'hjay' 'Jay Thomas' 'The Jay Thomas Show replay' +event '20:00' +event '21:00' +event '22:00' +trigger_cmd 23:00 /home/ground/bin/fs2post hjay +fi # end hjay +return 0 +} +# end func +function sun { +if [ "$master" = '1' ] +then +set_show 'mastertape' 'Howard Stern' 'Master Tape Theator' +event '15:00' +event '16:00' +event '17:00' +event '18:00' +fi # end master +if [ "$miserablemen" = '1' ] +then +set_show 'miserablemen' 'Miserable Men FT Shulie' 'The Miserable Men Show' +event '19:00' +event '20:00' +event '21:00' +event '22:00' +trigger_cmd 23:00 /home/ground/bin/fs2post miserablemen +fi # End miserablemen +return 0 +} +# End function. +function rec_howard { +# stern show h101 +if [ "$howard_100" = '1' ] +then +set_show 'howard' 'Howard Stern' 'The Howard Stern Show' +event '06:00' +event '07:00' +event '08:00' +event '09:00' +event '10:00' +trigger_cmd 11:00 /home/ground/bin/fs2post howard +if [ "$howard_wrapup" = '1' ] +then +event '11:00' +fi +fi # howard is 1 +if [ "$howard_101" = '1' ] +then +set_show 'howard' 'Howard Stern' 'The Howard Stern Show 101' +event '09:00' +event '10:00' +event '11:00' +event '12:00' +event '13:00' +trigger_cmd 14:00 /home/ground/bin/fs2post howard +if [ "$howard_wrapup" = '1' ] +then +event '14:00' +fi +fi # howard is 1 +# howard replay +if [ "$howard_replay" = '1' ] +then +set_show 'howard' 'Howard Stern' 'The Howard Stern Show replay' +event '22:30' +event '23:30' +event '00:30' +event '01:30' +event '02:30' +fi # howard replay +return 0 +} +# End function. +function rec_btls_fm { +# btls fm show h101 +if [ "$bubba_fm" = '1' \ +-a "$dayweek" != 'Fri' ] +then +set_show 'btlsfm' 'Bubba the Love Sponge' 'FM Sensored Show-Sirius replay' +event '15:00' +event '16:00' +event '17:00' +event '18:00' +trigger_cmd 19:00 /home/ground/bin/fs2post btlsfm +fi # bubba is 1 +# btls replay +if [ "$bubba_fm_replay" = '1' ] +then +set_show 'btlsfm' 'Bubba the Love Sponge' 'FM Sensored Show replay' +event '01:00' +event '02:00' +event '03:00' +event '04:00' +trigger_cmd 05:00 /home/ground/bin/fs2post btlsfm +fi # end bubba replay +return 0 +} +# End function. +function rec_jason { +if [ "$jason" = '1' ] +then +set_show 'jason' 'The Jason Ellis Show' 'Sirius Faction 28' +event '15:00' +event '16:00' +event '17:00' +event '18:00' +trigger_cmd 19:00 /home/ground/bin/fs2post jason +fi # jason is 1 +return 0 +} +# End function. +function rec_20 { +if [ "$rec_20" = '1' ] +then +set_show 'miserablemen' 'The Miserable Men' 'In Scotty time slot' +event '20:00' +event '21:00' +event '22:00' +event '23:00' +fi # rec_20 +return 0 +} +# End function. +function rec_hspecial { +if [ "$special" = '1' ] +then +set_show 'hspecial' 'Howard 101' 'Special Programming' +event '19:00' +fi # end hspecial +return 0 +} +# end func + +# exec starts here +start_sched $* +exit 0 + diff -Nru scr/archive/mp3db2/utils/rr/rr.lib mp3db2/utils/rr/rr.lib --- scr/archive/mp3db2/utils/rr/rr.lib 1969-12-31 19:00:00.000000000 -0500 +++ mp3db2/utils/rr/rr.lib 2009-09-29 21:42:22.000000000 -0400 @@ -0,0 +1,260 @@ +ident='rr.lib (V1.4) Tue Sep 29 21:07:31 EDT 2009 ground/X' + +# radio archiving lib + +base_output_dir="$HOME/rec" # All recordings go here +rt_rec_path="$HOME/mp3db2/utils/rt.rec" # Absolute path to rec script. +scheduled='0' # Used at runtime +show='unknown' +bropts='-vq 9' +id3_artist='' +id3_album='' +id3_comment='rr.lib' +sleep_lvl='2' # 0=1 min 1=5 min 2=10 min 3=30 min 4=60 min +debug=0 +script_name=`basename $0` + +function debug { +# Prints a debug message to stderr if the debug variable is set +if [ "$debug" = '1' ] +then +echo "DBG: $*" 1>&2 +fi +return 0 +} +#End function. +function rec_duration { +local duration_arg +local datenow=`date '+%Y%m%d'` +local yearnow=`date '+%Y'` +local id3_date=`date '+%Y-%m-%d t%H:%M:%S'` +local out_dir="$base_output_dir/$show/$datenow" +if [ "$1" != '' ] +then +duration_arg="$1" +else +duration_arg='3600' # constant for one hour. +fi + if ! test -e "$out_dir" +then +mkdir -p "$out_dir" +fi +if ! cd "$out_dir" +then +echo 'could not change to destination dir.' +return 1 +fi +local show_prompt=`echo "$show" |tr "/" "-"` +local cursec=`date +%S` +local rec_time=`echo "${duration_arg}-${cursec}" |bc` +debug "$id3_date" +debug "Recording for $rec_time seconds." +scheduled='1' +$rt_rec_path -t $rec_time -p "$show_prompt" -tracktxt -nobeep $bropts +if test -r './tracktxt.txt' +then +local recorded_track=`cat './tracktxt.txt'` +rm -f './tracktxt.txt' +debug "Setting ID3 tags for $recorded_track" +mp3info -t "$id3_date" -a "$id3_artist" -l "$id3_album" \ +-y "$yearnow" -c "$id3_comment" \ +-g '28' "$recorded_track" +else +debug 'Not setting id3 tags this time.' +fi +return 0 +} +# end function. +function set_show { +# Setup variables for specific recording session. +# Sets show, id3_artist, and id3_album. +# Args are: +# 1: short show name +# 2: Artist name in quotes +# 3: Album name in quotes +if [ "$1" = '' ] +then +echo 'Error: not enough arguments to set_show' +return 1 +fi +show="$1" +if [ "$2" = '' ] +then +id3_artist="$1" +else +id3_artist="$2" +fi +if [ "$3" = '' ] +then +id3_album="$1" +else +id3_album="$3" +fi +debug "Set show: $show artist: $id3_artist album: $id3_album" +return 0 +} +# End function. +function time_table { +# This is the main loop for the scheduler. +# No loop here but a while loop in start_sched calls this function. +local tod=`date +%H:%M` +local dayweek=`date +%a` +if [ "$tod" = "$last_tod" ] +then +debug 'Already checked this one.' +return 0 +fi +last_tod="$tod" +echo +echo -n "$script_name: $tod " +if sched_main +then +return 0 +else +return 1 +fi +} +# End function. +function event { +# check a single event args are: +# $1: trigger time eg 07:00 +# $2 length to pass to rec_duration. +# comment the next one out for a speed increase. +#debug "Checking event $1" +if [ "$scheduled" = '1' ] +then +debug 'Event already scheduled this round' +return 0 +fi +if [ "$tod" = "$1" ] +then +rec_duration "$2" +fi +return 0 +} +# End function. +function trigger_cmd { +# Trigger a command at specific time to run in background. +# $1: trigger time eg 07:00 +# $2 command +# comment the next one out for a speed increase. +#debug "Checking trigger $1" +if [ "$tod" = "$1" ] +then +shift +if [ "$1" = '' ] +then +echo 'Error no trigger command.' +return 1 +fi +$* >& /dev/null & +echo "trigger_cmd: $* pid: $!" +fi +return 0 +} +# End function. +function sleep_event { +local remaining_min +local remaining_min_sec +local remaining_sec +local sleep_sec +min_lsd="${raw_min:1}" +if [ "$sleep_lvl" = '0' ] +then +remaining_min='0' +elif [ "$sleep_lvl" = '1' ] +then +if [ "$min_lsd" -ge '5' ] +then +remaining_min=`echo "9-${min_lsd}" |bc` +else +remaining_min=`echo "4-${min_lsd}" |bc` +fi +elif [ "$sleep_lvl" = '2' ] +then +remaining_min=`echo "9-${min_lsd}" |bc` +elif [ "$sleep_lvl" = '3' ] +then +if [ "$raw_min" -ge '30' ] +then +remaining_min=`echo "59-${raw_min}" |bc` +else +remaining_min=`echo "29-${raw_min}" |bc` +fi +elif [ "$sleep_lvl" = '4' ] +then +remaining_min=`echo "59-${raw_min}" |bc` +else +echo 'rr.lib: Error sleep_lvl must be between 0 and 4.' +exit 1 +fi +remaining_min_sec=`echo "${remaining_min}*60" |bc` +remaining_sec=`echo "60-${raw_sec}" |bc` +sleep_sec=`echo "${remaining_sec}+${remaining_min_sec}" |bc` +debug "Sleeping for $sleep_sec seconds." +sleep $sleep_sec +return 0 +} +# End function. +function return_3600 { +# returns the number of seconds remaining in the hour on stdout +local r3_remaining_min +local r3_remaining_min_sec +local r3_remaining_sec +local r3_sleep_sec +local r3_raw_min=`date +%M` +local r3_raw_sec=`date +%S` +r3_remaining_min=`echo "59-${r3_raw_min}" |bc` +r3_remaining_min_sec=`echo "${r3_remaining_min}*60" |bc` +r3_remaining_sec=`echo "60-${r3_raw_sec}" |bc` +r3_sleep_sec=`echo "${r3_remaining_sec}+${r3_remaining_min_sec}" |bc` +echo $r3_sleep_sec +return 0 +} +# End function. +function parse_cmdline { +while [ "$1" != '' ] +do +if [ "$1" = '-n' ] +then +shift +if [ "$1" = '' ] +then +echo 'Error: -n: option needs an argument ' +exit 1 +fi +set_show "$1" +shift +echo 'Forced recording for the rest of this hour.' +rec_duration `return_3600` +elif [ "$1" = '--version' ] +then +exit 0 +else +echo 'Error: unknown option.' +exit 1 +fi +done +return 0 +} +# End function +function start_sched { +parse_cmdline $* +scheduled='0' +while time_table +do +if [ "$scheduled" = '1' ] +then +debug 'We scheduled something on the last run, trying again.' +scheduled='0' +continue +fi +local raw_min=`date +%M` +local raw_sec=`date +%S` +sleep_event +done +exit 0 +} +# End function. + +echo "$ident" diff -Nru scr/archive/mp3db2/utils/rr/rr.skel mp3db2/utils/rr/rr.skel --- scr/archive/mp3db2/utils/rr/rr.skel 1969-12-31 19:00:00.000000000 -0500 +++ mp3db2/utils/rr/rr.skel 2009-09-29 21:31:10.000000000 -0400 @@ -0,0 +1,140 @@ +#!/bin/bash + +# ID rr.skel Tue Sep 29 21:05:47 EDT 2009 ground/X + +# Example program for use with rr.lib schedular. + +source rr.lib + +debug=1 + +# Show_name is manditory and should probably not have spaces +# The other two fields are optional and are used for ID3 tags. +# You can set this at the top of the script and it will apply to all +# recordings scheduled by this script or you may call the set_show function +# in the body of the script before calling the event function. +# The last set_show command will be used until it is changed with +# another call to set_show. +set_show 'show_name' 'Show Artist' 'Show Album' + +# Extra options to pass to rt.rec recording script. +# Record from the first alsa device with vbr quality 9. +bropts='-vq 9 -sd hw:0,0' +# Record from the first alsa device with ful 128K ABR stereo +#bropts='-b 128 -sr 44100 -nc 2 -sd hw:0,0' +# Record from a shoutcast playlist. +#bropts='-mp playlist.pls -pcmskip 32' + +# How long we sleep between checking for events. +# The default is 10 minutes. +# 0=1 min 1=5 min 2=10 min 3=30 min 4=60 min +sleep_lvl='2' + +function sched_main { +# This is the main function called every 10 minutes while nothing +# is currently recording. +# I have setup sub functions for each day. +if [ "$dayweek" = 'Mon' ] +then +mon +elif [ "$dayweek" = 'Tue' ] +then +tue +elif [ "$dayweek" = 'Wed' ] +then +wed +elif [ "$dayweek" = 'Thu' ] +then +thu +elif [ "$dayweek" = 'Fri' ] +then +fri +elif [ "$dayweek" = 'Sat' ] +then +sat +elif [ "$dayweek" = 'Sun' ] +then +sun +else +echo 'Error this day is not scheduled.' +return 1 +fi +return 0 +} +# End function. +function mon { +debug 'Using mon schedule' +# Brief examples for monday's recording +# Record for an hour at 9:00 AM +#event '09:00' +# Record for 2 hours at 1 PM. +#event '13:00' '7200' +# Log that the 1 PM show was completed. +# Logger is just a shell command in this example. +trigger_cmd '15:00' /usr/bin/logger Completed recording +# Continue recording for a half hour at 3 PM. +# Note that order is important here. +# You should run all trigger_cmd functions set to run at one specific time +# before calling the event function for that same time. +# This is because when the event runs the program blocks until the recording +# is completed. Commands run with trigger_cmd are run in the background. +#event '15:00' '1800' +weekly +all +return 0 +} +# End function. +function tue { +debug 'Using tue schedule' +weekly +all +return 0 +} +# End function. +function wed { +debug 'Using wed schedule' +weekly +all +return 0 +} +# End function. +function thu { +debug 'Using thu schedule' +weekly +all +return 0 +} +# End function. +function fri { +debug 'Using Fri schedule.' +weekly +all +return 0 +} +# End function. +function sat { +debug 'Using sat schedule.' +all +return 0 +} +# End function. +function sun { +debug 'Using sun schedule.' +all +return 0 +} +# End function. +function weekly { +debug 'Checking week day recordings' +return 0 +} +# End function. +function all { +debug 'Checking daily recordings.' +return 0 +} +# End function. +# exec starts here +start_sched $* +exit 0 + diff -Nru scr/archive/mp3db2/utils/vercd mp3db2/utils/vercd --- scr/archive/mp3db2/utils/vercd 2004-02-16 19:51:47.000000000 -0500 +++ mp3db2/utils/vercd 2009-09-20 17:20:50.000000000 -0400 @@ -13,7 +13,7 @@ # Output now looks more like that of autoconf # New -x command line option for excluding a given path from the check process -ident="vercd (V2.08) Mon Feb 16 19:50:06 EST 2004 ground/X" +ident="vercd (V2.10) Sun Sep 20 16:11:57 EDT 2009 ground/X" cwd=`pwd` correct="0" empty_dirs="" @@ -92,35 +92,44 @@ then verbose="1" shift -elif [ "$1" = "-x" ] +elif [ "$1" = '-x' ] then shift -if [ "$1" = "" ] +cmdline_add_exclude_path "$1" +shift +else +echo "Unknown command line option: $1" +exit 1 +fi +done +return 0 +} +# End function. +function cmdline_add_exclude_path { +# fver 1.2 +# Make sure this is a valid path. +local add_exp_orig="`pwd`" +if [ "$*" = '' ] then echo '-x: Option requires an argument ' exit 1 fi -if test -d "$1" +if cd "$*" then -if [ "$exclude_paths" = "" ] +if [ "$exclude_paths" = '' ] then -exclude_paths="$1" +exclude_paths="`pwd`" else -exclude_paths="$exclude_paths $1" -fi -else -echo "$1: Not a directory" -exit 1 +exclude_paths="$exclude_paths `pwd`" fi -shift +cd "$add_exp_orig" else -echo "Unknown command line option: $1" +echo "$*: Not a directory" exit 1 fi -done return 0 } -# End function. +# End function function usage_info { local prgname=`basename $0` echo "Usage: $prgname [-c] [-l ] [-v] [-x ]" @@ -134,7 +143,7 @@ return 0 } # End function -function ckmd5 { +function handle_dir { local flags="-c checksum.md5" # extra flags to pass to md5sum if [ "$verbose" = "0" ] then @@ -169,43 +178,41 @@ fi } # End function. -function scandir { -cwd=`pwd` -local cpath search_mask +function scan_dir { +# Recurses through directories calling the handle_dir function. +# Also keeps $cwd updated to the current working directory. +# Function version 1.4 20090920 +local cwd current_scanning cxpath +cwd="`pwd`" # Do we need to exclude this path -if [ "$exclude_paths" != "" ] +if [ "$exclude_paths" != '' ] then -for cpath in $exclude_paths +for cxpath in $exclude_paths do -if [ "$cwd" = "$cpath" -o "$cwd" = "/${cpath}" ] +if [ "$cwd" = "$cxpath" -o "$cwd" = "/${cxpath}" ] then echo "Skipping $cwd at user request." return 0 fi done fi -if [ "$cwd" = "/" ] -then -search_mask='/*' -else -search_mask="$cwd/*" -fi -ckmd5 -for current in $search_mask +handle_dir +for current_scanning in * do -if test -d "$current" -a ! -L "$current" +if test -d "$current_scanning" -a ! -L "$current_scanning" then -if cd "$current" +if cd -- "$current_scanning" then -cwd=`pwd` -scandir -cd .. -cwd=`pwd` +cwd="`pwd`" +scan_dir +cd '..' +cwd="`pwd`" else -echo "$current: Error couldn't chdir." +echo "$current_scanning: Error couldn't chdir." fi fi done +return 0 } # End function. function is_empty { @@ -234,7 +241,7 @@ # Exec starts here echo "$ident" parse_cmdline $* -scandir +scan_dir echo log_text if [ "$empty_dirs" != "" ]