diff options
-rw-r--r-- | lib/batch.lib.php | 1 | ||||
-rw-r--r-- | lib/class/user.class.php | 22 | ||||
-rw-r--r-- | lib/init.php | 2 | ||||
-rw-r--r-- | templates/list_header.inc | 1 | ||||
-rw-r--r-- | templates/show_object_rating.inc.php | 5 |
5 files changed, 26 insertions, 5 deletions
diff --git a/lib/batch.lib.php b/lib/batch.lib.php index 867956a9..6666cbb1 100644 --- a/lib/batch.lib.php +++ b/lib/batch.lib.php @@ -34,7 +34,6 @@ function get_song_files( $song_ids ) { $song = new Song( $song_id ); /* Don't archive disabled songs */ if ($song->status != 'disabled') { - $user->update_stats( $song_id ); $total_size += sprintf("%.2f",($song->size/1048576)); array_push( $song_files, $song->file ); } // if song isn't disabled 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 /** diff --git a/lib/init.php b/lib/init.php index d645f0ae..72809b14 100644 --- a/lib/init.php +++ b/lib/init.php @@ -190,6 +190,8 @@ require_once(conf('prefix') . '/lib/class/access.class.php'); require_once(conf('prefix') . '/lib/class/error.class.php'); require_once(conf('prefix') . '/lib/class/genre.class.php'); require_once(conf('prefix') . '/lib/class/flag.class.php'); +require_once(conf('prefix') . '/lib/class/audioscrobbler.class.php'); + /* Set a new Error Handler */ $old_error_handler = set_error_handler("ampache_error_handler"); diff --git a/templates/list_header.inc b/templates/list_header.inc index 08812014..58c7fa61 100644 --- a/templates/list_header.inc +++ b/templates/list_header.inc @@ -41,6 +41,7 @@ $prev_offset = $GLOBALS['view']->offset - $GLOBALS['view']->offset_limit; if ($prev_offset < 0) { $prev_offset = '0'; } /* Calculate how many pages total exist */ +if (!$GLOBALS['view']->offset_limit) { $GLOBALS['view']->offset_limit = '50'; } $pages = ceil($total_items/$GLOBALS['view']->offset_limit); /* Calculate current page and how many we have on each side */ diff --git a/templates/show_object_rating.inc.php b/templates/show_object_rating.inc.php index d24b62c6..5f4de7c7 100644 --- a/templates/show_object_rating.inc.php +++ b/templates/show_object_rating.inc.php @@ -4,9 +4,8 @@ All Rights Reserved 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. + modify it under the terms of the GNU General Public License v2 + as published by the Free Software Foundation. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of |