summaryrefslogtreecommitdiffstats
path: root/play/index.php
diff options
context:
space:
mode:
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) {