#1764 XML_RPC PEAR package upgraded + file extension checking added to import script
This commit is contained in:
parent
48102bfdf9
commit
fd751607bb
|
@ -55,20 +55,25 @@ printUsage()
|
|||
echo " will be readed recursively.";
|
||||
echo " -l, --list The filename with list of absolute filepaths";
|
||||
echo " (newline-separated).";
|
||||
echo " -f, --file The filename - import of one file";
|
||||
echo " -h, --help Print this message and exit.";
|
||||
echo "";
|
||||
echo "Usage:";
|
||||
echo " $0 -d <directory>";
|
||||
echo " $0 -l <listfile>";
|
||||
echo " $0 -f <filename>";
|
||||
echo " $0 -h";
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------------------
|
||||
# Process command line parameters
|
||||
#-------------------------------------------------------------------------------
|
||||
unset srcabsdir
|
||||
unset filelistpathname
|
||||
unset filepathname
|
||||
CMD=${0##*/}
|
||||
|
||||
opts=$(getopt -o d:l:h -l directory:,list:,help -n $CMD -- "$@") || exit 1
|
||||
opts=$(getopt -o d:l:f:h -l directory:,list:,file:,help -n $CMD -- "$@") || exit 1
|
||||
eval set -- "$opts"
|
||||
while true; do
|
||||
case "$1" in
|
||||
|
@ -85,6 +90,14 @@ while true; do
|
|||
filelistabsdir=`cd "$filelistdir"; pwd`
|
||||
filelistpathname="$filelistabsdir/$filelistbasename"
|
||||
shift; shift;;
|
||||
-f|--file)
|
||||
file=$2;
|
||||
test -f "$file" || { echo "File not found ($file)."; exit 1; }
|
||||
filebasename=`basename "$file"`
|
||||
filedir=`dirname "$file"`
|
||||
fileabsdir=`cd "$filedir"; pwd`
|
||||
filepathname="$fileabsdir/$filebasename"
|
||||
shift; shift;;
|
||||
-h|--help)
|
||||
printUsage;
|
||||
exit 0;;
|
||||
|
@ -98,8 +111,8 @@ while true; do
|
|||
esac
|
||||
done
|
||||
|
||||
if [ "x$srcabsdir" == "x" -a "x$filelist" == "x" ]; then
|
||||
echo "Directory or filelist option required.";
|
||||
if [ "x$srcabsdir" == "x" -a "x$filelist" == "x" -a "x$file" == "x" ]; then
|
||||
echo "Directory, filelist or file required.";
|
||||
printUsage;
|
||||
exit 1;
|
||||
fi
|
||||
|
@ -112,10 +125,10 @@ cd $phpdir
|
|||
|
||||
if [ -f "$filelistpathname" ]; then
|
||||
cat "$filelistpathname" | php -q import.php || exit 1
|
||||
fi
|
||||
|
||||
if [ -d "$srcabsdir" ]; then
|
||||
elif [ -d "$srcabsdir" ]; then
|
||||
find "$srcabsdir" -type f | php -q import.php || exit 1
|
||||
elif [ -f "$filepathname" ]; then
|
||||
echo "$filepathname" | php -q import.php || exit 1
|
||||
else
|
||||
echo "Warning: not a directory: $srcabsdir"
|
||||
fi
|
||||
|
|
|
@ -132,6 +132,10 @@ function addMdata($key, $val, $iEnc='iso-8859-1'){
|
|||
$stdin = fopen('php://stdin', 'r');
|
||||
while($filename = fgets($stdin, 2048)){
|
||||
$filename = rtrim($filename);
|
||||
if(!preg_match('/\.(ogg|wav|mp3|mpg|mpeg)$/', strtolower($filename), $var)){
|
||||
// echo "File extension not supported - skipping file\n";
|
||||
continue;
|
||||
}
|
||||
echo "$filename: ";
|
||||
set_time_limit(30);
|
||||
$infoFromFile = GetAllFileInfo("$filename", 'mp3');
|
||||
|
|
|
@ -62,7 +62,7 @@ XML_Serializer
|
|||
|
||||
VERSION_Archive_Tar=Archive_Tar-1.3.1
|
||||
VERSION_Console_Getopt=Console_Getopt-1.2
|
||||
VERSION_XML_RPC=XML_RPC-1.4.4
|
||||
VERSION_XML_RPC=XML_RPC-1.5.0
|
||||
VERSION_PEAR=PEAR-1.3.5
|
||||
VERSION_Calendar=Calendar-0.5.2
|
||||
VERSION_DB=DB-1.7.6
|
||||
|
|
Binary file not shown.
Loading…
Reference in New Issue