Ticket #297 (closed feature: invalid)
Allowing direct file access for mpd
| Reported by: | manski | Owned by: | vollmerk |
|---|---|---|---|
| Priority: | major | Milestone: | 3.4.x Stable Release |
| Component: | Streaming / Playback | Version: | 3.4.x |
| Keywords: | Cc: |
Description
On my installation "Ampache" and "mpd" are running on the same machine. So it would be nice to have a way to pass the local file paths of audio files to mpd (rather than a "play" URL); especially when Ampache is accessible from the internet. (In this the files are streamed from the local server to the internet and then back to the local machine; which might unnecessarily eat up bandwidth.)
One way to do this would be a new configuration variable (mpd_access) that controls the kind of path that is passed to mpd. The following code has to be inserted into the class AmpacheMpd (the ampache mpd controller):
/**
* get_url
* This returns the URL for the passed object
*/
public function get_url($object) {
// This might not be an object!
if (!is_object($object)) {
// Stupiidly we'll just blindly add it for now
return $object;
}
$url = null;
// This can get a little complicated
if (is_a($object, 'Random')) {
// Do nothing
} else if (is_a($object, 'Song') && Config::get('mpd_access') == 'local') {
$url = $object->get_rel_path();
} else {
$url = $object->get_url(Stream::get_session());
}
return $url;
} // get_url
(Cross reference: ticket #294)
This solution is not very sophisticated, I know. A better way would be to allow the user to define this configuration variable seperate on each catalog.
