summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rwxr-xr-xdocs/CHANGELOG2
-rw-r--r--lib/class/scrobbler.class.php8
-rw-r--r--lib/class/user.class.php31
-rw-r--r--lib/preferences.php6
-rw-r--r--login.php9
-rw-r--r--modules/plugins/Lastfm.plugin.php17
-rw-r--r--templates/show_plugins.inc.php2
-rw-r--r--themes/classic/templates/default.css24
8 files changed, 50 insertions, 49 deletions
diff --git a/docs/CHANGELOG b/docs/CHANGELOG
index 30cf67bf..d93f56b1 100755
--- a/docs/CHANGELOG
+++ b/docs/CHANGELOG
@@ -4,6 +4,8 @@
--------------------------------------------------------------------------
v.3.4-Alpha2
+ - Updated LastFM pluging, must uninstall/reinstall to make it work
+ will add in auto-update later
- Adjusted LastFM reporting to reduce lag betwen songs. You must
now currently be logged in for LastFM to report correctly
- Fixed a potential PHP error when browsing the last page or a
diff --git a/lib/class/scrobbler.class.php b/lib/class/scrobbler.class.php
index 8b8ca5a7..ad379940 100644
--- a/lib/class/scrobbler.class.php
+++ b/lib/class/scrobbler.class.php
@@ -112,16 +112,16 @@ class scrobbler {
}
if(preg_match('/http:\/\/(.*):(\d+)(.*)/', $response[2], $matches)) {
- $_SESSION['state']['lastfm']['submit_host'] = $matches[1];
- $_SESSION['state']['lastfm']['submit_port'] = $matches[2];
- $_SESSION['state']['lastfm']['submit_url'] = $matches[3];
+ $data['submit_host'] = $matches[1];
+ $data['submit_port'] = $matches[2];
+ $data['submit_url'] = $matches[3];
} else {
$this->error_msg = 'Invalid POST URL returned, unable to continue';
return false;
}
$this->challenge = $response[1];
- return true;
+ return $data;
} // handshake
diff --git a/lib/class/user.class.php b/lib/class/user.class.php
index dce54353..8cb28513 100644
--- a/lib/class/user.class.php
+++ b/lib/class/user.class.php
@@ -574,13 +574,11 @@ class User {
if (!empty($this->prefs['lastfm_user']) AND !empty($this->prefs['lastfm_pass'])) {
$song_info->format();
- // We're also going to need the session here
- $data = $this->get_newest_session();
-
+
$lastfm = new scrobbler($this->prefs['lastfm_user'],$this->prefs['lastfm_pass']);
- $lastfm->submit_host = $data['state']['lastfm']['submit_host'];
- $lastfm->submit_port = $data['state']['lastfm']['submit_port'];
- $lastfm->submit_url = $data['state']['lastfm']['submit_url'];
+ $lastfm->submit_host = $this->prefs['lastfm_host'];
+ $lastfm->submit_port = $this->prefs['lastfm_port'];
+ $lastfm->submit_url = $this->prefs['lastfm_url'];
if (!$lastfm->queue_track($song_info->f_artist_full,$song_info->f_album_full,$song_info->title,time(),$song_info->time)) {
debug_event('LastFM','Error: Queue Failed: ' . $lastfm->error_msg,'3');
@@ -1119,27 +1117,6 @@ class User {
} // rebuild_all_preferences
- /**
- * get_newest_session
- * This will find the latest active session for this user and return an array from the serialized value
- */
- public function get_newest_session() {
-
- $username = Dba::escape($this->username);
- $time = time();
-
- $sql = "SELECT `value` FROM `session` WHERE `username`='$username' AND `expire` > '$time' ORDER BY `expire` DESC";
- $db_results = Dba::query($sql);
-
- $row = Dba::fetch_assoc($db_results);
- $string = trim($row['value']);
-
- $value = unseralize($string);
-
- return $value;
-
- } // get_newest_session
-
} //end user class
?>
diff --git a/lib/preferences.php b/lib/preferences.php
index 66338a05..97c0f370 100644
--- a/lib/preferences.php
+++ b/lib/preferences.php
@@ -371,10 +371,10 @@ function create_preference_input($name,$value) {
*/
function get_preference_id($name) {
- $sql = "SELECT id FROM preferences WHERE name='" . sql_escape($name) . "'";
- $db_results = mysql_query($sql, dbh());
+ $sql = "SELECT `id` FROM `preference` WHERE `name`='" . Dba::escape($name) . "'";
+ $db_results =Dba::query($sql);
- $results = mysql_fetch_assoc($db_results);
+ $results = Dba::fetch_assoc($db_results);
return $results['id'];
diff --git a/login.php b/login.php
index b093fa11..096a354a 100644
--- a/login.php
+++ b/login.php
@@ -136,6 +136,15 @@ if ($auth['success']) {
if (!$handshake) {
debug_event('LastFM','Handshake Failed: ' . $lastfm->error_msg,'3');
}
+
+ // Get the preference IDs
+ $port_id = get_preference_id('lastfm_port');
+ $url_id = get_preference_id('lastfm_url');
+ $host_id = get_preference_id('lastfm_host');
+ update_preference($user->id,'lastfm_port',$port_id,$handshake['submit_port']);
+ update_preference($user->id,'lastfm_host',$host_id,$handshake['submit_host']);
+ update_preference($user->id,'lastfm_url',$url_id,$handshake['submit_url']);
+
} // if LastFM
diff --git a/modules/plugins/Lastfm.plugin.php b/modules/plugins/Lastfm.plugin.php
index 4aa7535c..59fca6d6 100644
--- a/modules/plugins/Lastfm.plugin.php
+++ b/modules/plugins/Lastfm.plugin.php
@@ -24,7 +24,7 @@ class AmpacheLastfm {
public $name ='Last.FM';
public $description ='Records your played songs to your Last.FM Account';
public $url ='';
- public $version ='000002';
+ public $version ='000003';
public $min_ampache ='340007';
public $max_ampache ='340008';
@@ -54,6 +54,18 @@ class AmpacheLastfm {
"VALUES ('lastfm_pass',' ','Last.FM Password','25','string','options')";
$db_results = Dba::query($sql);
+ $sql = "INSERT INTO preference (`name`,`value`,`description`,`level`,`type`,`catagory`) " .
+ "VALUES ('lastfm_port',' ','Last.FM Submission port','5','string','internal')";
+ $db_results = Dba::query($sql);
+
+ $sql = "INSERT INTO preference (`name`,`value`,`description`,`level`,`type`,`catagory`) " .
+ "VALUES ('lastfm_host',' ','Last.FM Submission host','5','string','internal')";
+ $db_results = Dba::query($sql);
+
+ $sql = "INSERT INTO preference (`name`,`value`,`description`,`level`,`type`,`catagory`) " .
+ "VALUES ('lastfm_url',' ','Last.FM Submission url','5','string','internal')";
+ $db_results = Dba::query($sql);
+
} // install
/**
@@ -64,7 +76,8 @@ class AmpacheLastfm {
function uninstall() {
/* We need to remove the preivously added preferences */
- $sql = "DELETE FROM `preference` WHERE `name`='lastfm_pass' OR `name`='lastfm_user'";
+ $sql = "DELETE FROM `preference` WHERE `name`='lastfm_pass' OR `name`='lastfm_user' " .
+ "OR `name`='lastfm_url' OR `name`='lastfm_host' OR `name`='lastfm_port'";
$db_results = Dba::query($sql);
} // uninstall
diff --git a/templates/show_plugins.inc.php b/templates/show_plugins.inc.php
index 96957942..fea2af15 100644
--- a/templates/show_plugins.inc.php
+++ b/templates/show_plugins.inc.php
@@ -31,7 +31,7 @@ $web_path = Config::get('web_path');
<?php
foreach ($plugins as $plugin_name) {
$plugin = new Plugin($plugin_name);
- if (!Plugin::is_installed($plugin_name)) {
+ if (!Plugin::is_installed($plugin->_plugin->name)) {
$action = "<a href=\"" . $web_path . "/admin/modules.php?action=install_plugin&amp;plugin=" . scrub_out($plugin_name) . "\">" .
_('Activate') . "</a>";
}
diff --git a/themes/classic/templates/default.css b/themes/classic/templates/default.css
index 8d8142a6..77b92724 100644
--- a/themes/classic/templates/default.css
+++ b/themes/classic/templates/default.css
@@ -136,21 +136,24 @@ a.smallbutton {
/************************************************/
.table-header {
/* background: url(../images/ampache-light-bg.gif) #dddddd repeat-x; */
- background: #a0a0a0;
+ font-size:1.1em;
vertical-align: top;
text-align:center;
}
-.odd {
- font-size: 12px;
- background:#bbb;
+.odd, .odd td {
+ font-size: 12px;
+ border-bottom:1px dotted #c0c0c0;
}
-.even {
- font-size: 12px;
- background:#ddd;
+.even, .even td {
+ font-size: 12px;
+ border-bottom:1px dotted #c0c0c0;
}
+.even:hover, .odd:hover {
+ background:#99ccff;
+}
.headrow {
- font-size: 12px;
- background:#ccc;
+ font-size: 12px;
+ background:#ccc;
}
.blank {
background: #fff;
@@ -503,9 +506,6 @@ span.five-stars:hover { width: 80px; }
/************************************************/
/* List Header Styles */
/************************************************/
-.list-header {
- background:#ffffff;
-}
table.list-header {
margin:3px;
}