summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKarl 'vollmerk' Vollmer <vollmer@ampache.org>2007-12-30 08:29:23 +0000
committerKarl 'vollmerk' Vollmer <vollmer@ampache.org>2007-12-30 08:29:23 +0000
commit4e716204e84fc7546372bdae79121e47b92412bc (patch)
tree2f1ff4913d6363111cea36b7dbaf0d2f8266a3b9
parent5975361e038e17e5f91fd69da4f5df2d3e5af259 (diff)
downloadampache-4e716204e84fc7546372bdae79121e47b92412bc.tar.gz
ampache-4e716204e84fc7546372bdae79121e47b92412bc.tar.bz2
ampache-4e716204e84fc7546372bdae79121e47b92412bc.zip
fixed localplay index problem after track delete, fixed lack of high-light of current playing song, fixed problem were second localplay send would kill session of any existing items
-rwxr-xr-xdocs/CHANGELOG7
-rw-r--r--lib/class/album.class.php8
-rw-r--r--lib/class/stream.class.php10
-rw-r--r--modules/infotools/lastfm.class.php52
-rw-r--r--server/localplay.ajax.php11
-rw-r--r--templates/show_localplay_playlist.inc.php2
-rw-r--r--templates/show_localplay_status.inc.php1
-rw-r--r--themes/classic/templates/default.css5
-rw-r--r--themes/greysme/templates/default.css4
9 files changed, 76 insertions, 24 deletions
diff --git a/docs/CHANGELOG b/docs/CHANGELOG
index 4455ae58..d717be3b 100755
--- a/docs/CHANGELOG
+++ b/docs/CHANGELOG
@@ -4,6 +4,13 @@
--------------------------------------------------------------------------
v.3.4-Beta2
+ - Fixed incorrect index on localplay playlist after track deletion
+ - Fixed lack of high-light of current playing item on localplay
+ playlist
+ - Fixed problem where second send to MPD would invalidate all
+ previous songs on the playlist
+ - Fixed LastFM album art gather so it ignores noimage results from
+ lastfm
- Fixed downsample remote so that is downsamples those not in the
network def rather then those inside the network def
- Fixed issue with page-a-nation on show catalogs page
diff --git a/lib/class/album.class.php b/lib/class/album.class.php
index ca6f1b10..ea39c9aa 100644
--- a/lib/class/album.class.php
+++ b/lib/class/album.class.php
@@ -351,6 +351,13 @@ class Album {
foreach ($coverart as $key=>$value) {
$i++;
$url = $coverart[$key];
+
+ // We need to check the URL for the /noimage/ stuff
+ if (strstr($url,"/noimage/")) {
+ debug_event('LastFM','Detected as noimage, skipped ' . $url,'3');
+ continue;
+ }
+
$results = pathinfo($url);
$mime = 'image/' . $results['extension'];
$data[] = array('url'=>$url,'mime'=>$mime);
@@ -358,6 +365,7 @@ class Album {
} // end foreach
return $data;
+
} // get_lastfm_art
/*!
diff --git a/lib/class/stream.class.php b/lib/class/stream.class.php
index 7d9092fc..71fd4626 100644
--- a/lib/class/stream.class.php
+++ b/lib/class/stream.class.php
@@ -153,12 +153,22 @@ class Stream {
/**
* gc_session
* This function performes the garbage collection stuff, run on extend and on now playing refresh
+ * There is an array of agents that we will never GC because of their nature, MPD being the best example
*/
public static function gc_session($ip='',$agent='',$uid='',$sid='') {
+ $append_array = array('MPD');
+
$time = time();
$sql = "DELETE FROM `session_stream` WHERE `expire` < '$time'";
$db_results = Dba::query($sql);
+
+ foreach ($append_array as $append_agent) {
+ if (strstr(strtoupper($agent),$append_agent)) {
+ // We're done here jump ship!
+ return true;
+ }
+ } // end foreach
// We need all of this to run this query
if ($ip AND $agent AND $uid AND $sid) {
diff --git a/modules/infotools/lastfm.class.php b/modules/infotools/lastfm.class.php
index 4cc96ec9..7126ea83 100644
--- a/modules/infotools/lastfm.class.php
+++ b/modules/infotools/lastfm.class.php
@@ -6,8 +6,8 @@
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
- as published by the Free Software Foundation; either version 2
- of the License, or (at your option) any later version.
+ as published by the Free Software Foundation; version 2
+ of the License.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
@@ -79,15 +79,15 @@ class LastFMSearch {
} // run_search
- /*!
- @function search
- @discussion takes terms and a type
- */
- function search($artist,$album) {
+ /**
+ * search
+ * takes terms and a type
+ */
+ public function search($artist,$album) {
$url = $this->base_url . '/' . urlencode($artist) . '/' . urlencode($album) . '/info.xml';
- debug_event('lastfm','Searching:' . $url,'3');
+ debug_event('lastfm','Searching: ' . $url,'3');
$this->run_search($url);
@@ -95,8 +95,11 @@ class LastFMSearch {
} // search
-
- function start_element($parser, $tag, $attributes) {
+ /**
+ * start_element
+ * This function is called when we see the start of an xml element
+ */
+ public function start_element($parser, $tag, $attributes) {
if ($tag == 'coverart') {
$this->_currentTag = $tag;
@@ -105,25 +108,32 @@ class LastFMSearch {
$this->_subTag = $tag;
}
- } // start_element
-
- function cdata($parser, $cdata) {
+ } // start_element
+ /**
+ * cdata
+ * This is called for the content of an XML tag
+ */
+ public function cdata($parser, $cdata) {
- if (!$this->_currentTag || !$this->_subTag || !trim($cdata)) { return false; }
+ if (!$this->_currentTag || !$this->_subTag || !trim($cdata)) { return false; }
- $tag = $this->_currentTag;
- $subtag = $this->_subTag;
+ $tag = $this->_currentTag;
+ $subtag = $this->_subTag;
- $this->results[$tag][$subtag] = trim($cdata);
+ $this->results[$tag][$subtag] = trim($cdata);
- } // cdata
-
- function end_element($parser, $tag) {
+ } // cdata
+
+ /**
+ * end_element
+ * This is called on the close of an XML tag
+ */
+ public function end_element($parser, $tag) {
if ($tag == 'coverart') { $this->_currentTag = ''; }
- } // end_element
+ } // end_element
} // end LastFMSearch
diff --git a/server/localplay.ajax.php b/server/localplay.ajax.php
index 405812f2..a9ef949f 100644
--- a/server/localplay.ajax.php
+++ b/server/localplay.ajax.php
@@ -109,8 +109,17 @@ switch ($_REQUEST['action']) {
$id = intval($_REQUEST['id']);
$localplay->delete_track($id);
+
+ // Wait incase we just deleted what we were playing
+ sleep(1);
+ $objects = $localplay->get();
+ $status = $localplay->status();
+
+ ob_start();
+ require_once Config::get('prefix') . '/templates/show_localplay_playlist.inc.php';
+ $results['localplay_playlist'] = ob_get_contents();
+ ob_end_clean();
- $results['localplay_playlist_' . $id] = '';
break;
case 'delete_instance':
// Make sure that you have access to do this...
diff --git a/templates/show_localplay_playlist.inc.php b/templates/show_localplay_playlist.inc.php
index e9806a02..b8d87108 100644
--- a/templates/show_localplay_playlist.inc.php
+++ b/templates/show_localplay_playlist.inc.php
@@ -35,7 +35,7 @@
<?php
foreach ($objects as $object) {
$class = ' class="cel_name"';
- if ($status['track'] == $song['track']) { $class=' class="cel_name lp_current"'; }
+ if ($status['track'] == $object['track']) { $class=' class="cel_name lp_current"'; }
?>
<tr class="<?php echo flip_class(); ?>" id="localplay_playlist_<?php echo $object['id']; ?>">
<td class="cel_track">
diff --git a/templates/show_localplay_status.inc.php b/templates/show_localplay_status.inc.php
index 9da440aa..3353872e 100644
--- a/templates/show_localplay_status.inc.php
+++ b/templates/show_localplay_status.inc.php
@@ -20,7 +20,6 @@
*/
$status = $localplay->status();
-
?>
<?php Ajax::start_container('localplay_status'); ?>
<?php show_box_top(_('Localplay Control')); ?>
diff --git a/themes/classic/templates/default.css b/themes/classic/templates/default.css
index 52b62de1..e81a94f5 100644
--- a/themes/classic/templates/default.css
+++ b/themes/classic/templates/default.css
@@ -638,6 +638,11 @@ img.shoutboximage {
text-align: center; /*for compatibility, may be controlled by themers now*/
}
+td.lp_current a {
+ font-weight:bold;
+ text-decoration:none;
+}
+
/************************************************/
/* Styles for Login template */
/************************************************/
diff --git a/themes/greysme/templates/default.css b/themes/greysme/templates/default.css
index 7802e9ac..204c3dde 100644
--- a/themes/greysme/templates/default.css
+++ b/themes/greysme/templates/default.css
@@ -694,6 +694,10 @@ img.shoutboximage {
text-align: center; /*for compatibility, may be controlled by themers now*/
}
+td.lp_current a {
+ font-weight:bold;
+ text-decoration:none;
+}
/************************************************/
/* Styles for Login template */