diff options
author | Karl 'vollmerk' Vollmer <vollmer@ampache.org> | 2008-03-17 03:29:49 +0000 |
---|---|---|
committer | Karl 'vollmerk' Vollmer <vollmer@ampache.org> | 2008-03-17 03:29:49 +0000 |
commit | bcc834d7fdabd0f52873a4f7696e065e3cf0f281 (patch) | |
tree | e28de4e85f40aaabae0a9263bc37346a8666e915 /play/index.php | |
parent | 27437304248e6d8fd44c2b997673ea112e08afa8 (diff) | |
download | ampache-bcc834d7fdabd0f52873a4f7696e065e3cf0f281.tar.gz ampache-bcc834d7fdabd0f52873a4f7696e065e3cf0f281.tar.bz2 ampache-bcc834d7fdabd0f52873a4f7696e065e3cf0f281.zip |
flush out the democratic mojo, make the cooldown work
Diffstat (limited to 'play/index.php')
-rw-r--r-- | play/index.php | 23 |
1 files changed, 19 insertions, 4 deletions
diff --git a/play/index.php b/play/index.php index 77f34f67..4aaf6465 100644 --- a/play/index.php +++ b/play/index.php @@ -1,7 +1,7 @@ <?php /* - Copyright (c) 2001 - 2007 Ampache.org + Copyright (c) 2001 - 2008 Ampache.org All rights reserved. This program is free software; you can redistribute it and/or @@ -104,9 +104,24 @@ if (Config::get('access_control')) { if ($demo_id) { $democratic = new Democratic($demo_id); $democratic->set_parent(); - /* This takes into account votes etc and removes the */ - $song_id = $democratic->get_next_object(); -} + + // If there is a cooldown we need to make sure this song isn't a repeat + if (!$democratic->cooldown) { + /* This takes into account votes etc and removes the */ + $song_id = $democratic->get_next_object(); + } + else { + // Pull history + $song_id = $democratic->get_next_object($song_cool_check); + $song_ids = $democratic->get_cool_songs(); + while (in_array($song_id,$song_ids)) { + $song_cool_check++; + $song_id = $democratic->get_next_object($song_cool_check); + if ($song_cool_check >= '5') { break; } + } + + } // end if we've got a cooldown +} // if democratic ID passed /** * if we are doing random let's pull the random object |