summaryrefslogtreecommitdiffstats
path: root/lib/class
diff options
context:
space:
mode:
authorKarl 'vollmerk' Vollmer <vollmer@ampache.org>2008-08-05 03:59:06 +0000
committerKarl 'vollmerk' Vollmer <vollmer@ampache.org>2008-08-05 03:59:06 +0000
commit6276503dad74ac1cfc424ee6adebf3a720836141 (patch)
tree175eabb5ddee29a5fe7df176f67b665a8684378c /lib/class
parent0dbace41fe33a9bc2460a58be1022f11b35f4b8c (diff)
downloadampache-6276503dad74ac1cfc424ee6adebf3a720836141.tar.gz
ampache-6276503dad74ac1cfc424ee6adebf3a720836141.tar.bz2
ampache-6276503dad74ac1cfc424ee6adebf3a720836141.zip
unbreak browsing and kind of torture tagging a little
Diffstat (limited to 'lib/class')
-rw-r--r--lib/class/browse.class.php4
-rw-r--r--lib/class/vainfo.class.php46
2 files changed, 38 insertions, 12 deletions
diff --git a/lib/class/browse.class.php b/lib/class/browse.class.php
index cc72e4ca..5ad791f3 100644
--- a/lib/class/browse.class.php
+++ b/lib/class/browse.class.php
@@ -344,7 +344,7 @@ class Browse {
*/
public static function get_saved() {
- $objects = $_SESSION['browse']['save'];
+ $objects = $_SESSION['browse']['save'][self::$type];
return $objects;
@@ -894,7 +894,7 @@ class Browse {
public static function save_objects($object_ids) {
// save these objects
- $_SESSION['browse']['save'] = $object_ids;
+ $_SESSION['browse']['save'][self::$type] = $object_ids;
self::$total_objects = count($object_ids);
return true;
diff --git a/lib/class/vainfo.class.php b/lib/class/vainfo.class.php
index ee2ce147..1997a54f 100644
--- a/lib/class/vainfo.class.php
+++ b/lib/class/vainfo.class.php
@@ -173,7 +173,7 @@ class vainfo {
$results[$key] = $this->_parse_id3v1($tag_array);
break;
case 'id3v2':
- $results[$key] = $this->_parse_id3v2($tag_array);
+ $results[$key] = $this->_parse_id3v2($this->_raw['id3v2']['comments']);
break;
case 'ape':
$results[$key] = $this->_parse_ape($tag_array);
@@ -186,7 +186,7 @@ class vainfo {
break;
default:
debug_event('vainfo','Error: Unable to determine tag type of ' . $key . ' for file ' . $this->filename . ' Assuming id3v2','5');
- $results[$key] = $this->_parse_id3v2($tag_array);
+ $results[$key] = $this->_parse_id3v2($this->_raw['id3v2']['comments']);
break;
} // end switch
@@ -310,7 +310,7 @@ class vainfo {
$array = array();
- // $encoding = $this->_raw['id3v1']['encoding'];
+ $encoding = $this->_raw['id3v1']['encoding'];
/* Go through all the tags */
foreach ($tags as $tag=>$data) {
@@ -338,7 +338,7 @@ class vainfo {
/* Go through the tags */
foreach ($tags as $tag=>$data) {
-
+
/**
* the new getid3 handles this differently
* so we now need to account for it :(
@@ -355,8 +355,13 @@ class vainfo {
case 'comments':
$array['comment'] = $this->_clean_tag($data['0'],'');
break;
+ case 'title':
+ $array['title'] = $this->_clean_tag($data['0'],$this->_raw['id3v2']['TIT2']['0']['encoding']);
+ break;
default:
- $array[$tag] = $this->_clean_tag($data['0'],'');
+ $frame = $this->_id3v2_tag_to_frame($tag);
+ $encoding = $frame ? $this->_raw['id3v2'][$frame]['0']['encoding'] : '';
+ $array[$tag] = $this->_clean_tag($data['0'],$encoding);
break;
} // end switch on tag
@@ -441,7 +446,6 @@ class vainfo {
} // _parse_quicktime
-
/**
* _parse_filename
* This function uses the passed file and dir patterns
@@ -485,6 +489,32 @@ class vainfo {
} // _parse_filename
/**
+ * _id3v2_tag_to_frame
+ * This translates the tag name to a frame, if there a many it returns the first
+ * one if finds that exists in the raw
+ */
+ private function _id3v2_tag_to_frame($tag_name) {
+
+ static $map = array(
+ 'comment'=>array('COM','COMM'),
+ 'cd_ident'=>array('MCDI','MCI'),
+ 'album'=>array('TAL','TALB'),
+ 'language'=>array('TLA','TLAN'),
+ 'mood'=>array('TMOO'),
+ 'artist'=>array('TPE1'),
+ 'year'=>array('TDRC'));
+
+ foreach ($map[$tag_name] as $frame) {
+ if (isset($this->_raw['id3v2'][$frame])) {
+ return $frame;
+ }
+ }
+
+ return false;
+
+ } // _id3v2_tag_to_frame
+
+ /**
* _clean_tag
* This function cleans up the tag that it's passed using Iconv
* if we've got it. It also takes an optional encoding param
@@ -494,8 +524,6 @@ class vainfo {
*/
private function _clean_tag($tag,$encoding='') {
- return $tag;
-
// If we've got iconv then go ahead and clear her up
if ($this->_iconv) {
/* Guess that it's UTF-8 */
@@ -506,8 +534,6 @@ class vainfo {
return $tag;
-
-
} // _clean_tag
} // end class vainfo