Changeset 1728
- Timestamp:
- 08/31/08 08:39:40 (3 months ago)
- Location:
- trunk
- Files:
-
- 2 modified
-
lib/class/localplay.abstract.php (modified) (1 diff)
-
modules/localplay/mpd.controller.php (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/lib/class/localplay.abstract.php
r1545 r1728 89 89 * parse_url 90 90 * This takes an Ampache URL and then returns the 'primary' part of it 91 * So that it's easier for localplay module sto return valid song information91 * So that it's easier for localplay modules to return valid song information 92 92 */ 93 93 public function parse_url($url) { 94 94 95 95 // Define possible 'primary' keys 96 $primary_array = array('song','demo_id' );96 $primary_array = array('song','demo_id','random'); 97 97 98 98 // Delete everything before the first ? 99 99 $file = preg_replace("/.*\?(.+)/",'$1',$url); 100 100 101 // Split on & symbol 102 $data = explode("&",$file); 101 $variables = parse_url($url,PHP_URL_QUERY); 102 parse_str($variables,$data); 103 103 104 foreach ($data as $pair) { 105 $elements = explode("=",$pair); 106 $key = $elements['0']; 107 $value = $elements['1']; 108 $results[$key] = $value; 109 110 if (in_array($key,$primary_array)) { 111 $primary = $key; 112 } 104 foreach ($primary_array as $pkey) { 105 if ($data[$pkey]) { 106 $data['primary_key'] = $pkey; 107 return $data; 108 } 113 109 114 110 } // end foreach 115 111 116 $results['primary_key'] = $primary; 117 118 return $results; 112 return $data; 119 113 120 114 } // parse_url -
trunk/modules/localplay/mpd.controller.php
r1560 r1728 493 493 $data['link'] = ''; 494 494 break; 495 case 'random': 496 $data['name'] = _('Random') . ' - ' . scrub_out(ucfirst($url_data['type'])); 497 $data['link'] = ''; 498 break; 495 499 default: 496 500
