diff --git a/docs/CHANGELOG b/docs/CHANGELOG index 1f8e39d8..17625f55 100755 --- a/docs/CHANGELOG +++ b/docs/CHANGELOG @@ -4,6 +4,9 @@ -------------------------------------------------------------------------- v.3.3.3-Alpha2 + - Fixed a problem were invalid bitrates below the set downsample + bitrate could cause lame to crash as they weren't + validated. - Added XSPF Flash player, rough around the edges but it works (Thx pb1dft/GrinningArmor) - Fixed bug with Album --> Artist sorting, wasn't allowing you to diff --git a/lib/init.php b/lib/init.php index ae4cabbd..d54706b7 100644 --- a/lib/init.php +++ b/lib/init.php @@ -73,7 +73,7 @@ if (!$results = read_config($configfile,0)) { } /** This is the version.... fluf nothing more... **/ -$results['version'] = '3.3.3-Alpha2 Build (001)'; +$results['version'] = '3.3.3-Alpha2 Build (002)'; $results['raw_web_path'] = $results['web_path']; $results['web_path'] = $http_type . $_SERVER['HTTP_HOST'] . $results['web_path']; diff --git a/lib/preferences.php b/lib/preferences.php index 0022911b..d3c8ce63 100644 --- a/lib/preferences.php +++ b/lib/preferences.php @@ -265,6 +265,7 @@ function create_preference_input($name,$value) { if ($value == 'downsample') { $is_down = 'selected="selected"'; } elseif ($value == 'localplay') { $is_local = 'selected="selected"'; } elseif ($value == 'democratic') { $is_vote = 'selected="selected"'; } + elseif ($value == 'xspf_player') { $is_xspf_player = 'selected="selected"'; } else { $is_stream = "selected=\"selected\""; } echo "\n"; break; case 'playlist_type': @@ -292,7 +294,6 @@ function create_preference_input($name,$value) { echo "\t\n"; echo "\t\n"; echo "\t\n"; - echo "\t\n"; echo "\n"; break; case 'lang': diff --git a/lib/stream.lib.php b/lib/stream.lib.php index bc30d7cb..bd306c48 100644 --- a/lib/stream.lib.php +++ b/lib/stream.lib.php @@ -160,21 +160,6 @@ function start_downsample($song,$now_playing_id=0,$song_name=0) { if ($max_bitrate > 1 AND $min_bitrate < $max_bitrate) { $last_seen_time = $time - 1200; //20 min. - /********************************** - * Commenting out the following, I'd rather have it slightly less accurate and avoid a 4 table join - // Count the users connected in the last 20 min using downsampling - $sql = "SELECT COUNT(DISTINCT session.username) FROM session,user,user_preference,preferences " . - "WHERE user.username = session.username AND session.expire > '$time' AND user.last_seen > $last_seen_time " . - "AND preferences.name = 'play_type' AND user_preference.preference = preferences.id AND " . - "user_preference.user = user.username AND user_preference.value='downsample'"; - $db_result = mysql_query($sql, $dbh); - $results = mysql_fetch_row($db_result); - - // The current number of connected users - $current_users_count = $results[0]; - ************************************/ - - $sql = "SELECT COUNT(*) FROM now_playing, user_preference, preferences " . "WHERE preferences.name = 'play_type' AND user_preference.preference = preferences.id " . "AND now_playing.user = user_preference.user AND user_preference.value='downsample'"; @@ -220,7 +205,7 @@ function start_downsample($song,$now_playing_id=0,$song_name=0) { /* Never Upsample a song */ if (($sample_rate*1000) > $song->bitrate) { - $sample_rate = $song->bitrate/1000; + $sample_rate = validate_bitrate($song->bitrate)/1000; $sample_ratio = '1'; } else { diff --git a/song.php b/song.php index 515392d3..491e9fec 100644 --- a/song.php +++ b/song.php @@ -129,8 +129,15 @@ switch ($method) { default: $stream_type = conf('playlist_type'); - if ($GLOBALS['user']->prefs['play_type'] != "stream" AND $GLOBALS['user']->prefs['play_type'] != "downsample") { - $stream_type = $GLOBALS['user']->prefs['play_type']; + /* For non-stream/downsample methos we need to so something else */ + switch ($GLOBALS['user']->prefs['play_type']) { + case 'stream': + case 'downsample': + // Rien a faire + break; + default: + $stream_type = $GLOBALS['user']->prefs['play_type']; + break; } /* Start the Stream */