#1764 XML_RPC PEAR package upgraded + file extension checking added to import script
This commit is contained in:
parent
48102bfdf9
commit
fd751607bb
4 changed files with 24 additions and 7 deletions
|
@ -55,20 +55,25 @@ printUsage()
|
||||||
echo " will be readed recursively.";
|
echo " will be readed recursively.";
|
||||||
echo " -l, --list The filename with list of absolute filepaths";
|
echo " -l, --list The filename with list of absolute filepaths";
|
||||||
echo " (newline-separated).";
|
echo " (newline-separated).";
|
||||||
|
echo " -f, --file The filename - import of one file";
|
||||||
echo " -h, --help Print this message and exit.";
|
echo " -h, --help Print this message and exit.";
|
||||||
echo "";
|
echo "";
|
||||||
echo "Usage:";
|
echo "Usage:";
|
||||||
echo " $0 -d <directory>";
|
echo " $0 -d <directory>";
|
||||||
echo " $0 -l <listfile>";
|
echo " $0 -l <listfile>";
|
||||||
|
echo " $0 -f <filename>";
|
||||||
echo " $0 -h";
|
echo " $0 -h";
|
||||||
}
|
}
|
||||||
|
|
||||||
#-------------------------------------------------------------------------------
|
#-------------------------------------------------------------------------------
|
||||||
# Process command line parameters
|
# Process command line parameters
|
||||||
#-------------------------------------------------------------------------------
|
#-------------------------------------------------------------------------------
|
||||||
|
unset srcabsdir
|
||||||
|
unset filelistpathname
|
||||||
|
unset filepathname
|
||||||
CMD=${0##*/}
|
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"
|
eval set -- "$opts"
|
||||||
while true; do
|
while true; do
|
||||||
case "$1" in
|
case "$1" in
|
||||||
|
@ -85,6 +90,14 @@ while true; do
|
||||||
filelistabsdir=`cd "$filelistdir"; pwd`
|
filelistabsdir=`cd "$filelistdir"; pwd`
|
||||||
filelistpathname="$filelistabsdir/$filelistbasename"
|
filelistpathname="$filelistabsdir/$filelistbasename"
|
||||||
shift; shift;;
|
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)
|
-h|--help)
|
||||||
printUsage;
|
printUsage;
|
||||||
exit 0;;
|
exit 0;;
|
||||||
|
@ -98,8 +111,8 @@ while true; do
|
||||||
esac
|
esac
|
||||||
done
|
done
|
||||||
|
|
||||||
if [ "x$srcabsdir" == "x" -a "x$filelist" == "x" ]; then
|
if [ "x$srcabsdir" == "x" -a "x$filelist" == "x" -a "x$file" == "x" ]; then
|
||||||
echo "Directory or filelist option required.";
|
echo "Directory, filelist or file required.";
|
||||||
printUsage;
|
printUsage;
|
||||||
exit 1;
|
exit 1;
|
||||||
fi
|
fi
|
||||||
|
@ -112,10 +125,10 @@ cd $phpdir
|
||||||
|
|
||||||
if [ -f "$filelistpathname" ]; then
|
if [ -f "$filelistpathname" ]; then
|
||||||
cat "$filelistpathname" | php -q import.php || exit 1
|
cat "$filelistpathname" | php -q import.php || exit 1
|
||||||
fi
|
elif [ -d "$srcabsdir" ]; then
|
||||||
|
|
||||||
if [ -d "$srcabsdir" ]; then
|
|
||||||
find "$srcabsdir" -type f | php -q import.php || exit 1
|
find "$srcabsdir" -type f | php -q import.php || exit 1
|
||||||
|
elif [ -f "$filepathname" ]; then
|
||||||
|
echo "$filepathname" | php -q import.php || exit 1
|
||||||
else
|
else
|
||||||
echo "Warning: not a directory: $srcabsdir"
|
echo "Warning: not a directory: $srcabsdir"
|
||||||
fi
|
fi
|
||||||
|
|
|
@ -132,6 +132,10 @@ function addMdata($key, $val, $iEnc='iso-8859-1'){
|
||||||
$stdin = fopen('php://stdin', 'r');
|
$stdin = fopen('php://stdin', 'r');
|
||||||
while($filename = fgets($stdin, 2048)){
|
while($filename = fgets($stdin, 2048)){
|
||||||
$filename = rtrim($filename);
|
$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: ";
|
echo "$filename: ";
|
||||||
set_time_limit(30);
|
set_time_limit(30);
|
||||||
$infoFromFile = GetAllFileInfo("$filename", 'mp3');
|
$infoFromFile = GetAllFileInfo("$filename", 'mp3');
|
||||||
|
|
|
@ -62,7 +62,7 @@ XML_Serializer
|
||||||
|
|
||||||
VERSION_Archive_Tar=Archive_Tar-1.3.1
|
VERSION_Archive_Tar=Archive_Tar-1.3.1
|
||||||
VERSION_Console_Getopt=Console_Getopt-1.2
|
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_PEAR=PEAR-1.3.5
|
||||||
VERSION_Calendar=Calendar-0.5.2
|
VERSION_Calendar=Calendar-0.5.2
|
||||||
VERSION_DB=DB-1.7.6
|
VERSION_DB=DB-1.7.6
|
||||||
|
|
BIN
livesupport/src/tools/pear/src/XML_RPC-1.5.0.tgz
Normal file
BIN
livesupport/src/tools/pear/src/XML_RPC-1.5.0.tgz
Normal file
Binary file not shown.
Loading…
Add table
Add a link
Reference in a new issue