browse works for all metadata categories.

This commit is contained in:
naomiaro 2010-09-29 10:52:30 -04:00
parent 48d68cb203
commit 82dc64af2d
1 changed files with 41 additions and 45 deletions

View File

@ -59,20 +59,20 @@ require_once(dirname(__FILE__)."/StoredFile.php");
require_once(dirname(__FILE__)."/Transport.php"); require_once(dirname(__FILE__)."/Transport.php");
$g_metadata_xml_to_db_mapping = array( $g_metadata_xml_to_db_mapping = array(
'dc:format' => "format", "dc:format" => "format",
"ls:bitrate" => "bit_rate", "ls:bitrate" => "bit_rate",
"ls:samplerate" => "sample_rate", "ls:samplerate" => "sample_rate",
"dcterms:extent" => "length", "dcterms:extent" => "length",
"dc:title" => "track_title", "dc:title" => "track_title",
"dc:description" => "comments", "dc:description" => "comments",
"dc:type" => "genre", "dc:type" => "genre",
"dc:creator" => "artist_name", "dc:creator" => "artist_name",
"dc:source" => "album_title", "dc:source" => "album_title",
"ls:channels" => "channels", "ls:channels" => "channels",
"ls:filename" => "name", "ls:filename" => "name",
"ls:year" => "year", "ls:year" => "year",
"ls:url" => "url", "ls:url" => "url",
"ls:track_num" => "track_number", "ls:track_num" => "track_number",
"ls:mood" => "mood", "ls:mood" => "mood",
"ls:bpm" => "bpm", "ls:bpm" => "bpm",
"ls:disc_num" => "disc_number", "ls:disc_num" => "disc_number",
@ -1139,9 +1139,35 @@ class BasicStor {
// Final query // Final query
$sql = "SELECT * FROM ((SELECT creator AS artist_name, NULL AS album_title, //"dcterms:extent" => "length",
name AS track_title, length, NULL AS track_number, //"dc:title" => "track_title",
PL.id, 'playlist' AS ftype //"dc:creator" => "artist_name",
global $g_metadata_xml_to_db_mapping;
$plSelect = "SELECT ";
$fileSelect = "SELECT ";
$_SESSION["br"] = "";
foreach ($g_metadata_xml_to_db_mapping as $key => $val){
$_SESSION["br"] .= "key: ".$key." value:".$val.", ";
if($key === "dc:title"){
$plSelect .= "name AS ".$val.", ";
$fileSelect .= $val.", ";
}
else if ($key === "dc:creator"){
$plSelect .= "creator AS ".$val.", ";
$fileSelect .= $val.", ";
}
else if ($key === "dcterms:extent"){
$plSelect .= "length, ";
$fileSelect .= "text(".$val.") AS ".$val.", ";
}
else {
$plSelect .= "NULL AS ".$val.", ";
$fileSelect .= $val.", ";
}
}
$sql = "SELECT * FROM ((".$plSelect."PL.id, 'playlist' AS ftype
FROM ".$CC_CONFIG["playListTable"]." AS PL, FROM ".$CC_CONFIG["playListTable"]." AS PL,
(SELECT playlist_id AS id, text(SUM(cliplength)) AS length (SELECT playlist_id AS id, text(SUM(cliplength)) AS length
FROM ".$CC_CONFIG["playListContentsTable"]." group by playlist_id) AS T FROM ".$CC_CONFIG["playListContentsTable"]." group by playlist_id) AS T
@ -1149,8 +1175,7 @@ class BasicStor {
UNION UNION
SELECT artist_name, album_title, track_title, text(length) AS length, ".$fileSelect."id, ftype FROM " .$CC_CONFIG["filesTable"].") AS Content ";
track_number, id, ftype FROM " .$CC_CONFIG["filesTable"].") AS Content ";
$sql .= $whereClause; $sql .= $whereClause;
@ -2101,35 +2126,6 @@ class BasicStor {
); );
} }
/**
* dump
*
*/
// public function dump($id='', $indch=' ', $ind='', $format='{name}')
// {
// if ($id=='') {
// $id = $this->storId;
// }
// return parent::dump($id, $indch, $ind, $format);
// }
/**
*
*
*/
// public function dumpDir($id='', $format='$o["name"]')
// {
// if ($id == '') {
// $id = $this->storId;
// }
// $arr = M2tree::GetDir($id, 'id,name');
// $arr = array_map(create_function('$o', 'return "'.$format .'";'), $arr);
// return join('', $arr);
// }
/** /**
* *
* *