diff options
author | Karl 'vollmerk' Vollmer <vollmer@ampache.org> | 2006-02-19 09:00:23 +0000 |
---|---|---|
committer | Karl 'vollmerk' Vollmer <vollmer@ampache.org> | 2006-02-19 09:00:23 +0000 |
commit | 062398443b26b4f146e5d6866b452857a09759e8 (patch) | |
tree | b6dfc477c31eb39cf6e6f23582fd87826f5b68ba | |
parent | cbfb6bc3f38bae0a05f7fab5e7fe9569b9464d40 (diff) | |
download | ampache-062398443b26b4f146e5d6866b452857a09759e8.tar.gz ampache-062398443b26b4f146e5d6866b452857a09759e8.tar.bz2 ampache-062398443b26b4f146e5d6866b452857a09759e8.zip |
tweaked catalog drop down, added bandwidth throttling and fixed some spelling errors
-rw-r--r-- | config/ampache.cfg.php.dist | 46 | ||||
-rwxr-xr-x | docs/CHANGELOG | 3 | ||||
-rw-r--r-- | download/index.php | 22 | ||||
-rw-r--r-- | lib/ui.lib.php | 25 | ||||
-rw-r--r-- | modules/init.php | 7 | ||||
-rw-r--r-- | templates/sidebar.inc.php | 4 |
6 files changed, 84 insertions, 23 deletions
diff --git a/config/ampache.cfg.php.dist b/config/ampache.cfg.php.dist index db05eee9..33d61a3e 100644 --- a/config/ampache.cfg.php.dist +++ b/config/ampache.cfg.php.dist @@ -86,7 +86,7 @@ site_title = "Ampache :: For The Love Of Music" # Require Session # If this is set to true ampache will make sure that the URL passed when -# attempting to retrive a song contains a valid Session ID This prevents +# attempting to retrieve a song contains a valid Session ID This prevents # others from guessing URL's # DEFAULT: true require_session = "true" @@ -104,6 +104,14 @@ require_session = "true" # DEFAULT: false #allow_zip_download = "false" +# This setting throttles a persons downloading to the specified +# bytes per second. This is not a 100% guaranteed function, and +# you should really use a server based rate limiter if you want +# to do this correctly. +# DEFAULT: off +# VALUES: any whole number (in bytes per second) +#throttle_download = 10 + # This sets which ID3 tag takes precedence. # we've found for those of you who don't have # good v2 tags it's sometimes nice to keep the v1 @@ -162,8 +170,8 @@ use_auth = "yes" # Resize Images * Requires PHP-GD * # Set this to true if you want Ampache to resize the Album -# art on the fly, this increases load time and CPU useage -# and also requires the PHP-GD library. This is very usefull +# art on the fly, this increases load time and CPU usage +# and also requires the PHP-GD library. This is very useful # If you have high-quality album art and a small upload cap # DEFAULT: false #resize_images = "false" @@ -216,7 +224,7 @@ max_amazon_results_pages = 1 # Debug # If this is enabled Ampache will get really chatty # warning this can crash browser during catalog builds due to -# the amount of text that is dummped out this will also cause +# the amount of text that is dumped out this will also cause # ampache to write to the log file # DEFAULT: false #debug = "false" @@ -241,9 +249,9 @@ debug_level = 5 #log_path = "/tmp" # Max Upload Size -# This sets what the max filesize for an uploaded +# This sets what the max file-size for an uploaded # file, this is good at preventing someone from -# filling up your HDD. It is mesured in bytes +# filling up your HDD. It is measured in bytes # Example 1024 = 1K, 1048576 = 1MB # Default size limit is 10Mb # DEFAULT: 10485760 @@ -262,7 +270,7 @@ site_charset = iso-8859-1 # This setting turns on/off public registration. It is # recommended you leave this off, as it will allow anyone to # sign up for an account on your server. -# REMEMBER: don't forget to set the mail from address futher down in the config. +# REMEMBER: don't forget to set the mail from address further down in the config. # DEFAULT: false #allow_public_registration = "false" @@ -277,11 +285,11 @@ site_charset = iso-8859-1 # This setting defines the mail domain your in. # It tries to deliver a test mail before the user can register and uses # the from address info@"domain.tld". No mail is send from this address it's -# only used to test the existense of a mailbox before accepting user registration. +# only used to test the existence of a mailbox before accepting user registration. # DEFAULT: domain.tld #mail_domain = "domain.tld" -# This settting will be used as mail from address. +# This setting will be used as mail from address. # You need to change this when you activate public_registration. #mail_from = "info@domain.tld" @@ -302,12 +310,12 @@ site_charset = iso-8859-1 # Stream Playback # Disable this if you don't want to allow people to stream -# using HTTP without downsampling +# using HTTP without down-sampling # DEFAULT: true allow_stream_playback = true -# Downsampling Playback -# Disable this if you don't want to allow people to downsample +# Down-sampling Playback +# Disable this if you don't want to allow people to down-sample # songs before they are streamed # DEFAULT: false #allow_downsample_playback = false @@ -337,12 +345,12 @@ allow_stream_playback = true #allow_slim_playback = false ####################################################### -# These options control the dynamic downsampling based -# on current useage -# *Note* Downsampling must be enabled and working +# These options control the dynamic down-sampling based +# on current usage +# *Note* Down-sampling must be enabled and working ####################################################### -# Attempt to optimize bandwidth by dynamically downsampling +# Attempt to optimize bandwidth by dynamically down-sampling # all connections from users to fit within a maximum bandwidth. # The benefit is that it won't downsample more than it needs to. As it only # adjusts the sample rate at the beginning of a song, it may take a few @@ -353,7 +361,7 @@ allow_stream_playback = true #max_bit_rate = 576 # If min_bit_rate is set then new streams will be denied if it would -# cause all streams to be downsampled below this rate. +# cause all streams to be down-sampled below this rate. # DEFAULT: 48 #min_bit_rate = 48 @@ -376,7 +384,7 @@ search_type = fuzzy # because lame seems to strip id3 tags. if you want the Ampache default # just leave this option commented out. # -# the format supports the followning options: +# the format supports the following options: # # %A = album name # %a = artist name @@ -526,7 +534,7 @@ rss_main_language = nl # Tracklist Filename # This defines the file that the tracklist # for icecast is written to, this file must -# be writeable by the web server process +# be writable by the web server process # DEFAULT: /tmp/tracklist.txt #icecast_tracklist = "/tmp/tracklist.txt" diff --git a/docs/CHANGELOG b/docs/CHANGELOG index 0185645e..f1b8241c 100755 --- a/docs/CHANGELOG +++ b/docs/CHANGELOG @@ -4,6 +4,9 @@ -------------------------------------------------------------------------- v.3.3.2-Beta2 + - Added catalog drop down back to quick random play form + - Added bandwidth throttling to downloads, must be enabled in config + (Thx pb1dft) - Added loose name compare and rename functions to help with sorting similar artist names (Thx SpComb) - Fixed a problem with not being able to add Albums to a playlist diff --git a/download/index.php b/download/index.php index 8fe2b3b2..58b33e56 100644 --- a/download/index.php +++ b/download/index.php @@ -33,6 +33,7 @@ $browser = new Browser(); /* If we are running a demo, quick while you still can! */ if (conf('demo_mode') || !$GLOBALS['user']->has_access('25') || !$GLOBALS['user']->prefs['download']) { + debug_event('access_denied',"Download Access Denied, " . $GLOBALS['user']->username . " doesn't have sufficent rights",'3'); access_denied(); } @@ -69,13 +70,30 @@ if ($_REQUEST['action'] == 'download') { $song->format_song(); $song->format_type(); $song_name = str_replace('"'," ",$song->f_artist_full . " - " . $song->title . "." . $song->type); + + // Use Horde's Browser class to send the right headers for different browsers // Should get the mime-type from the song rather than hard-coding it. header("Content-Length: " . $song->size); $browser->downloadHeaders($song_name, $song->mime, false, $song->size); $fp = fopen($song->file, 'r'); - fpassthru($fp); + + /* We need to check and see if throttling is enabled */ + $speed = intval(conf('throttle_download')); + if ($speed > 0) { + while(!feof($fp)) { + echo fread($fp, round($speed*1024)); + flush(); + sleep(1); + } + } // if limiting + /* Otherwise just pump it out as fast as you can */ + else { + fpassthru($fp); + } // else no limit + fclose($fp); -} + +} // If they've requested a download ?> diff --git a/lib/ui.lib.php b/lib/ui.lib.php index 128ba533..cd82cfc7 100644 --- a/lib/ui.lib.php +++ b/lib/ui.lib.php @@ -1294,4 +1294,29 @@ function show_genre_select($name='genre',$genre_id=0) { } // show_genre_select +/** + * show_catalog_select + * Yet another one of these buggers. this shows a drop down of all of your catalogs + */ +function show_catalog_select($name='catalog',$catalog_id=0,$style='') { + + echo "<select name=\"$name\" style=\"$style\">\n"; + + $sql = "SELECT id, name FROM catalog ORDER BY name"; + $db_results = mysql_query($sql, dbh()); + + while ($r = mysql_fetch_assoc($db_results)) { + $selected = ''; + if ($r['id'] == $catalog_id) { + $selected = "selected=\"selected\""; + } + + echo "\t<option value=\"" . $r['id'] . "\" $selected>" . scrub_out($r['name']) . "</option>\n"; + + } // end while + + echo "</select>\n"; + +} // show_catalog_select + ?> diff --git a/modules/init.php b/modules/init.php index 0a98921a..b4ccffa9 100644 --- a/modules/init.php +++ b/modules/init.php @@ -78,9 +78,14 @@ if (!$results['allow_stream_playback']) { $results['allow_stream_playback'] = "true"; } + +/** This is the version.... fluf nothing more... **/ +$results['version'] = '3.3.2-Beta2 (Build 007)'; + + + $results['raw_web_path'] = $results['web_path']; $results['web_path'] = $http_type . $_SERVER['HTTP_HOST'] . $results['web_path']; -$results['version'] = '3.3.2-Beta2 (Build 006)'; $results['catalog_file_pattern']= 'mp3|mpc|m4p|m4a|mp4|aac|ogg|rm|wma|asf|flac|spx|ra'; $results['http_port'] = $_SERVER['SERVER_PORT']; if (!$results['prefix']) { diff --git a/templates/sidebar.inc.php b/templates/sidebar.inc.php index b939c7eb..0564ca04 100644 --- a/templates/sidebar.inc.php +++ b/templates/sidebar.inc.php @@ -151,7 +151,7 @@ $web_path = conf('web_path'); <input type="hidden" name="action" value="m3u" /> <select name="random" style="width:9em;"> <option value="1">1</option> - <option value="5">5</option> + <option value="5" selected="selected">5</option> <option value="10">10</option> <option value="20">20</option> <option value="30">30</option> @@ -171,6 +171,8 @@ $web_path = conf('web_path'); <option value="Less Played"><?php echo _("Less Played"); ?></option> </select> <br /> + <?php show_catalog_select('catalog','','width:9em;'); ?> + <br /> <input type="hidden" name="aaction" value="Play!" /> <input class="smallbutton" type="submit" name="aaction" value="<?php echo _("Enqueue"); ?>" /> </form> |