From 8ab2d92134ac9d21aeedc90626a8232b89527a04 Mon Sep 17 00:00:00 2001 From: tomas Date: Mon, 13 Jun 2005 10:17:49 +0000 Subject: [PATCH] moved to storageAdmin/var --- .../modules/storageAdmin/bin/php/conf.php | 32 ---- .../storageAdmin/bin/php/conf.php.template | 32 ---- .../storageAdmin/bin/php/dumpDbSchema.php | 9 - .../modules/storageAdmin/bin/php/import.php | 162 ------------------ 4 files changed, 235 deletions(-) delete mode 100644 livesupport/modules/storageAdmin/bin/php/conf.php delete mode 100644 livesupport/modules/storageAdmin/bin/php/conf.php.template delete mode 100644 livesupport/modules/storageAdmin/bin/php/dumpDbSchema.php delete mode 100644 livesupport/modules/storageAdmin/bin/php/import.php diff --git a/livesupport/modules/storageAdmin/bin/php/conf.php b/livesupport/modules/storageAdmin/bin/php/conf.php deleted file mode 100644 index a54f51dff..000000000 --- a/livesupport/modules/storageAdmin/bin/php/conf.php +++ /dev/null @@ -1,32 +0,0 @@ - \ No newline at end of file diff --git a/livesupport/modules/storageAdmin/bin/php/conf.php.template b/livesupport/modules/storageAdmin/bin/php/conf.php.template deleted file mode 100644 index 27f2853c8..000000000 --- a/livesupport/modules/storageAdmin/bin/php/conf.php.template +++ /dev/null @@ -1,32 +0,0 @@ - diff --git a/livesupport/modules/storageAdmin/bin/php/dumpDbSchema.php b/livesupport/modules/storageAdmin/bin/php/dumpDbSchema.php deleted file mode 100644 index a48d3862c..000000000 --- a/livesupport/modules/storageAdmin/bin/php/dumpDbSchema.php +++ /dev/null @@ -1,9 +0,0 @@ - \ No newline at end of file diff --git a/livesupport/modules/storageAdmin/bin/php/import.php b/livesupport/modules/storageAdmin/bin/php/import.php deleted file mode 100644 index 338c30d62..000000000 --- a/livesupport/modules/storageAdmin/bin/php/import.php +++ /dev/null @@ -1,162 +0,0 @@ -\n"); -PEAR::setErrorHandling(PEAR_ERROR_RETURN); -$dbc = DB::connect($config['dsn'], TRUE); -if(PEAR::isError($dbc)){ echo "ERROR: ".$dbc->getMessage()." ".$dbc->getUserInfo()."\n"; exit(1); } -$dbc->setFetchMode(DB_FETCHMODE_ASSOC); -$gb = &new GreenBox($dbc, $config); - -$errors=0; -$filecount=0; -function _err($r, $fn){ - global $errors; - echo "ERROR\n ".$r->getMessage()." ".$r->getUserInfo()."\n"; - $errors++; -} - -$flds = array( -// 'fileformat' => NULL, - 'mime_type' => 'dc:format', - 'bitrate' => 'ls:bitrate', - 'playtime_seconds' => 'dcterms:extent', - 'tags' => array( - 'TT2' => 'dc:title', - 'TIT2' => 'dc:title', - 'TP1' => 'dc:creator', - 'TPE1' => 'dc:creator', - 'TAL' => 'dc:source', - 'TALB' => 'dc:source', -// 'TCO' => NULL, - 'TEN' => 'ls:encoded_by', - 'TENC' => 'ls:encoded_by', - 'TRK' => 'ls:track_num', - 'TRCK' => 'ls:track_num', - ), - 'audio' => array( - 'channels' => 'ls:channels', -// 'bitrate' => 'ls:bitrate', - ), - 'comments' => array( - 'genre' => 'dc:type', -// 'genreid' => 'GENREID', - ), - 'filename' => 'ls:filename', -); - -$r = $gb->getObjId('import', $gb->storId); -if(PEAR::isError($r)){ echo "ERROR: ".$r->getMessage()." ".$r->getUserInfo()."\n"; exit(1); } -if(is_null($r)){ - $r = $gb->bsCreateFolder($gb->storId, 'import'); - if(PEAR::isError($r)){ echo "ERROR: ".$r->getMessage()." ".$r->getUserInfo()."\n"; exit(1); } -} -$parid = $r; - -$stdin = fopen('php://stdin', 'r'); -while($filename = fgets($stdin, 2048)){ - $filename = rtrim($filename); - echo "$filename: "; - set_time_limit(30); - $ia = GetAllFileInfo("$filename", 'mp3'); - if(PEAR::isError($ia)){ _err($ia, $filename); continue; } - if(!$ia['fileformat']){ echo "???\n"; continue; } - - $mdata = array(); - foreach($flds as $k1=>$fn1){ - if(is_null($fn1)) continue; - list($fn, $v) = array($fn1, $ia[$k1]); - if(is_array($fn1)){ - $k0 = $k1; - if($k0=='tags') $k1=$ia['tags'][0]; - list($fn, $v) = array($fn1, $ia[$k1]); - foreach($fn1 as $k2=>$fn2){ - if(is_null($fn2)) continue; - if(!isset($ia[$k1][$k2])) continue; - switch($k0){ - case"tags": - list($fn, $v) = array($fn2, $ia[$k1][$k2]['data']); - $enc = $ia[$k1][$k2]['encoding']; - if($enc != 'UTF-8' && $enc != 'ISO-8859-1'){ - echo " Warning: wrong encoding '$enc' in $fn2.\n"; - } - break; - case"comments": - list($fn, $v) = array($fn2, $ia[$k1][$k2][0]); - break; - default; - list($fn, $v) = array($fn2, $ia[$k1][$k2]); - } -# if(is_array($fn)) var_dump($fn); - if(!is_null($v)) $mdata[$fn] = addslashes($v); - } - }else{ - switch($fn){ - case"dcterms:extent": - list($fn, $v) = array($fn1, round($ia[$k1], 6)); - break; - default: - list($fn, $v) = array($fn1, $ia[$k1]); - } - if(!is_null($v)) $mdata[$fn] = addslashes($v); - } - } - - $r = $gb->bsPutFile($parid, $mdata['ls:filename'], "$filename", "$storageServerPath/var/emptyMdata.xml", NULL, 'audioclip'); - if(PEAR::isError($r)){ _err($r, $filename); echo var_export($mdata)."\n"; continue; } - $id = $r; - - $r = $gb->bsSetMetadataBatch($id, $mdata); - if(PEAR::isError($r)){ _err($r, $filename); echo var_export($mdata)."\n"; continue; } - -# $r = $gb->bsGetMetadata($id); -# if(PEAR::isError($r)){ _err($r, $filename); continue; } -# echo "$r\n"; - echo "OK\n"; - $filecount++; -} - -fclose($stdin); -$end = intval(date('U')); -//echo date('H:i:s')."\n"; -$time = $end-$start; -if($time>0) $speed = round(($filecount+$errors)/$time, 1); -else $speed = "N/A"; -echo " File imported: $filecount, in $time s, $speed files/s, errors: $errors\n"; -?> \ No newline at end of file