Ogg metadata import fixed, testonly (analyze) mode added.
This commit is contained in:
parent
17953ce674
commit
67ec86044e
1 changed files with 22 additions and 13 deletions
|
@ -23,7 +23,7 @@
|
||||||
|
|
||||||
|
|
||||||
Author : $Author: tomas $
|
Author : $Author: tomas $
|
||||||
Version : $Revision: 1.3 $
|
Version : $Revision: 1.4 $
|
||||||
Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/modules/storageAdmin/var/import.php,v $
|
Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/modules/storageAdmin/var/import.php,v $
|
||||||
|
|
||||||
------------------------------------------------------------------------------*/
|
------------------------------------------------------------------------------*/
|
||||||
|
@ -44,6 +44,8 @@ if(PEAR::isError($dbc)){ echo "ERROR: ".$dbc->getMessage()." ".$dbc->getUserInfo
|
||||||
$dbc->setFetchMode(DB_FETCHMODE_ASSOC);
|
$dbc->setFetchMode(DB_FETCHMODE_ASSOC);
|
||||||
$gb = &new GreenBox($dbc, $config);
|
$gb = &new GreenBox($dbc, $config);
|
||||||
|
|
||||||
|
$testonly = ($argv[1] == '-n');
|
||||||
|
|
||||||
$errors=0;
|
$errors=0;
|
||||||
$filecount=0;
|
$filecount=0;
|
||||||
function _err($r, $fn){
|
function _err($r, $fn){
|
||||||
|
@ -75,8 +77,13 @@ $flds = array(
|
||||||
// 'bitrate' => 'ls:bitrate',
|
// 'bitrate' => 'ls:bitrate',
|
||||||
),
|
),
|
||||||
'comments' => array(
|
'comments' => array(
|
||||||
'genre' => 'dc:type',
|
'genre' => 'dc:type',
|
||||||
'title' => 'dc:title',
|
'title' => 'dc:title',
|
||||||
|
'artist' => 'dc:creator',
|
||||||
|
'album' => 'dc:source',
|
||||||
|
'tracknumber'=> 'ls:track_num',
|
||||||
|
'date' => 'ls:year',
|
||||||
|
'label' => 'dc:publisher',
|
||||||
// 'genreid' => 'GENREID',
|
// 'genreid' => 'GENREID',
|
||||||
),
|
),
|
||||||
'filename' => 'ls:filename',
|
'filename' => 'ls:filename',
|
||||||
|
@ -140,16 +147,18 @@ while($filename = fgets($stdin, 2048)){
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$r = $gb->bsPutFile($parid, $mdata['ls:filename'], "$filename", "$storageServerPath/var/emptyMdata.xml", NULL, 'audioclip');
|
if(!$testonly){
|
||||||
if(PEAR::isError($r)){ _err($r, $filename); echo var_export($mdata)."\n"; continue; }
|
$r = $gb->bsPutFile($parid, $mdata['ls:filename'], "$filename", "$storageServerPath/var/emptyMdata.xml", NULL, 'audioclip');
|
||||||
$id = $r;
|
if(PEAR::isError($r)){ _err($r, $filename); echo var_export($mdata)."\n"; continue; }
|
||||||
|
$id = $r;
|
||||||
|
|
||||||
$r = $gb->bsSetMetadataBatch($id, $mdata);
|
$r = $gb->bsSetMetadataBatch($id, $mdata);
|
||||||
if(PEAR::isError($r)){ _err($r, $filename); echo var_export($mdata)."\n"; continue; }
|
if(PEAR::isError($r)){ _err($r, $filename); echo var_export($mdata)."\n"; continue; }
|
||||||
|
}else{
|
||||||
|
var_dump($mdata); echo"======================= ";
|
||||||
|
# var_dump($ia); echo"======================= ";
|
||||||
|
}
|
||||||
|
|
||||||
# $r = $gb->bsGetMetadata($id);
|
|
||||||
# if(PEAR::isError($r)){ _err($r, $filename); continue; }
|
|
||||||
# echo "$r\n";
|
|
||||||
echo "OK\n";
|
echo "OK\n";
|
||||||
$filecount++;
|
$filecount++;
|
||||||
}
|
}
|
||||||
|
@ -160,5 +169,5 @@ $end = intval(date('U'));
|
||||||
$time = $end-$start;
|
$time = $end-$start;
|
||||||
if($time>0) $speed = round(($filecount+$errors)/$time, 1);
|
if($time>0) $speed = round(($filecount+$errors)/$time, 1);
|
||||||
else $speed = "N/A";
|
else $speed = "N/A";
|
||||||
echo " File imported: $filecount, in $time s, $speed files/s, errors: $errors\n";
|
echo " Files ".($testonly ? "analyzed" : "imported").": $filecount, in $time s, $speed files/s, errors: $errors\n";
|
||||||
?>
|
?>
|
Loading…
Add table
Add a link
Reference in a new issue