summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKarl 'vollmerk' Vollmer <vollmer@ampache.org>2007-01-15 20:44:17 +0000
committerKarl 'vollmerk' Vollmer <vollmer@ampache.org>2007-01-15 20:44:17 +0000
commit883a1d60d3993f606131108d8c5675617d94bc82 (patch)
tree213d9af47987ef68608217acc20bcd2726e9304b
parent43cc00bb87743334aab8743eef056303ec126e1a (diff)
downloadampache-883a1d60d3993f606131108d8c5675617d94bc82.tar.gz
ampache-883a1d60d3993f606131108d8c5675617d94bc82.tar.bz2
ampache-883a1d60d3993f606131108d8c5675617d94bc82.zip
speed up amazon gather and fixed some logic issues, and switched to disks for the download icons
-rwxr-xr-xdocs/CHANGELOG3
-rw-r--r--images/icon_download.pngbin766 -> 620 bytes
-rw-r--r--lib/class/album.class.php35
-rw-r--r--lib/class/song.class.php7
-rw-r--r--lib/class/update.class.php4
-rw-r--r--templates/show_albums.inc2
-rw-r--r--templates/show_artist.inc2
-rw-r--r--templates/show_genres.inc.php2
-rw-r--r--themes/burgundy/theme.cfg.php44
-rw-r--r--themes/classic/theme.cfg.php46
-rw-r--r--themes/greyblock/theme.cfg.php4
11 files changed, 51 insertions, 98 deletions
diff --git a/docs/CHANGELOG b/docs/CHANGELOG
index 7817d4a0..e8aa8a48 100755
--- a/docs/CHANGELOG
+++ b/docs/CHANGELOG
@@ -4,6 +4,9 @@
--------------------------------------------------------------------------
v.3.3.3
+ - Fixed a logic issue with force_http_play
+ - Improved performance of Amazon album art search by reducing the
+ queries made on gather album art
- Fixed an issue with all numeric usernames
- Fixed some minor catalog cleaning issues that could arrise due
to the order of the clean functions
diff --git a/images/icon_download.png b/images/icon_download.png
index 8606ff0f..99d532e8 100644
--- a/images/icon_download.png
+++ b/images/icon_download.png
Binary files differ
diff --git a/lib/class/album.class.php b/lib/class/album.class.php
index 67bf218e..1102d3d6 100644
--- a/lib/class/album.class.php
+++ b/lib/class/album.class.php
@@ -332,8 +332,6 @@ class Album {
while ( FALSE !== ($file = @readdir($handle)) ) {
$extension = substr($file,strlen($file)-3,4);
-
-
/* If it's an image file */
if ($extension == "jpg" || $extension == "gif" || $extension == "png" || $extension == "jp2") {
@@ -432,20 +430,49 @@ class Album {
/* Setup the needed variables */
$max_pages_to_search = max(conf('max_amazon_results_pages'),$amazon->_default_results_pages);
$pages_to_search = $max_pages_to_search; //init to max until we know better.
+
+ // while we have pages to search
do {
- $search_results = array_merge($search_results, $amazon->search(array('artist' => $artist, 'album' => $albumname, 'keywords' => $keywords)));
+ $raw_results = $amazon->search(array('artist'=>$artist,'album'=>$albumname,'keywords'=>$keywords));
+
+ $total = count($raw_results) + count($search_results);
+
+ // If we've gotten more then we wanted
+ if (!empty($limit) && $total > $limit) {
+ // We don't want ot re-count every loop
+ $i = $total;
+ while ($i > $limit) {
+ array_pop($raw_results);
+ $i--;
+ }
+
+ debug_event('amazon-xml',"Found $total, Limit $limit reducing and breaking from loop",'5');
+ // Merge the results and BREAK!
+ $search_results = array_merge($search_results,$raw_results);
+ break;
+ } // if limit defined
+
+ $search_results = array_merge($search_results,$raw_results);
$pages_to_search = min($max_pages_to_search, $amazon->_maxPage);
debug_event('amazon-xml', "Searched results page " . ($amazon->_currentPage+1) . "/" . $pages_to_search,'5');
$amazon->_currentPage++;
+
} while($amazon->_currentPage < $pages_to_search);
+
// Only do the second search if the first actually returns something
if (count($search_results)) {
$final_results = $amazon->lookup($search_results);
}
-
+
/* Log this if we're doin debug */
debug_event('amazon-xml',"Searched using $keywords with " . conf('amazon_developer_key') . " as key " . count($final_results) . " results found",'5');
+
+ // If we've hit our limit
+ if (!empty($limit) && count($final_results) >= $limit) {
+ break;
+ }
+
} // end foreach
/* Foreach through what we've found */
diff --git a/lib/class/song.class.php b/lib/class/song.class.php
index 7378ee29..b64f195c 100644
--- a/lib/class/song.class.php
+++ b/lib/class/song.class.php
@@ -800,6 +800,7 @@ class Song {
/* Define Variables we are going to need */
$username = scrub_out($GLOBALS['user']->username);
$song_id = $this->id;
+
if (conf('require_session')) {
if ($session_id) {
$session_string = "&sid=" . $session_id;
@@ -808,6 +809,7 @@ class Song {
$session_string = "&sid=" . session_id();
}
} // if they are requiring a session
+
$type = $this->type;
if ($GLOBALS['user']->prefs['play_type'] == 'downsample') {
@@ -816,12 +818,13 @@ class Song {
/* Account for retarded players */
if ($song->type == 'flac') { $type = 'ogg'; }
- $this->format_song();
+
+ $this->format();
$song_name = rawurlencode($this->f_artist_full . " - " . $this->title . "." . $this->type);
$web_path = conf('web_path');
- if (conf('force_http_play') AND !$force_http) {
+ if (conf('force_http_play') OR !empty($force_http)) {
$port = conf('http_port');
$web_path = preg_replace("/https/", "http",$web_path);
$web_path = preg_replace("/:\d+/",":$port",$web_path);
diff --git a/lib/class/update.class.php b/lib/class/update.class.php
index a11108fe..9f9bbd7d 100644
--- a/lib/class/update.class.php
+++ b/lib/class/update.class.php
@@ -1709,6 +1709,9 @@ class Update {
/* Clean Up Indexes */
+ // Prevent the script from timing out
+ set_time_limit(0);
+
// Access List
$sql = "ALTER TABLE `access_list` DROP INDEX `ip`";
$db_results = mysql_query($sql, dbh());
@@ -2004,6 +2007,7 @@ class Update {
// Prevent the script from timing out
set_time_limit(0);
+
/* Foreach through the old stuff and dump it back into the fresh table */
foreach ($results as $row) {
diff --git a/templates/show_albums.inc b/templates/show_albums.inc
index 5ebdebf0..b24804b1 100644
--- a/templates/show_albums.inc
+++ b/templates/show_albums.inc
@@ -65,7 +65,7 @@ foreach ($albums as $album) {
</a>
<?php if (batch_ok()) { ?>
<a href="<?php echo $web_path; ?>/batch.php?action=alb&amp;id=<?php echo $album->id; ?>">
- <?php echo get_user_icon('download'); ?>
+ <?php echo get_user_icon('batch_download'); ?>
</a>
<?php } ?>
<?php if ($GLOBALS['user']->has_access('50')) { ?>
diff --git a/templates/show_artist.inc b/templates/show_artist.inc
index 57d4e415..593f4188 100644
--- a/templates/show_artist.inc
+++ b/templates/show_artist.inc
@@ -67,7 +67,7 @@ foreach ($albums as $album) {
</a>
<?php if (batch_ok()) { ?>
<a href="<?php echo $web_path; ?>/batch.php?action=alb&amp;id=<?php echo $album->id; ?>">
- <?php echo get_user_icon('download'); ?>
+ <?php echo get_user_icon('batch_download'); ?>
</a>
<?php } ?>
<?php if ($GLOBALS['user']->has_access('100')) { ?>
diff --git a/templates/show_genres.inc.php b/templates/show_genres.inc.php
index 0ffd7492..59daf51d 100644
--- a/templates/show_genres.inc.php
+++ b/templates/show_genres.inc.php
@@ -52,7 +52,7 @@ foreach ($genres as $genre) {
</a>
<?php if (batch_ok()) { ?>
<a href="<?php echo $genre->download_link; ?>">
- <?php echo get_user_icon('download'); ?>
+ <?php echo get_user_icon('batch_download'); ?>
</a>
<?php } ?>
</td>
diff --git a/themes/burgundy/theme.cfg.php b/themes/burgundy/theme.cfg.php
index c7246a0d..7c37c684 100644
--- a/themes/burgundy/theme.cfg.php
+++ b/themes/burgundy/theme.cfg.php
@@ -23,7 +23,7 @@ author = "S1amson"
# maintaining this theme incase it's not working right
# please include an e-mail address so you can be contacted
# DEFAULT: N/A
-maintainer = "Karl Vollmer"
+maintainer = "Spocky"
# Version
# This is the version of the Theme (usefull if you've updated it)
@@ -40,45 +40,3 @@ orientation = "horizontal"
# respective pages. If you want to make the menu's something like the classic theme
# comment this out
# submenu = "simple"
-
-# Theme Colors
-###################
-[color]
-###################
-# Below is a list of the default colors for this theme, upon
-# applying this theme the users color preferences will be reset
-# to what is listed below...
-
-# Background Color 1
-bg_color1 = "#320000"
-
-# Background Color 2
-bg_color2 = "#7A0000"
-
-# Base Color 1
-base_color1 = "#320000"
-
-# Base Color 2
-base_color2 = "#9F0000"
-
-# Font Color 1
-font_color1 = "#222222"
-
-# Font Color 2
-font_color2 = "#ffffcc"
-
-# Font Color 3
-font_color3 = "#ffffff"
-
-# Row Color 1
-row_color1 = "#ffffcc"
-
-# Row Color 2
-row_color2 = "#9F0000"
-
-# Row Color 3
-row_color3 = "#7A0000"
-
-# Error Color
-error_color = "#ffffcc"
-
diff --git a/themes/classic/theme.cfg.php b/themes/classic/theme.cfg.php
index 19134e4d..9963bd65 100644
--- a/themes/classic/theme.cfg.php
+++ b/themes/classic/theme.cfg.php
@@ -16,14 +16,14 @@ name = "Classic Ampache"
# This is just a way of giving credit to the
# person who actually created this theme
# DEFAULT: N/A
-#author = "Ben Shields"
+author = "Ros"
# Theme Maintainer
# This is just a way of listing who is responsible for
# maintaining this theme incase it's not working right
# please include an e-mail address so you can be contacted
# DEFAULT: N/A
-#maintainer = "Ben Shields <foo@ampache.org>"
+maintainer = "Spocky"
# Orientation
# This was added as of 3.3.2-Alpha4, this tells Ampache if this theme
@@ -36,45 +36,3 @@ orientation = "vertical"
# respective pages. If you want to make the menu's something like the classic theme
# comment this out
#submenu = "simple"
-
-# Theme Colors
-###################
-[color]
-###################
-# Below is a list of the default colors for this theme, upon
-# applying this theme the users color preferences will be reset
-# to what is listed below...
-
-# Background Color 1
-bg_color1 = "#ffffff"
-
-# Background Color 2
-bg_color2 = "#000000"
-
-# Base Color 1
-base_color1 = "#bbbbbb"
-
-# Base Color 2
-base_color2 = "#dddddd"
-
-# Font Color 1
-font_color1 = "#222222"
-
-# Font Color 2
-font_color2 = "#000000"
-
-# Font Color 3
-font_color3 = "#ffffff"
-
-# Row Color 1
-row_color1 = "#cccccc"
-
-# Row Color 2
-row_color2 = "#bbbbbb"
-
-# Row Color 3
-row_color3 = "#dddddd"
-
-# Error Color
-error_color = "#990033"
-
diff --git a/themes/greyblock/theme.cfg.php b/themes/greyblock/theme.cfg.php
index 059bec88..31c43599 100644
--- a/themes/greyblock/theme.cfg.php
+++ b/themes/greyblock/theme.cfg.php
@@ -16,14 +16,14 @@ name = "Greyblock"
# This is just a way of giving credit to the
# person who actually created this theme
# DEFAULT: N/A
-#author = "Ben Shields"
+author = "Ben Shields"
# Theme Maintainer
# This is just a way of listing who is responsible for
# maintaining this theme incase it's not working right
# please include an e-mail address so you can be contacted
# DEFAULT: N/A
-#maintainer = "Ben Shields <shieldb@ampache.org>"
+maintainer = "Spocky"
# Simple Menus
submenu = "full"