summaryrefslogtreecommitdiffstats
path: root/lib/class/user.class.php
diff options
context:
space:
mode:
authorPaul 'flowerysong' Arthur <flowerysong00@yahoo.com>2010-06-22 19:00:45 +0000
committerPaul 'flowerysong' Arthur <flowerysong00@yahoo.com>2010-06-22 19:00:45 +0000
commita66bf4c5f663d16d6c2ceb4a6cb0a85f642dde43 (patch)
tree0eb8916039977a20e44260ab8fe522eae1522376 /lib/class/user.class.php
parent91eab2086875ad35aa93af00fc8b37d039d9f93c (diff)
downloadampache-a66bf4c5f663d16d6c2ceb4a6cb0a85f642dde43.tar.gz
ampache-a66bf4c5f663d16d6c2ceb4a6cb0a85f642dde43.tar.bz2
ampache-a66bf4c5f663d16d6c2ceb4a6cb0a85f642dde43.zip
Plugin work. Plugins are now pluggable: no plugin-specific code in the main Ampache
code. Plugins are now updatable, if configuration changes are needed for a new version.
Diffstat (limited to 'lib/class/user.class.php')
-rw-r--r--lib/class/user.class.php27
1 files changed, 9 insertions, 18 deletions
diff --git a/lib/class/user.class.php b/lib/class/user.class.php
index 0c5c0653..de759378 100644
--- a/lib/class/user.class.php
+++ b/lib/class/user.class.php
@@ -564,31 +564,22 @@ class User extends database_object {
if (!strlen($song_info->file)) { return false; }
- // Make sure we didn't just play this song
- $data = Stats::get_last_song($this->id);
+ // Make sure we've played a significant chunk of the song
+ $data = Stats::get_last_song($user);
$last_song = new Song($data['object_id']);
- if ($data['date']+($song_info->time/2) >= time()) {
- debug_event('Stats','Not collecting stats less then 50% of song has elapsed','3');
+ if ($data['date'] + ($song_info->time / 2) >= time()) {
+ debug_event('Stats','Not collecting stats less than 50% of song has elapsed','3');
return false;
}
$this->set_preferences();
- // Check if lastfm is loaded, if so run the update
- if (Plugin::is_installed('Last.FM')) {
- $lastfm = new Plugin('Lastfm');
- if ($lastfm->_plugin->load($this->prefs,$this->id)) {
- $lastfm->_plugin->submit($song_info,$this->id);
+ foreach (Plugin::get_plugins('save_songplay') as $plugin_name) {
+ $plugin = new Plugin($plugin_name);
+ if ($plugin->load()) {
+ $plugin->_plugin->save_songplay($song_info);
}
- } // end if is_installed
-
- // Check and see if librefm is loaded and run scrobblizing
- if (Plugin::is_installed('Libre.FM')) {
- $librefm = new Plugin('Librefm');
- if ($librefm->_plugin->load($this->prefs,$this->id)) {
- $librefm->_plugin->submit($song_info,$this->id);
- }
- } // end if is_installed
+ }
// Do this last so the 'last played checks are correct'
Stats::insert('song',$song_id,$user);