diff options
author | Karl 'vollmerk' Vollmer <vollmer@ampache.org> | 2008-07-15 14:46:30 +0000 |
---|---|---|
committer | Karl 'vollmerk' Vollmer <vollmer@ampache.org> | 2008-07-15 14:46:30 +0000 |
commit | fdda5d1480469fd38bc0d4428ec3aa87d73e6fbd (patch) | |
tree | dee0d4700d4263d17e0505551c7acf5240040947 /play/index.php | |
parent | 50d7a8b7f32fa597823c54be730cbce6d44d2af7 (diff) | |
download | ampache-fdda5d1480469fd38bc0d4428ec3aa87d73e6fbd.tar.gz ampache-fdda5d1480469fd38bc0d4428ec3aa87d73e6fbd.tar.bz2 ampache-fdda5d1480469fd38bc0d4428ec3aa87d73e6fbd.zip |
fixed the albums/artists I broke a few revs ago and sync of the download stats fix from branch
Diffstat (limited to 'play/index.php')
-rw-r--r-- | play/index.php | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/play/index.php b/play/index.php index e3df5584..794a59ff 100644 --- a/play/index.php +++ b/play/index.php @@ -224,6 +224,7 @@ if ($_GET['action'] == 'download' AND Config::get('download')) { $browser = new Browser(); $browser->downloadHeaders($song_name,$song->mime,false,$song->size); $fp = fopen($song->file,'rb'); + $bytesStreamed = 0; if (!is_resource($fp)) { debug_event('file_read_error',"Error: Unable to open $song->file for downloading",'2'); @@ -234,6 +235,7 @@ if ($_GET['action'] == 'download' AND Config::get('download')) { if (Config::get('rate_limit') > 0) { while (!feof($fp)) { echo fread($fp,round(Config::get('rate_limit')*1024)); + $bytesStreamed += round(Config::get('rate_limit')*1024); flush(); sleep(1); } @@ -243,11 +245,9 @@ if ($_GET['action'] == 'download' AND Config::get('download')) { } // Make sure that a good chunk of the song has been played - if ($bytesStreamed > $minBytesStreamed) { + if ($bytesStreamed >= $song->size) { debug_event('Stats','Downloaded, Registering stats for ' . $song->title,'5'); - $user->update_stats($song->id); - } // if enough bytes are streamed fclose($fp); |