summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKarl 'vollmerk' Vollmer <vollmer@ampache.org>2007-07-05 07:32:38 +0000
committerKarl 'vollmerk' Vollmer <vollmer@ampache.org>2007-07-05 07:32:38 +0000
commite07f720bbcb5aa4f1539a0edeeb8c737ae2abf94 (patch)
treee44ba25c36a55fb9c9cb327ebc9d5c70782a82a7
parent83c7a25a76efaf74467c6654f20be3a8029040d9 (diff)
downloadampache-e07f720bbcb5aa4f1539a0edeeb8c737ae2abf94.tar.gz
ampache-e07f720bbcb5aa4f1539a0edeeb8c737ae2abf94.tar.bz2
ampache-e07f720bbcb5aa4f1539a0edeeb8c737ae2abf94.zip
semi-fixed lastfm
-rwxr-xr-xdocs/CHANGELOG2
-rw-r--r--lib/class/scrobbler.class.php (renamed from lib/class/audioscrobbler.class.php)0
-rw-r--r--lib/class/user.class.php5
-rw-r--r--play/index.php7
4 files changed, 9 insertions, 5 deletions
diff --git a/docs/CHANGELOG b/docs/CHANGELOG
index 25633282..91a20f52 100755
--- a/docs/CHANGELOG
+++ b/docs/CHANGELOG
@@ -4,6 +4,8 @@
--------------------------------------------------------------------------
v.3.4-Alpha1
+ - Fixed lastFM and increased timeout slightly in an attempt to
+ improve success rate
- Disabled Search, Random Play & Localplay for Alpha release
- Repalced CC Flash player with the previous GPL based flash player
used patched 0.2.3 version created by Sylvain of
diff --git a/lib/class/audioscrobbler.class.php b/lib/class/scrobbler.class.php
index a90fc773..a90fc773 100644
--- a/lib/class/audioscrobbler.class.php
+++ b/lib/class/scrobbler.class.php
diff --git a/lib/class/user.class.php b/lib/class/user.class.php
index 44f37bed..d2afc339 100644
--- a/lib/class/user.class.php
+++ b/lib/class/user.class.php
@@ -514,7 +514,7 @@ class User {
$song_info = new Song($song_id);
$user = $this->id;
- if (!$song_info->file) { return false; }
+ if (!strlen($song_info->file)) { return false; }
Stats::insert('song',$song_id,$user);
Stats::insert('album',$song_info->album,$user);
@@ -526,7 +526,7 @@ class User {
* because it lags like the dickens try twice on everything
*/
if (!empty($this->prefs['lastfm_user']) AND !empty($this->prefs['lastfm_pass'])) {
- $song_info->format_song();
+ $song_info->format();
$lastfm = new scrobbler($this->prefs['lastfm_user'],$this->prefs['lastfm_pass']);
/* Attempt handshake */
$handshake = $lastfm->handshake();
@@ -552,7 +552,6 @@ class User {
debug_event('LastFM','Error: Handshake failed with LastFM: ' . $lastfm->error_msg,'3');
}
} // record to LastFM
-
} // update_stats
/**
diff --git a/play/index.php b/play/index.php
index 846c86a4..fe26e8e1 100644
--- a/play/index.php
+++ b/play/index.php
@@ -259,14 +259,14 @@ while (!feof($fp) && (connection_status() == 0)) {
$buf = fread($fp, $chunk_size);
print($buf);
if ($GLOBALS['user']->prefs['rate_limit'] > 0) { sleep (1); }
- $bytesStreamed += strlen($buf);
+ $bytesStreamed += $chunk_size;
}
/* Delete the Now Playing Entry */
delete_now_playing($lastid);
if ($bytesStreamed > $minBytesStreamed) {
- $user->update_stats($song_id);
+ $user->update_stats($song->id);
/* If this is a voting tmp playlist remove the entry */
if (is_object($tmp_playlist)) {
if ($tmp_playlist->type == 'vote') {
@@ -274,6 +274,9 @@ if ($bytesStreamed > $minBytesStreamed) {
}
}
}
+else {
+ debug_event('stream',$bytesStreamed .' of ' . $song->size . ' streamed, less then ' . $minBytesStreamed . ' not collecting stats','5');
+}
/* Set the Song as Played if it isn't already */
$song->set_played();