diff --git a/lib/class/plugin.class.php b/lib/class/plugin.class.php index f536cf99..43e473f7 100644 --- a/lib/class/plugin.class.php +++ b/lib/class/plugin.class.php @@ -73,7 +73,12 @@ class Plugin */ public static function get_plugins($type='') { - $results = array(); + // make static cache for optimization when multiple call + static $plugins_list; + if (!is_null($plugins_list)) + return $plugins_list; + + $plugins_list = array(); // Open up the plugin dir $handle = opendir(AmpConfig::get('prefix') . '/modules/plugins'); @@ -104,13 +109,13 @@ class Plugin } } // It's a plugin record it - $results[$plugin_name] = $plugin_name; + $plugins_list[$plugin_name] = $plugin_name; } // end while // Little stupid but hey - ksort($results); + ksort($plugins_list); - return $results; + return $plugins_list; } // get_plugins diff --git a/lib/class/upnp_api.class.php b/lib/class/upnp_api.class.php index ff1196b2..e7b31bf3 100644 --- a/lib/class/upnp_api.class.php +++ b/lib/class/upnp_api.class.php @@ -172,8 +172,19 @@ class Upnp_Api return $xmlDoc; } + # sometimes here comes only one single item, not an array. Convert it to array. (TODO - UGLY) + if ( (count($prmItems) > 0) && (!is_array($prmItems[0])) ) { + $prmItems = array($prmItems); + } + # Add each item in $prmItems array to $ndDIDL: foreach ($prmItems as $item) { + if (!is_array($item)) { + debug_event('upnp_class', 'item is not array', 2); + debug_event('upnp_class', $item, '5'); + continue; + } + if ($item['upnp:class'] == 'object.container') { $ndItem = $xmlDoc->createElement('container'); } else { diff --git a/upnp/MediaServerServiceDesc.php b/upnp/MediaServerServiceDesc.php index 50e811fa..abd8dde3 100644 --- a/upnp/MediaServerServiceDesc.php +++ b/upnp/MediaServerServiceDesc.php @@ -8,9 +8,10 @@ if (!AmpConfig::get('upnp_backend')) { } header ("Content-Type:text/xml"); -$web_path = AmpConfig::get('raw_web_path'); +$web_path = AmpConfig::get('local_web_path'); + +echo ''; ?> - 1 diff --git a/upnp/index.php b/upnp/index.php index bdc98ffd..19675955 100644 --- a/upnp/index.php +++ b/upnp/index.php @@ -1,7 +1,25 @@ + +'; + } +?> Ampache UPnP