diff options
-rwxr-xr-x | docs/CHANGELOG | 5 | ||||
-rw-r--r-- | lib/class/song.class.php | 4 | ||||
-rw-r--r-- | lib/stream.lib.php | 31 | ||||
-rw-r--r-- | modules/init.php | 2 | ||||
-rw-r--r-- | play/index.php | 3 |
5 files changed, 25 insertions, 20 deletions
diff --git a/docs/CHANGELOG b/docs/CHANGELOG index 6f6bd21d..92ef5f67 100755 --- a/docs/CHANGELOG +++ b/docs/CHANGELOG @@ -22,7 +22,10 @@ any playback when enabled. (Thx J) - Fixed a flaw in the downsampling which would allow you to set invalid bitrates. (Thx J) - + - Fixed a few problems with WMP, downsampling and now playing + information. This is not a final fix for WMP but it's + better than before. + - Fixed problem where played wasn't getting set correctly. -------------------------------------------------------------------------- diff --git a/lib/class/song.class.php b/lib/class/song.class.php index ae1fbca7..0ef69bbd 100644 --- a/lib/class/song.class.php +++ b/lib/class/song.class.php @@ -245,12 +245,12 @@ class Song { */ function set_played() { - if ($song->played) { + if ($this->played) { return true; } /* If it hasn't been played, set it! */ - $song->update_played('1'); + $this->update_played('1'); return true; diff --git a/lib/stream.lib.php b/lib/stream.lib.php index f363eb92..2692828f 100644 --- a/lib/stream.lib.php +++ b/lib/stream.lib.php @@ -31,13 +31,12 @@ function delete_now_playing($insert_id) { $user_agent = $_SERVER['HTTP_USER_AGENT']; - if (stristr($user_agent,"Windows-Media-Player")) { + if (stristr($user_agent,"NSPlayer")) { // Commented out until I can figure out the // trick to making this work - //return true; + return true; } - // Remove the song from the now_playing table $sql = "DELETE FROM now_playing WHERE id = '$insert_id'"; $db_result = mysql_query($sql, dbh()); @@ -53,10 +52,14 @@ function delete_now_playing($insert_id) { */ function gc_now_playing() { - $time = time(); - $expire = $time - 1800; // 86400 seconds = 1 day + $time = time(); + $expire = $time - 3200; // 86400 seconds = 1 day + $session_id = sql_escape($_REQUEST['sid']); + if (strlen($session_id)) { + $session_sql = " OR session = '$session_id'"; + } - $sql = "DELETE FROM now_playing WHERE start_time < $expire"; + $sql = "DELETE FROM now_playing WHERE start_time < $expire" . $session_sql; $db_result = mysql_query($sql, dbh()); } // gc_now_playing @@ -75,21 +78,21 @@ function insert_now_playing($song_id,$uid,$song_length) { $time = time(); /* Windows Media Player is evil and it makes multiple requests per song */ - if (stristr($user_agent,"NSPlayer")) { return false; } + if (stristr($user_agent,"Windows-Media-Player")) { return false; } /* Set the Expire Time */ // If they are using Windows media player - if (stristr($user_agent,"Windows-Media-Player")) { + if (stristr($user_agent,"NSPlayer")) { // WMP does keep the session open so we need to cheat a little here - $expire = $time + $song_length; - } - else { - $expire = $time; + $session_id = sql_escape($_REQUEST['sid']); } - $sql = "INSERT INTO now_playing (`song_id`, `user`, `start_time`)" . - " VALUES ('$song_id', '$uid', '$expire')"; + /* Set expire time for worst case clean up */ + $expire = $time; + + $sql = "INSERT INTO now_playing (`song_id`, `user`, `start_time`,`session`)" . + " VALUES ('$song_id', '$uid', '$expire','$session_id')"; $db_result = mysql_query($sql, dbh()); diff --git a/modules/init.php b/modules/init.php index 0fcdb977..a098d8ee 100644 --- a/modules/init.php +++ b/modules/init.php @@ -83,7 +83,7 @@ if (!$results['conf']['allow_stream_playback']) { } $results['conf']['web_path'] = $http_type . $_SERVER['HTTP_HOST'] . $results['conf']['web_path']; -$results['conf']['version'] = '3.3.2-Alpha3 Build (001)'; +$results['conf']['version'] = '3.3.2-Alpha3 Build (002)'; $results['conf']['catalog_file_pattern']= 'mp3|mpc|m4p|m4a|mp4|aac|ogg|rm|wma|asf|flac|spx'; $results['libglue']['local_table'] = 'session'; $results['libglue']['local_sid'] = 'id'; diff --git a/play/index.php b/play/index.php index 8d41c88a..4fdaec74 100644 --- a/play/index.php +++ b/play/index.php @@ -200,7 +200,6 @@ else { // Generate browser class for sending headers $browser = new Browser(); header("Accept-Ranges: bytes" ); - header("Content-Length: " . $song->size); // Prevent the script from timing out set_time_limit(0); @@ -241,7 +240,7 @@ else { } /* Set the Song as Played if it isn't already */ - $song->update_played(); + $song->set_played(); /* Delete the Now Playing Entry */ delete_now_playing($lastid); |