diff options
author | Karl 'vollmerk' Vollmer <vollmer@ampache.org> | 2006-12-06 18:21:15 +0000 |
---|---|---|
committer | Karl 'vollmerk' Vollmer <vollmer@ampache.org> | 2006-12-06 18:21:15 +0000 |
commit | caaf0f6e12a52bed50bde91644dff565b90e4325 (patch) | |
tree | 1a3629ce0d73b108e6649f560331f50c12342655 /lib/class/user.class.php | |
parent | f175c68f5de5631846084ef6159896d596ebc299 (diff) | |
download | ampache-caaf0f6e12a52bed50bde91644dff565b90e4325.tar.gz ampache-caaf0f6e12a52bed50bde91644dff565b90e4325.tar.bz2 ampache-caaf0f6e12a52bed50bde91644dff565b90e4325.zip |
dont track stats on a batch download.. thats just insane
Diffstat (limited to 'lib/class/user.class.php')
-rw-r--r-- | lib/class/user.class.php | 22 |
1 files changed, 21 insertions, 1 deletions
diff --git a/lib/class/user.class.php b/lib/class/user.class.php index fefca81f..46ebf4e4 100644 --- a/lib/class/user.class.php +++ b/lib/class/user.class.php @@ -433,7 +433,6 @@ class User { $song_info = new Song($song_id); //FIXME:: User uid reference $user = $this->uid; - if (!$song_info->file) { return false; } $stats = new Stats(); @@ -442,6 +441,27 @@ class User { $stats->insert('artist',$song_info->artist,$user); $stats->insert('genre',$song_info->genre,$user); + /* Record this play to LastFM */ + if ($this->prefs['lastfm_user'] AND $this->prefs['lastfm_pass']) { + $song_info->format_song(); + $lastfm = new scrobbler($this->prefs['lastfm_user'],$this->prefs['lastfm_pass']); + /* Attempt handshake */ + if ($lastfm->handshake()) { + 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'); + } + if (!$lastfm->submit_tracks()) { + debug_event('LastFM','Error Submit Failed' . $lastfm->error_msg,'3'); + } + } // if handshake + else { + debug_event('LastFM','Error: Handshake failed with LastFM:' . $lastfm->error_msg,'3'); + } + } // record to LastFM + else { + debug_event('plugins','Error: No Prefs','3'); + } + } // update_stats /** |