diff --git a/RaiReplay/RaiReplay.php b/RaiReplay/RaiReplay.php
index e4c4b64..e89bf91 100644
--- a/RaiReplay/RaiReplay.php
+++ b/RaiReplay/RaiReplay.php
@@ -2,91 +2,82 @@
include_once '/usr/share/umsp/funcs-log.php';
global $logLevel;
global $logIdent;
-$logLevel = L_ALL;
+$logLevel = L_INFO;
$logIdent = 'RaiReplayPlugIn';
-$f = file_get_contents("http://nixxo.altervista.org/umsp-plugins/rai_url_extractor.php");
-file_put_contents("/tmp/RaiReplay-temp.php", " $f, 'args' => $args), '', '&');
+function _pluginMain($prmQuery)
+{
+ _logDebug("plugin start");
+ if (strpos($prmQuery, '&') !== false) {
+ $prmQuery = str_replace('&', '&', $prmQuery);
+ }
+ parse_str($prmQuery, $params);
+ if (isset($params['f']) && function_exists($params['f'])) {
+ if (isset($params['args'])) {
+ return call_user_func_array($params['f'], $params['args']);
+ } else {
+ return call_user_func($params['f']);
+ }
+ }
+ return rai_main_menu();
}
-function build_umsp_url($f, $args = array()) {
- return 'umsp://plugins/' . basename(dirname(__FILE__)) . '/' . basename(__FILE__, '.php') . '?' . build_query($f, $args);
+function build_query($f, $args = array())
+{
+ return http_build_query(array('f' => $f, 'args' => $args), '', '&');
}
-function build_server_url($args) {
- return 'http://' . $_SERVER['HTTP_HOST'] . '/umsp/plugins/' . basename(dirname(__FILE__)) . '/' . basename(__FILE__) . '?' . http_build_query($args);
+function build_umsp_url($f, $args = array())
+{
+ return 'umsp://plugins/' . basename(dirname(__FILE__)) . '/' . basename(__FILE__, '.php') . '?' . build_query($f, $args);
}
-function create_item($title, $thumb, $sortBy, $category = null, $genre = null, $platform = null) {
- return array(
- 'id' => build_umsp_url('videos', array($sortBy, $category, $genre, $platform)),
- 'dc:title' => $title,
- 'upnp:album_art' => $thumb,
- 'upnp:class' => 'object.container',
- );
+function build_server_url($args)
+{
+ return 'http://' . $_SERVER['HTTP_HOST'] . '/umsp/plugins/' . basename(dirname(__FILE__)) . '/' . basename(__FILE__) . '?' . http_build_query($args);
}
-function createPlayItem($res, $title, $desc, $album_art, $class, $protocolInfo) {
- return array(
- 'id' => build_umsp_url('play', array($res, $title, $desc, $album_art, $class, $protocolInfo)),
- 'res' => $res,
- 'dc:title' => $title,
- 'desc' => $desc,
- 'upnp:album_art' => $album_art,
- 'upnp:class' => $class,
- 'protocolInfo' => $protocolInfo,
- );
+function create_item($title, $thumb, $sortBy, $category = null, $genre = null, $platform = null)
+{
+ return array(
+ 'id' => build_umsp_url('videos', array($sortBy, $category, $genre, $platform)),
+ 'dc:title' => $title,
+ 'upnp:album_art' => $thumb,
+ 'upnp:class' => 'object.container',
+ );
}
-function getConfigValue($key, $default_value) {
- $conf_dir = function_exists('_getUMSPConfPath') ? _getUMSPConfPath() : '/conf';
- $config = file_get_contents($conf_dir . '/config');
- if (preg_match("/RAIREPLAY_$key='(.+)'/", $config, $matches)) {
- return trim($matches[1]);
- }
- return $default_value;
+function createPlayItem($res, $title, $desc, $album_art, $class, $protocolInfo)
+{
+ return array(
+ 'id' => build_umsp_url('play', array($res, $title, $desc, $album_art, $class, $protocolInfo)),
+ 'res' => $res,
+ 'dc:title' => $title,
+ 'desc' => $desc,
+ 'upnp:album_art' => $album_art,
+ 'upnp:class' => $class,
+ 'protocolInfo' => $protocolInfo,
+ );
}
-function putConfigValue($key, $value) {
- exec("sudo config_tool -c RAIREPLAY_$key='$value' >/dev/null 2>&1");
+function getConfigValue($key, $default_value)
+{
+ $conf_dir = function_exists('_getUMSPConfPath') ? _getUMSPConfPath() : '/conf';
+ $config = file_get_contents($conf_dir . '/config');
+ if (preg_match("/RAIREPLAY_$key='(.+)'/", $config, $matches)) {
+ return trim($matches[1]);
+ }
+ return $default_value;
}
-if (isset($_GET['video'])) {
- _logDebug("video: " . $_GET['video']);
- $url = '';
- $ids = explode('@', $_GET['video']);
-
- foreach ($ids as $id) {
- $url = rai_getLink($id);
- if ($url) {
- break;
- }
- }
-
- _logDebug('playing: ' . $url);
- ob_start();
- header('Location: ' . $url);
- ob_flush();
- exit();
+function putConfigValue($key, $value)
+{
+ exec("sudo config_tool -c RAIREPLAY_$key='$value' >/dev/null 2>&1");
}
-?>
\ No newline at end of file
diff --git a/RaiReplay/RaiReplay_wec.php b/RaiReplay/RaiReplay_wec.php
index bdb154a..42f7abd 100644
--- a/RaiReplay/RaiReplay_wec.php
+++ b/RaiReplay/RaiReplay_wec.php
@@ -4,70 +4,67 @@
// Does this WEC version support custom hooks?
if ((defined('WECVERSION')) && (WECVERSION >= 3)) {
+ include_once $_SERVER['DOCUMENT_ROOT'] . '/umsp/funcs-config.php';
+ // Insert badge if we have one
+ if ((isset($pluginInfo['thumb'])) && ($pluginInfo['thumb'] != '')) {
+ $desc = '
'
+ . '' . $pluginInfo['name'] . " v" . $pluginInfo['version'] . " (" . $pluginInfo['date'] . ") by "
+ . $pluginInfo['author'] . ".
" . $pluginInfo['desc'] . "
Information:
" . $pluginInfo['url'] . ""
+ . '
';
+ } elseif ((isset($pluginInfo['art'])) && ($pluginInfo['art'] != '')) {
+ $desc = ''
+ . '' . $pluginInfo['name'] . " v" . $pluginInfo['version'] . " (" . $pluginInfo['date'] . ") by "
+ . $pluginInfo['author'] . ".
" . $pluginInfo['desc'] . "
Information:
" . $pluginInfo['url'] . ""
+ . '
';
+ } else {
+ $desc = $pluginInfo['name'] . ' v' . $pluginInfo['version'] . ' (' . $pluginInfo['date'] . ') by '
+ . $pluginInfo['author'] . '.
' . $pluginInfo['desc'] . "
Information: " . $pluginInfo['url'] . '';
+ }
- include_once $_SERVER['DOCUMENT_ROOT'] . '/umsp/funcs-config.php';
- // Insert badge if we have one
- if ((isset($pluginInfo['thumb'])) && ($pluginInfo['thumb'] != '')) {
- $desc = ''
- . '' . $pluginInfo['name'] . " v" . $pluginInfo['version'] . " (" . $pluginInfo['date'] . ") by "
- . $pluginInfo['author'] . ".
" . $pluginInfo['desc'] . "
Information:
" . $pluginInfo['url'] . ""
- . '
';
- } elseif ((isset($pluginInfo['art'])) && ($pluginInfo['art'] != '')) {
- $desc = ''
- . '' . $pluginInfo['name'] . " v" . $pluginInfo['version'] . " (" . $pluginInfo['date'] . ") by "
- . $pluginInfo['author'] . ".
" . $pluginInfo['desc'] . "
Information:
" . $pluginInfo['url'] . ""
- . '
';
- } else {
- $desc = $pluginInfo['name'] . ' v' . $pluginInfo['version'] . ' (' . $pluginInfo['date'] . ') by '
- . $pluginInfo['author'] . '.
' . $pluginInfo['desc'] . "
Information: " . $pluginInfo['url'] . '';
- }
+ $key = strtoupper("{$pluginInfo['id']}_DESC");
+ $wec_options[$key] = array(
+ 'configname' => $key,
+ 'configdesc' => $desc,
+ 'longdesc' => '',
+ 'group' => $pluginInfo['name'],
+ 'type' => WECT_DESC,
+ 'page' => WECP_UMSP,
+ 'displaypri' => -50,
+ 'availval' => array(),
+ 'availvalname' => array(),
+ 'defaultval' => '',
+ 'currentval' => '',
+ );
- $key = strtoupper("{$pluginInfo['id']}_DESC");
- $wec_options[$key] = array(
- 'configname' => $key,
- 'configdesc' => $desc,
- 'longdesc' => '',
- 'group' => $pluginInfo['name'],
- 'type' => WECT_DESC,
- 'page' => WECP_UMSP,
- 'displaypri' => -50,
- 'availval' => array(),
- 'availvalname' => array(),
- 'defaultval' => '',
- 'currentval' => '',
- );
+ $wec_options[$pluginInfo['id']] = array(
+ 'configname' => $pluginInfo['id'],
+ 'configdesc' => 'Enable ' . $pluginInfo['name'] . ' UMSP plugin',
+ 'longdesc' => '',
+ 'group' => $pluginInfo['name'],
+ 'type' => WECT_BOOL,
+ 'page' => WECP_UMSP,
+ 'displaypri' => -45,
+ 'availval' => array('off', 'on'),
+ 'availvalname' => array(),
+ 'defaultval' => '',
+ 'currentval' => '',
+ 'readhook' => wec_umspwrap_read,
+ 'writehook' => wec_umspwrap_write,
+ 'backuphook' => null,
+ 'restorehook' => null,
+ );
- $wec_options[$pluginInfo['id']] = array(
- 'configname' => $pluginInfo['id'],
- 'configdesc' => 'Enable ' . $pluginInfo['name'] . ' UMSP plugin',
- 'longdesc' => '',
- 'group' => $pluginInfo['name'],
- 'type' => WECT_BOOL,
- 'page' => WECP_UMSP,
- 'displaypri' => -45,
- 'availval' => array('off', 'on'),
- 'availvalname' => array(),
- 'defaultval' => '',
- 'currentval' => '',
- 'readhook' => wec_umspwrap_read,
- 'writehook' => wec_umspwrap_write,
- 'backuphook' => NULL,
- 'restorehook' => NULL,
- );
-
- $wec_options['RAIREPLAY_PREFER_HD'] = array(
- 'configname' => 'RAIREPLAY_PREFER_HD',
- 'configdesc' => 'Prefer HD quality',
- 'longdesc' => '',
- 'group' => $pluginInfo['name'],
- 'type' => WECT_BOOL,
- 'page' => WECP_UMSP,
- 'displaypri' => -20,
- 'availval' => array('0', '1'),
- 'availvalname' => array(),
- 'defaultval' => '1',
- 'currentval' => '',
- );
+ $wec_options['RAIREPLAY_PREFER_HD'] = array(
+ 'configname' => 'RAIREPLAY_PREFER_HD',
+ 'configdesc' => 'Prefer HD quality',
+ 'longdesc' => '',
+ 'group' => $pluginInfo['name'],
+ 'type' => WECT_BOOL,
+ 'page' => WECP_UMSP,
+ 'displaypri' => -20,
+ 'availval' => array('0', '1'),
+ 'availvalname' => array(),
+ 'defaultval' => '1',
+ 'currentval' => '',
+ );
}
-
-?>
diff --git a/RaiReplay/config.php b/RaiReplay/config.php
index 87eb34f..13e76e4 100644
--- a/RaiReplay/config.php
+++ b/RaiReplay/config.php
@@ -4,32 +4,28 @@
# _DONT_RUN_CONFIG_ gets set by external scripts that just want to get the pluginInfo array via include() without running any code. Better solution?
if (!defined('_DONT_RUN_CONFIG_')) {
+ include_once $_SERVER['DOCUMENT_ROOT'] . '/umsp/funcs-config.php';
- include_once $_SERVER['DOCUMENT_ROOT'] . '/umsp/funcs-config.php';
+ # Check for a form submit that changes the plugin status:
+ if (isset($_GET['pluginStatus'])) {
+ $writeResult = _writePluginStatus($pluginInfo['id'], $_GET['pluginStatus']);
+ }
- # Check for a form submit that changes the plugin status:
- if (isset($_GET['pluginStatus'])) {
- $writeResult = _writePluginStatus($pluginInfo['id'], $_GET['pluginStatus']);
- }
+ # Read the current status of the plugin ('on'/'off') from conf
+ $pluginStatus = _readPluginStatus($pluginInfo['id']);
- # Read the current status of the plugin ('on'/'off') from conf
- $pluginStatus = _readPluginStatus($pluginInfo['id']);
+ # New or unknown plugins return null. Add special handling here:
+ if ($pluginStatus === null) {
+ $pluginStatus = 'off';
+ }
- # New or unknown plugins return null. Add special handling here:
- if ($pluginStatus === null) {
- $pluginStatus = 'off';
- }
+ # _configMainHTML generates a standard plugin dialog based on the pluginInfo array:
+ $retHTML = _configMainHTML($pluginInfo, $pluginStatus);
+ echo $retHTML;
- # _configMainHTML generates a standard plugin dialog based on the pluginInfo array:
- $retHTML = _configMainHTML($pluginInfo, $pluginStatus);
- echo $retHTML;
+ # Add additonal HTML or code here
- # Add additonal HTML or code here
-
- # _configMainHTML doesn't return end tags so add them here:
- echo '