summaryrefslogtreecommitdiffstats
path: root/play/index.php
diff options
context:
space:
mode:
authorKarl 'vollmerk' Vollmer <vollmer@ampache.org>2007-12-15 07:28:51 +0000
committerKarl 'vollmerk' Vollmer <vollmer@ampache.org>2007-12-15 07:28:51 +0000
commit5d98a104bc750053e90da5f8dd9664e0433f900d (patch)
treecae71f304523d7d9572fe809d04210248cac49c0 /play/index.php
parent454003fa93f4d511694fc7234d2f769194b13ede (diff)
downloadampache-5d98a104bc750053e90da5f8dd9664e0433f900d.tar.gz
ampache-5d98a104bc750053e90da5f8dd9664e0433f900d.tar.bz2
ampache-5d98a104bc750053e90da5f8dd9664e0433f900d.zip
made downloads counted in stats fixes ticket #12 tweaked filename to be reformated to match the catalog rename pattern
Diffstat (limited to 'play/index.php')
-rw-r--r--play/index.php11
1 files changed, 10 insertions, 1 deletions
diff --git a/play/index.php b/play/index.php
index 19bc1cd4..56e7fa27 100644
--- a/play/index.php
+++ b/play/index.php
@@ -188,7 +188,8 @@ $song_name = $song->f_artist_full . " - " . $song->title . "." . $song->type;
if ($_GET['action'] == 'download' AND $GLOBALS['user']->prefs['download']) {
// STUPID IE
- $song_name = str_replace(array('?','/','\\'),"_",$song_name);
+ $song->format_pattern();
+ $song_name = str_replace(array('?','/','\\'),"_",$song->f_file);
// Use Horde's Browser class to send the headers
header("Content-Length: " . $song->size);
@@ -212,6 +213,14 @@ if ($_GET['action'] == 'download' AND $GLOBALS['user']->prefs['download']) {
else {
fpassthru($fp);
}
+
+ // Make sure that a good chunk of the song has been played
+ if ($bytesStreamed > $minBytesStreamed) {
+ debug_event('Stats','Downloaded, Registering stats for ' . $song->title,'5');
+
+ $user->update_stats($song->id);
+
+ } // if enough bytes are streamed
fclose($fp);
exit();