diff options
author | Karl 'vollmerk' Vollmer <vollmer@ampache.org> | 2009-02-28 18:13:48 +0000 |
---|---|---|
committer | Karl 'vollmerk' Vollmer <vollmer@ampache.org> | 2009-02-28 18:13:48 +0000 |
commit | dbdd96ed1b3b00a850be001f3dbeea3273739a98 (patch) | |
tree | ccd23afffb6a4c2dc185bd6ffc39e13435fc1179 /lib/class/song.class.php | |
parent | 3a3e0c6a9f72d5031a4025dedcf2360c497c4953 (diff) | |
download | ampache-dbdd96ed1b3b00a850be001f3dbeea3273739a98.tar.gz ampache-dbdd96ed1b3b00a850be001f3dbeea3273739a98.tar.bz2 ampache-dbdd96ed1b3b00a850be001f3dbeea3273739a98.zip |
unify how the stream is constructed and played, this is a major change might be some regressions
Diffstat (limited to 'lib/class/song.class.php')
-rw-r--r-- | lib/class/song.class.php | 52 |
1 files changed, 10 insertions, 42 deletions
diff --git a/lib/class/song.class.php b/lib/class/song.class.php index 536a76b2..3e1a124c 100644 --- a/lib/class/song.class.php +++ b/lib/class/song.class.php @@ -853,57 +853,25 @@ class Song extends database_object implements media { * a stream URL taking into account the downsmapling mojo and everything * else, this is the true function */ - public static function play_url($oid,$session_id='',$force_http='') { + public static function play_url($oid) { - - } // play_url - - /** - * get_url - * This function takes all the song information and correctly formats - * a stream URL taking into account the downsampling mojo and everything - * else, this is used or will be used by _EVERYTHING_ - */ - public function get_url($session_id='',$force_http='') { - - /* Define Variables we are going to need */ + $song = new Song($oid); $user_id = $GLOBALS['user']->id ? scrub_out($GLOBALS['user']->id) : '-1'; - $song_id = $this->id; + $type = $song->type; - if (Config::get('require_session')) { - if ($session_id) { - $session_string = "&sid=" . $session_id; - } - else { - $session_string = "&sid=" . Stream::get_session(); - } - } // if they are requiring a session - - $type = $this->type; + // Required for some versions of winamp that won't work if the stream doesn't end in + // .ogg This will not break any properly working player, don't report this as a bug! + if ($song->type == 'flac') { $type = 'ogg'; } - /* Account for retarded players */ - if ($this->type == 'flac') { $type = 'ogg'; } - - // Only reformat if we need to - if (!isset($this->f_title)) { - $this->format(); - } + $song->format(); - $song_name = rawurlencode($this->f_artist_full . " - " . $this->title . "." . $type); + $song_name = rawurlencode($song->f_artist_full . " - " . $song->title . "." . $type); - $web_path = Config::get('web_path'); - - //FIXME: REPLACE WITH Stream::get_base_url - if (Config::get('force_http_play') OR !empty($force_http)) { - $port = Config::get('http_port') ? ':' . Config::get('http_port') : ''; - $web_path = str_replace("https://" . $_SERVER['HTTP_HOST'], "http://" . $_SERVER['SERVER_NAME'] . $port,$web_path); - } - - $url = $web_path . "/play/index.php?oid=$song_id&uid=$user_id$session_string$ds_string&name=/$song_name"; + $url = Stream::get_base_url() . "/play/index.php?oid=$song_id&uid=$user_id$session_string$ds_string&name=/$song_name"; return $url; - } // get_url + } // play_url /** * parse_song_url |