#1693 bash script bug fixed for directory names containing spaces

and minor changes
This commit is contained in:
tomash 2006-06-05 13:35:01 +00:00
parent 31b06e2911
commit e90f515192
2 changed files with 9 additions and 6 deletions

View file

@ -74,16 +74,16 @@ while true; do
case "$1" in case "$1" in
-d|--directory) -d|--directory)
srcdir=$2; srcdir=$2;
test -d $srcdir || { echo "Directory not found ($srcdir)."; exit 1; } test -d "$srcdir" || { echo "Directory not found ($srcdir)."; exit 1; }
srcabsdir=`cd "$srcdir"; pwd` srcabsdir=`cd "$srcdir"; pwd`
shift; shift;; shift; shift;;
-l|--list) -l|--list)
filelist=$2; filelist=$2;
test -f $filelist || { echo "File not found ($filelist)."; exit 1; } test -f "$filelist" || { echo "File not found ($filelist)."; exit 1; }
filelistbasename=`basename "$filelist"` filelistbasename=`basename "$filelist"`
filelistdir=`dirname "$filelist"` filelistdir=`dirname "$filelist"`
filelistabsdir=`cd "$filelistdir"; pwd` filelistabsdir=`cd "$filelistdir"; pwd`
filelistpathname=$filelistabsdir/$filelistbasename filelistpathname="$filelistabsdir/$filelistbasename"
shift; shift;; shift; shift;;
-h|--help) -h|--help)
printUsage; printUsage;

View file

@ -51,9 +51,11 @@ $testonly = (isset($argv[1]) && $argv[1] == '-n');
$errors=0; $errors=0;
$filecount=0; $filecount=0;
function _err($r, $fn){ function _err($r, $fn, $txt=''){
global $errors; global $errors;
echo "ERROR\n ".$r->getMessage()." ".$r->getUserInfo()."\n"; if(PEAR::isError($r)) $msg = $r->getMessage()." ".$r->getUserInfo();
else $msg = $txt;
echo "ERROR\n $msg\n";
$errors++; $errors++;
} }
@ -137,7 +139,8 @@ while($filename = fgets($stdin, 2048)){
//$getID3 = new getID3; //$getID3 = new getID3;
//$infoFromFile = $getID3->analyze("$filename"); //$infoFromFile = $getID3->analyze("$filename");
if(PEAR::isError($infoFromFile)){ _err($infoFromFile, $filename); continue; } if(PEAR::isError($infoFromFile)){ _err($infoFromFile, $filename); continue; }
if(!$infoFromFile['fileformat']){ echo "???\n"; continue; } if(isset($infoFromFile['error'])){ _err(NULL, $filename, $infoFromFile['error']); continue; }
#if(!$infoFromFile['fileformat']){ echo "???\n"; continue; }
if(!$infoFromFile['bitrate']){ echo "not audio?\n"; continue; } if(!$infoFromFile['bitrate']){ echo "not audio?\n"; continue; }
$mdata = array(); $mdata = array();