summaryrefslogtreecommitdiffstats
path: root/play/index.php
diff options
context:
space:
mode:
authorKarl 'vollmerk' Vollmer <vollmer@ampache.org>2005-07-08 05:12:03 +0000
committerKarl 'vollmerk' Vollmer <vollmer@ampache.org>2005-07-08 05:12:03 +0000
commitc9f8c7abd211ebdb5a4c7d5797e3513aad14530d (patch)
treee1d50deafbd52f10ec6e5588aadb46567ece647e /play/index.php
parentf04fe3df5ef816a2a3394a09f497dc97889de47a (diff)
downloadampache-c9f8c7abd211ebdb5a4c7d5797e3513aad14530d.tar.gz
ampache-c9f8c7abd211ebdb5a4c7d5797e3513aad14530d.tar.bz2
ampache-c9f8c7abd211ebdb5a4c7d5797e3513aad14530d.zip
see changelog...
Diffstat (limited to 'play/index.php')
-rw-r--r--play/index.php22
1 files changed, 15 insertions, 7 deletions
diff --git a/play/index.php b/play/index.php
index 9b3374c6..8555f444 100644
--- a/play/index.php
+++ b/play/index.php
@@ -251,13 +251,21 @@ else {
}
- while (!feof($fp) && (connection_status() == 0)) {
- print(fread($fp, 8192));
- }
-
- if ( ! $start ) {
- $user->update_stats($song_id);
- }
+ /* Let's force them to actually play a portion of the song before
+ * we count it in the statistics
+ * @author SH
+ */
+ $bytesStreamed = 0;
+ $minBytesStreamed = $song->size / 2;
+ while (!feof($fp) && (connection_status() == 0)) {
+ $buf = fread($fp, 8192);
+ print($buf);
+ $bytesStreamed += strlen($buf);
+ }
+
+ if ($bytesStreamed > $minBytesStreamed) {
+ $user->update_stats($song_id);
+ }
// If the played flag isn't set, set it
if (!$song->played) {