diff options
author | Karl 'vollmerk' Vollmer <vollmer@ampache.org> | 2005-07-16 00:32:51 +0000 |
---|---|---|
committer | Karl 'vollmerk' Vollmer <vollmer@ampache.org> | 2005-07-16 00:32:51 +0000 |
commit | c024808430c781b03dab0e9b49016ac4cb868fb1 (patch) | |
tree | 82f51c7f368d238fb5fafe46f05da2f19ddfd73d | |
parent | 9d627a263af982108710fa68c2182ef4c897a506 (diff) | |
download | ampache-c024808430c781b03dab0e9b49016ac4cb868fb1.tar.gz ampache-c024808430c781b03dab0e9b49016ac4cb868fb1.tar.bz2 ampache-c024808430c781b03dab0e9b49016ac4cb868fb1.zip |
fix logic problem that would snafu the headers if we were trying to upsample
-rw-r--r-- | lib/stream.lib.php | 4 | ||||
-rw-r--r-- | templates/show_mpdpl.inc | 11 |
2 files changed, 3 insertions, 12 deletions
diff --git a/lib/stream.lib.php b/lib/stream.lib.php index a022b6da..b792225f 100644 --- a/lib/stream.lib.php +++ b/lib/stream.lib.php @@ -207,12 +207,14 @@ function start_downsample($song,$now_playing_id=0,$song_name=0) { $sample_rate = $user_sample_rate; } + $sample_ratio = $sample_rate/($song->bitrate/1000); + /* Never Upsample a song */ if (($sample_rate*1000) > $song->bitrate) { unset($sample_rate); + $sample_ratio = '1'; } - $sample_ratio = $sample_rate/($song->bitrate/1000); $browser->downloadHeaders($song_name, $song->mime, false,$sample_ratio*$song->size); diff --git a/templates/show_mpdpl.inc b/templates/show_mpdpl.inc index 5648b444..b87bb396 100644 --- a/templates/show_mpdpl.inc +++ b/templates/show_mpdpl.inc @@ -21,10 +21,6 @@ */ $web_path = conf('web_path'); /* -Instructions on incorporating this code: -1) You need to add a row with a name of 'condPL' into the table preferences. Initial value is 1 (condensed playlist by default) -or 0 (not condensed by default). -2) Insert the following function at the end of /mpd.php and change show_mpd_control() above it to "require" (instead of require_once): TTD: - It would be nice if flagged songs showed up in a flagged color (e.g. red). @@ -34,13 +30,6 @@ TTD: */ -/* The following mpd init code is from amp-mpd.php and should probably go into a mpdinit file that gets executed by initmpd -since other pages or items on index.php that come before this (like an MPD control in the header!) might need myMpd. -*/ - - -if (!class_exists('mpd')) { require_once(conf('prefix')."/modules/mpd/mpd.class.php"); } -if (!is_object($myMpd)) { $myMpd = new mpd(conf('mpd_host'),conf('mpd_port')); } if (!$myMpd->connected) { echo "<font class=\"error\">" . _("Error Connecting") . ": " . $myMpd->errStr . "</font><br />\n"; |