diff options
author | Karl 'vollmerk' Vollmer <vollmer@ampache.org> | 2006-04-06 06:16:02 +0000 |
---|---|---|
committer | Karl 'vollmerk' Vollmer <vollmer@ampache.org> | 2006-04-06 06:16:02 +0000 |
commit | 065e228c184aa3043dbb93c701d8c2a8cfb05b1e (patch) | |
tree | e827b0a4edb07957a8a0b80edfe5edccb698f6e5 /lib | |
parent | 3b0791a0e038937b6d1dab49e6599aff5f48a4ab (diff) | |
download | ampache-065e228c184aa3043dbb93c701d8c2a8cfb05b1e.tar.gz ampache-065e228c184aa3043dbb93c701d8c2a8cfb05b1e.tar.bz2 ampache-065e228c184aa3043dbb93c701d8c2a8cfb05b1e.zip |
added a new function to song and added a untested mpd controller
Diffstat (limited to 'lib')
-rw-r--r-- | lib/class/localplay.class.php | 22 | ||||
-rw-r--r-- | lib/class/song.class.php | 29 |
2 files changed, 50 insertions, 1 deletions
diff --git a/lib/class/localplay.class.php b/lib/class/localplay.class.php index 4c96f559..9e9cabaf 100644 --- a/lib/class/localplay.class.php +++ b/lib/class/localplay.class.php @@ -65,6 +65,28 @@ class Localplay { /** + * _load_player + * This function attempts to load the player class that localplay + * Will interface with in order to make all this magical stuf work + * all LocalPlay modules should be located in /modules/<name>/<name>.class.php + */ + function _load_player() { + + $filename = conf('prefix') . '/modules/localplay/' . $this->type . '.controller.php'; + $include = require_once ($filename); + + if (!$include) { + /* Throw Error Here */ + + } // include + else { + $class_name = $this->type; + $this->_player = new $class_name(); + } + + } // _load_player + + /** * has_function * This is used to check the function map and see if the current * player type supports the indicated function. diff --git a/lib/class/song.class.php b/lib/class/song.class.php index d0868de2..ddaa96e7 100644 --- a/lib/class/song.class.php +++ b/lib/class/song.class.php @@ -697,7 +697,34 @@ class Song { return stripslashes($matches[1]); } // get_info_from_filename - + + /** + * 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_ + */ + function get_url() { + + /* Define Variables we are going to need */ + $username = $GLOBALS['user']->username; + $song_id = $this->id; + $session = session_id(); + $type = $this->type; + + if ($GLOBALS['user']->prefs['play_type'] == 'downsample') { + $ds_string = "&ds=" . $GLOBALS['user']->prefs['sample_rate']; + } + + /* Account for retarded players */ + if ($song->type == 'flac') { $type = 'ogg'; } + + $url = conf('web_path') . "/play/index.php?song=$song_id&uid=$username&sid=$session$ds_string&name=$type"; + + return $url; + + } // get_url + /*! @function native_stream @discussion returns true if the $song->type streams ok, false if it must be transcoded to stream |