summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKarl 'vollmerk' Vollmer <vollmer@ampache.org>2008-08-19 04:31:52 +0000
committerKarl 'vollmerk' Vollmer <vollmer@ampache.org>2008-08-19 04:31:52 +0000
commita6a8c08e3721962fd2dc5cfdc6efc1803e844a2b (patch)
tree0a2b14b3029bb3e5bef45af452d10127c0337127
parent619368f183a2c652f8ac40a83d847c608187e53d (diff)
downloadampache-a6a8c08e3721962fd2dc5cfdc6efc1803e844a2b.tar.gz
ampache-a6a8c08e3721962fd2dc5cfdc6efc1803e844a2b.tar.bz2
ampache-a6a8c08e3721962fd2dc5cfdc6efc1803e844a2b.zip
fixed the search a bit, made some random changes to charset and fixed some echo printf() references
-rw-r--r--browse.php13
-rw-r--r--lib/class/browse.class.php2
-rw-r--r--lib/class/playlist.class.php26
-rw-r--r--lib/class/vainfo.class.php10
-rw-r--r--search.php4
-rw-r--r--templates/show_adds_catalog.inc.php5
-rw-r--r--templates/show_clean_catalog.inc.php5
-rw-r--r--templates/show_verify_catalog.inc.php4
8 files changed, 35 insertions, 34 deletions
diff --git a/browse.php b/browse.php
index 2df29389..7553bd6f 100644
--- a/browse.php
+++ b/browse.php
@@ -57,30 +57,30 @@ switch($_REQUEST['action']) {
Browse::set_sort('name','ASC');
$album_ids = Browse::get_objects();
Album::build_cache($album_ids,'extra');
- Browse::show_objects($album_ids);
+ Browse::show_objects();
break;
case 'tag':
Browse::set_sort('count','ASC');
$tags = Browse::get_objects();
Tag::build_cache($tags);
- Browse::show_objects($tags);
+ Browse::show_objects();
break;
case 'artist':
Browse::set_sort('name','ASC');
$artist_ids = Browse::get_objects();
Artist::build_cache($artist_ids,'extra');
- Browse::show_objects($artist_ids);
+ Browse::show_objects();
break;
case 'song':
Browse::set_sort('title','ASC');
$song_ids = Browse::get_objects();
Song::build_cache($song_ids);
- Browse::show_objects($song_ids);
+ Browse::show_objects();
break;
case 'live_stream':
Browse::set_sort('name','ASC');
$live_stream_ids = Browse::get_objects();
- Browse::show_objects($live_stream_ids);
+ Browse::show_objects();
break;
case 'catalog':
@@ -89,7 +89,8 @@ switch($_REQUEST['action']) {
Browse::set_sort('type','ASC');
Browse::set_filter('playlist_type','1');
$playlist_ids = Browse::get_objects();
- Browse::show_objects($playlist_ids);
+ Playlist::build_cache($playlist_ids);
+ Browse::show_objects();
break;
default:
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
diff --git a/search.php b/search.php
index ed1002e5..9a893469 100644
--- a/search.php
+++ b/search.php
@@ -44,9 +44,9 @@ switch ($_REQUEST['action']) {
require_once Config::get('prefix') . '/templates/show_search_options.inc.php';
$results = run_search($_REQUEST);
Browse::set_type('song');
+ Browse::reset();
Browse::set_static_content(1);
- Browse::save_objects($results);
- Browse::show_objects();
+ Browse::show_objects($results);
break;
case 'save_as_track':
$playlist_id = save_search($_REQUEST);
diff --git a/templates/show_adds_catalog.inc.php b/templates/show_adds_catalog.inc.php
index 8448edec..c597353f 100644
--- a/templates/show_adds_catalog.inc.php
+++ b/templates/show_adds_catalog.inc.php
@@ -1,7 +1,7 @@
<?php
/*
- Copyright (c) 2001 - 2007 Ampache.org
+ Copyright (c) Ampache.org
All rights reserved.
This program is free software; you can redistribute it and/or
@@ -20,7 +20,8 @@
*/
show_box_top();
-echo "\n" . printf(_('Starting New Song Search on %s catalog'), " <b>[$this->name]</b> ") . "<br />\n";
+printf(_('Starting New Song Search on %s catalog'), "<strong>[$this->name]</strong>");
+echo "<br />\n";
echo _('Found') . ": <span id=\"add_count_" . $this->id ."\">" . _('None') . "</span><br />\n";
echo _('Reading') . ":<span id=\"add_dir_" . $this->id . "\"></span><br />";
show_box_bottom();
diff --git a/templates/show_clean_catalog.inc.php b/templates/show_clean_catalog.inc.php
index f8f1b3c3..9df88355 100644
--- a/templates/show_clean_catalog.inc.php
+++ b/templates/show_clean_catalog.inc.php
@@ -1,7 +1,7 @@
<?php
/*
- Copyright (c) 2001 - 2007 Ampache.org
+ Copyright (c) Ampache.org
All rights reserved.
This program is free software; you can redistribute it and/or
@@ -21,7 +21,8 @@
show_box_top();
//echo "\n" . _('Cleaning the') . " <b>[" . $this->name . "]</b> " . _('Catalog') . "...<br />\n";
-echo "\n" . printf(_('Cleaning the %s Catalog'), " <b>[" . $this->name . "]</b> ") . "...<br />\n";
+printf(_('Cleaning the %s Catalog'), "<strong>[" . $this->name . "]</strong>");
+echo "...<br />";
echo _('Checking') . ": <span id=\"clean_count_" . $this->id . "\"></span>\n<br />";
echo _('Reading') . ":<span id=\"clean_dir_" . $this->id . "\"></span><br />";
show_box_bottom();
diff --git a/templates/show_verify_catalog.inc.php b/templates/show_verify_catalog.inc.php
index 0d8b7ff5..22a37af3 100644
--- a/templates/show_verify_catalog.inc.php
+++ b/templates/show_verify_catalog.inc.php
@@ -1,7 +1,7 @@
<?php
/*
- Copyright (c) 2001 - 2007 Ampache.org
+ Copyright (c) Ampache.org
All rights reserved.
This program is free software; you can redistribute it and/or
@@ -20,7 +20,7 @@
*/
show_box_top();
-printf(_('Updating the %s catalog', " <b>[ $catalog->name ]</b> "));
+printf(_('Updating the %s catalog', "<strong>[ $catalog->name ]</strong>"));
echo "<br />\n" . $number . " " . _('songs found checking tag information.') . "<br />\n\n";
echo _('Verifed') . ":<span id=\"verify_count_$catalog_id\">$catalog_verify_found</span><br />";
echo _('Reading') . ":<span id=\"verify_dir_$catalog_id\">$catalog_verify_directory</span><br />";