diff options
author | Karl 'vollmerk' Vollmer <vollmer@ampache.org> | 2007-07-30 04:56:20 +0000 |
---|---|---|
committer | Karl 'vollmerk' Vollmer <vollmer@ampache.org> | 2007-07-30 04:56:20 +0000 |
commit | ff218616983683ccbe6623d0e66c248e94c0ea99 (patch) | |
tree | 5c177e2dcfda835e3805f1beab158697d08d0e0f /lib/stream.lib.php | |
parent | 4fc1bffcde95ab4e2d91402771e87cd39b5d1ccb (diff) | |
download | ampache-ff218616983683ccbe6623d0e66c248e94c0ea99.tar.gz ampache-ff218616983683ccbe6623d0e66c248e94c0ea99.tar.bz2 ampache-ff218616983683ccbe6623d0e66c248e94c0ea99.zip |
fixed now playing with audacious, and fixed clear now playing.. vollmer is fired
Diffstat (limited to 'lib/stream.lib.php')
-rw-r--r-- | lib/stream.lib.php | 30 |
1 files changed, 27 insertions, 3 deletions
diff --git a/lib/stream.lib.php b/lib/stream.lib.php index 9b9b19c1..00416a7d 100644 --- a/lib/stream.lib.php +++ b/lib/stream.lib.php @@ -79,8 +79,20 @@ function insert_now_playing($song_id,$uid,$song_length) { $time = time()+$song_length; $session_id = Dba::escape($_REQUEST['sid']); + /* Check for against a list of clients that have abusive traffic patterns causing + * faulty now playing data and return without inserting + */ + $banned_clients = array('Audacious/1.3'); + + foreach ($banned_clients as $banned_agent) { + if (stristr($user_agent,$banned_agent)) { + debug_event('Banned Agent',$banned_agent . ' clients now playing data not entered because Ampache is unable to handle its request pattern','5'); + return false; + } + } + /* Windows Media Player is evil and it makes multiple requests per song */ - if (stristr($user_agent,"Windows-Media-Player") || strstr($user_agent,"Audacious")) { $session_id = ' '; } + if (stristr($user_agent,"Windows-Media-Player")) { $session_id = ' '; } /* Check for Windows Media Player 11 */ if (strstr($user_agent,'NSPlayer/11') AND !strstr($user_agent,'WMFSDK/11')) { $session_id = ' '; } @@ -100,11 +112,23 @@ function insert_now_playing($song_id,$uid,$song_length) { } // insert_now_playing /** + * clear_now_playing + * There really isn't anywhere else for this function, shouldn't have deleted it in the first + * place + */ +function clear_now_playing() { + + $sql = "TRUNCATE `now_playing`"; + $db_results = Dba::query($sql); + + return true; + +} // clear_now_playing + +/** * check_lock_songs * This checks to see if the song is already playing, if it is then it prevents the user * from streaming it - * @package General - * @catagory Security */ function check_lock_songs($song_id) { |