diff options
author | Karl 'vollmerk' Vollmer <vollmer@ampache.org> | 2005-07-15 06:50:58 +0000 |
---|---|---|
committer | Karl 'vollmerk' Vollmer <vollmer@ampache.org> | 2005-07-15 06:50:58 +0000 |
commit | 0a3df5cbcfc10a0f18e9da311d887eb00fd6fbf1 (patch) | |
tree | 9774ec6174a3bcdf16a7e800aed718c7d4aefdaa /lib/general.lib.php | |
parent | 51b625a4463ab90f14cc85e589867903026e78ec (diff) | |
download | ampache-0a3df5cbcfc10a0f18e9da311d887eb00fd6fbf1.tar.gz ampache-0a3df5cbcfc10a0f18e9da311d887eb00fd6fbf1.tar.bz2 ampache-0a3df5cbcfc10a0f18e9da311d887eb00fd6fbf1.zip |
added on the fly bandwidth management for downsampled users
Diffstat (limited to 'lib/general.lib.php')
-rw-r--r-- | lib/general.lib.php | 79 |
1 files changed, 0 insertions, 79 deletions
diff --git a/lib/general.lib.php b/lib/general.lib.php index 297ac667..16d0ac11 100644 --- a/lib/general.lib.php +++ b/lib/general.lib.php @@ -743,83 +743,4 @@ function tbl_name($table) { } // tbl_name -/** - * insert_now_playing - * This function takes care of inserting the now playing data - * we use this function because we need to do thing differently - * depending upon which play is actually streaming - * @package General - * @catagory Now Playing - */ -function insert_now_playing($song_id,$uid,$song_length) { - - $user_agent = $_SERVER['HTTP_USER_AGENT']; - $time = time(); - - /* Windows Media Player is evil and it makes multiple requests per song */ - if (stristr($user_agent,"NSPlayer")) { return false; } - - /* Set the Expire Time */ - - // If they are using Windows media player - if (stristr($user_agent,"Windows-Media-Player")) { - // WMP does keep the session open so we need to cheat a little here - $expire = $time + $song_length; - } - else { - $expire = $time; - } - - $sql = "INSERT INTO now_playing (`song_id`, `user`, `start_time`)" . - " VALUES ('$song_id', '$uid', '$expire')"; - - $db_result = mysql_query($sql, dbh()); - - $insert_id = mysql_insert_id(dbh()); - - return $insert_id; - -} // insert_now_playing - -/** - * delete_now_playing - * This function checks to see if we should delete the last now playing entry now that it's - * finished streaming the song. Basicly this is an exception for WMP10 - * @package General - * @catagory Now Playing - */ -function delete_now_playing($insert_id) { - - $user_agent = $_SERVER['HTTP_USER_AGENT']; - - if (stristr($user_agent,"Windows-Media-Player")) { - // Commented out until I can figure out the - // trick to making this work - //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()); - -} // delete_now_playing - -/** - * gc_now_playing - * this is a garbage collection function for now playing this is called every time something - * is streamed - * @package General - * @catagory Now Playing - */ -function gc_now_playing() { - - $time = time(); - $expire = $time - 1800; // 86400 seconds = 1 day - - $sql = "DELETE FROM now_playing WHERE start_time < $expire"; - $db_result = mysql_query($sql, dbh()); - -} // gc_now_playing - ?> |