diff options
author | Karl 'vollmerk' Vollmer <vollmer@ampache.org> | 2007-12-08 10:02:26 +0000 |
---|---|---|
committer | Karl 'vollmerk' Vollmer <vollmer@ampache.org> | 2007-12-08 10:02:26 +0000 |
commit | 883adcd52b1f4cb4afe4ff5062d1bb83218840ff (patch) | |
tree | 61eeae6bc00f3c6e2c3e489f62afbdabb8f2da09 /lib/class/localplay.abstract.php | |
parent | 22beb1a65d65c9c61fb5d7e181df681fb1a8849e (diff) | |
download | ampache-883adcd52b1f4cb4afe4ff5062d1bb83218840ff.tar.gz ampache-883adcd52b1f4cb4afe4ff5062d1bb83218840ff.tar.bz2 ampache-883adcd52b1f4cb4afe4ff5062d1bb83218840ff.zip |
untested HTTPQ code, improved MPD parsing of URLS so it reconizes democratic play stuff now
Diffstat (limited to 'lib/class/localplay.abstract.php')
-rw-r--r-- | lib/class/localplay.abstract.php | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/lib/class/localplay.abstract.php b/lib/class/localplay.abstract.php index 144c1918..36901a67 100644 --- a/lib/class/localplay.abstract.php +++ b/lib/class/localplay.abstract.php @@ -84,4 +84,38 @@ abstract class localplay_controller { } // get_file + /** + * parse_url + * This takes an Ampache URL and then returns the 'primary' part of it + * So that it's easier for localplay module sto return valid song information + */ + public function parse_url($url) { + + // Define possible 'primary' keys + $primary_array = array('song','demo_id'); + + // Delete everything before the first ? + $file = preg_replace("/.*\?(.+)/",'$1',$url); + + // Split on & symbol + $data = explode("&",$file); + + foreach ($data as $pair) { + $elements = explode("=",$pair); + $key = $elements['0']; + $value = $elements['1']; + $results[$key] = $value; + + if (in_array($key,$primary_array)) { + $primary = $key; + } + + } // end foreach + + $results['primary_key'] = $primary; + + return $results; + + } // parse_url + } // end localplay_controller interface |