summaryrefslogtreecommitdiffstats
path: root/lib/class
diff options
context:
space:
mode:
Diffstat (limited to 'lib/class')
-rw-r--r--lib/class/browse.class.php2
-rw-r--r--lib/class/playlist.class.php26
-rw-r--r--lib/class/vainfo.class.php10
3 files changed, 18 insertions, 20 deletions
diff --git a/lib/class/browse.class.php b/lib/class/browse.class.php
index 77d1a81f..68b6bad3 100644
--- a/lib/class/browse.class.php
+++ b/lib/class/browse.class.php
@@ -176,7 +176,7 @@ class Browse {
public static function get_total($objects=false) {
// If they pass something then just return that
- if (is_array($objects)) {
+ if (is_array($objects) and !self::is_simple_browse()) {
return count($objects);
}
diff --git a/lib/class/playlist.class.php b/lib/class/playlist.class.php
index 02c7d5be..37b645d1 100644
--- a/lib/class/playlist.class.php
+++ b/lib/class/playlist.class.php
@@ -23,7 +23,7 @@
* Playlist Class
* This class handles playlists in ampache. it references the playlist* tables
*/
-class Playlist {
+class Playlist extends database_object {
/* Variables from the Datbase */
public $id;
@@ -43,8 +43,7 @@ class Playlist {
*/
public function __construct($id) {
- $this->id = intval($id);
- $info = $this->_get_info();
+ $info = $this->get_info($id);
foreach ($info as $key=>$value) {
$this->$key = $value;
@@ -52,21 +51,22 @@ class Playlist {
} // Playlist
- /**
- * _get_info
- * This is an internal (private) function that gathers the information for this object from the
- * playlist_id that was passed in.
+ /**
+ * build_cache
+ * This is what builds the cache from the objects
*/
- private function _get_info() {
+ public static function build_cache($ids) {
- $sql = "SELECT * FROM `playlist` WHERE `id`='" . Dba::escape($this->id) . "'";
- $db_results = Dba::query($sql);
+ $idlist = '(' . implode(',',$ids) . ')';
- $results = Dba::fetch_assoc($db_results);
+ $sql = "SELECT * FROM `playlist` WHERE `id` IN $idlist";
+ $db_results = Dba::query($sql);
- return $results;
+ while ($row = Dba::fetch_assoc($db_results)) {
+ parent::add_to_cache('playlist',$row['id'],$row);
+ }
- } // _get_info
+ } // build_cache
/**
* format
diff --git a/lib/class/vainfo.class.php b/lib/class/vainfo.class.php
index 1997a54f..694c19b6 100644
--- a/lib/class/vainfo.class.php
+++ b/lib/class/vainfo.class.php
@@ -68,7 +68,7 @@ class vainfo {
$this->_getID3->option_tags_html = false;
$this->_getID3->option_extra_info = false;
$this->_getID3->option_tag_lyrics3 = false;
-// $this->_getID3->encoding = $this->encoding;
+ $this->_getID3->encoding = $this->encoding;
$this->_getID3->option_tags_process = true;
/* Check for ICONV */
@@ -173,7 +173,7 @@ class vainfo {
$results[$key] = $this->_parse_id3v1($tag_array);
break;
case 'id3v2':
- $results[$key] = $this->_parse_id3v2($this->_raw['id3v2']['comments']);
+ $results[$key] = $this->_parse_id3v2($tag_array);
break;
case 'ape':
$results[$key] = $this->_parse_ape($tag_array);
@@ -356,12 +356,10 @@ class vainfo {
$array['comment'] = $this->_clean_tag($data['0'],'');
break;
case 'title':
- $array['title'] = $this->_clean_tag($data['0'],$this->_raw['id3v2']['TIT2']['0']['encoding']);
+ $array['title'] = $this->_clean_tag($data['0'],'');
break;
default:
- $frame = $this->_id3v2_tag_to_frame($tag);
- $encoding = $frame ? $this->_raw['id3v2'][$frame]['0']['encoding'] : '';
- $array[$tag] = $this->_clean_tag($data['0'],$encoding);
+ $array[$tag] = $this->_clean_tag($data['0'],'');
break;
} // end switch on tag