Getting from http://forum.xtreamer.net/mediawiki-1.15.1/index.php/Talk:Xtreamer_RSS_Guide
Full sample of text element without description : <text offsetXPC="5" offsetYPC="12" widthPC="85" heightPC="40" fontSize="17" backgroundColor="200:200:200" foregroundColor="75:85:95" redraw=no lines=4 align="justify" cornerRounding=10 tailDots="yes" <script> message; </script></text>getFocusMenuIndexDescription: fetch the index of the item which is Focus.Input Parameters: None Output Parameters: the Index of focusMenu Sample Code: <script> index = getFocusMenuIndex(); print(" the index is:", index);</script>setFocusMenuIndexDescription: set the item focus.Input Parameters: index Output Parameters: return NULL; Sample Code: <script> setFocusMenuIndex(0); index = getFocusMenuIndex(); print(" === the index is ", index);</script>showIdleDescription: show the idle imageInput Parameters: None Output Parameters: return NULL; Sample Code: <script> showIdle();</script>cancelIdleDescription: cancel the showing of idle imageInput Parameters: None Output Parameters: return NULL Sample Code: <script> topUrl = "http://tv.ppstream.com/classfortv.php?oem=realtek&classsize=5&page=2"; dlok = loadXMLFile(topUrl); if (dlok != null) print("success"); else { print("Download xml file fail: ", currentUrl); cancelIdle(); }</script>getSelectedItemIndexDescription: fetch the index of the item which is selected.Input Parameters: None Output Parameters: index Sample Code: <script> index = getSelectedItemIndex(); print(" === the index is ", index);</script>getDrawingItemStateDescription: fetch the state of the item which is be Drawing.Input Parameters: None Output Parameters: Item 's state,such as: "focus"、"unfocus"、"inactive" Sample Code: <script> state_string = getDrawingItemState();</script>getUserInputDescription: fetch the corresponding user inputInput Parameters: None Output Parameters: Command,such as: "left";"right";"up";"pageup";"pagedown";"down";"enter";"return";"edit";"download"; "video_completed";"video_stop";"video_pause";"video_ffwd";"video_sfwd";"video_srwd"; "video_repeat";"video_abrepeat"; Sample Code: <script> userInput = getUserInput(); if (userInput == "pagedown") print("userInput is pagedown"); else print("userInput is not pagedown");</script>userSelectToStringDescription: change UserSelect to a command stringInput Parameters: USR_SELECT userInput Output Parameters: command string Sample Code: <script> string = null; string = userSelectToString(SELECT_S); print(string);</script>stringToUserSelectDescription: change the command string to UserSelectInput Parameters: command string Output Parameters: USR_SELECT userInput Sample Code: <script> userInput = null; userInput = stringToUserSelect("enter");</script>currentUserInputDescription: fetch the current user inputcurrentUserInput() return the current user selection, like "up", "down", "left" ... It is often used inside <onUserInput> element in the script to know what's the user selection Input Parameters: None Output Parameters: Command,such as: "left";"right";"up";"pageup";"pagedown";"down";"enter";"return";"edit";"download"; "video_completed";"video_stop";"video_pause";"video_ffwd";"video_sfwd";"video_srwd"; "video_repeat";"video_abrepeat"; Sample Code: <script> userInputuserInput = currentUserInput(); if (userInput == "pageup") print("userInput is pageup"); else print("userInput is not pageup");</script>postMessageDescription: execution the commandInput Parameters: command,such as: "enter" "left";"right";"up";"pageup";"pagedown";"down";"enter";"return";"edit";"download"; "video_completed";"video_stop";"video_pause";"video_ffwd";"video_sfwd";"video_srwd"; "video_repeat";"video_abrepeat"; Output Parameters: return NULL; Sample Code: <script> index = getFocusItemIndex(); if (index > 0) { postMessage("enter"); } </script>setRefreshTimeDescription: set the refresh time of the page, in milliseconds. the refresh timer for the current page. when timer is up, the <onRefresh> element inside the script will be called.Input Parameters: time millisecond Output Parameters: return None Sample Code: <script><onRefresh> setRefreshTime(15000); print("onRefresh***********"); index = getFocusItemIndex(); if (index > 0) { postMessage("enter"); } </onRefresh></script>getURLDescription: fetch the content of an URL (local file and http:// only).Input Parameters: url The URL of remote content. For example, http://www.google.com/video/rse1234.xml Output Parameters: the content of the URL Sample Code: <script> price="AAPL"; price= price + getURL("http://download.finance.yahoo.com/d/quotes.csv?s=aapl&f=l1"); </script>getCSVFromURLDescription: get the CSV stirng from the url.Input Parameters: url The URL of remote content. Output Parameters: Command Separated value Sample Code: <script> CSV_string = getCSVFromURL("http://download.finance.yahoo.com/d/quotes.csv?s=aapl&f=l1"); </script>getItemInfoArrayDescription: function returns a string with the values, separates with '\n'. If an item does not have the element, it will contain only the '\n' without valueInput Parameters: itemElementName The element name to be fetched item by item. Output Parameters: a string with the element values, separates with '\n' Sample Code: <script> titleArray = getItemInfoArray("title"); </script>catStringArrayDescription: Function cat the string array with separatorInput Parameters: separator Output Parameters: a string which cat values with separator Sample Code: <script> catStringArray(stringArray, "+");</script> If stringArray contains: Taiwan Japan Canada The return string is "Taiwan+Japan+Canada"pushBackStringArrayDescription: Function append an element to the end of an existing string array, A stringArray is a text string separated with \n.Input Parameters: element A char string. Output Parameters: the new string array Sample Code: 1.idArray = null;idArray = pushBackStringArray(idArray, "1");idArray = pushBackStringArray(idArray, "2");the idArray will contain "1\n2\n". Use getStringArrayAt(idArray, 1); will return 2.use catStringArray(idArray, "+") will generate "1+2+"2.<script> titleArray = null; titleArray = pushBackStringArray(titleArray, "CNN News");</script> The return string is "CNN News"getStringArrayAtDescription: Function gets an element from a string array.Input Parameters: Index 0 based index. When index equals to -1, system will get the index from user’s current selection. Output Parameters: the value of array[index] Sample Code: <script> getStringArrayAt(stringArray, 0);</script>If stringArray contains Taiwan Japan Canada It will return Taiwan.deleteStringArrayAtDescription: Function deletes an element from a string array.Input Parameters: stringArray and index. if index = -1 mean current item index. Default value is -1. Output Parameters: the new string array Sample Code: <script> urlFile = getStoragePath("tmp"); urlFile = urlFile + "ppsUrl.dat"; old_string = readStringFromFile(urlFile); new_string = deleteStringArrayAt(old_string, 0);</script>updateDisplayDescription:Update the DiaplayInput Parameters: None Output Parameters: return NULL; Sample Code: <script> updateDisplay();</script>loadXMLFileDescription: load an XML file from local storage or http protocol, and create a global xml DOM object. The next call of loadXML file will destroy the previous DOM object and form the new one.Input Parameters: url the URL. For example "http://www.google.com/rss/sample.rss", or local file "/tmp/scripts/sample.rss". Output Parameters: if fail to load the file, function return NULL. Sample Code: <script> topUrl = "http://tv.ppstream.com/classfortv.php?oem=realtek&classsize=5&page=1"; dlok = loadXMLFile(topUrl); if (dlok != null) print("success"); else print("fail"); </script>Input Parameters: char string, Output Parameters: return NULL. Sample Code: <script> print("fail"); </script>getItemInfoDescription: function return the item value associate with the name.Input Parameters: Index: the item index Name string: you can query the standard item elements defined inside RSS2.0. Any element text inside <item> <xx> TEST </xx> </item> can be queried by name. In this example, getItemInfo("xx") return "TEST". "mediaURL" : the direct URL path of the media file from internet. This link must be consistent on the web server. Or it can be the videoID on storage after user download from playURL "playURL" : the web URL to the internet contents. it is used when the web server will re-direct the link to other places like youtube. "link" : when user select the item, this is the url that the service will go to. we use "link" to go to services, for example "rss_file://test.rss" will open the rss file in our browser. "pageNumber": the page number of requested item is located indexForMultipleResults: default to 0, and if index = -1, function will fetch current focus item, which equal to the second prototype of this function Output Parameters: return the string of item value associate with the name. Sample Code: <script> getItemInfo(1, XX); </script>If rss contains <item> <xx> TEST</xx></item><item> <xx> TEST2</xx></item> It will return TEST.getPageInfoDescription: function return the value associate with the name. This is page releated attributesInput Parameters: Name string: e.g. name can be "itemCount" or "focusItemIndex". "itemCount" means how many items show in the current page. Output Parameters: return the string of current page value associate with the name. Sample Code: <script> getPageInfo("itemCount"); </script>If rss contains <item> <xx> TEST</xx></item><item> <xx> TEST2</xx></item> It will return "2".getQueryItemIndexDescription: return the current item index that the View is currently scanning at. This function is useful in item_template to get the item index. When your script is scanning the items by itself instead of user focus change, use getQueryItemIndex. It is not the focused item, it is the item that the view is currently drawingInput Parameters: None Output Parameters: Index : the current item index that the View is currently scanning at Sample Code: <script> ItemIndex = getQueryItemIndex(); </script>getQueryMenuIndexDescription: return the current menu index that the View is currently scanning at.Input Parameters: None Output Parameters: Index : the current menu index that the View is currently scanning at Sample Code: <script> MenuIndex = getQueryMenuIndex(); </script>getFocusItemIndexDescription: return the current item index that the View is currently focus on.Input Parameters: None Output Parameters: FocusIndex : the current focus item index Sample Code: <script> FocusIndex = getFocusItemIndex(); </script>addItemDescription: add Item to current document. Function add an element to current page.Input Parameters: String: new element name Output Parameters: None Sample Code: <script> add("newitem"); </script>If rss contains <channel><item> <xx> TEST</xx></item></channel><newitem> <xx> TEST2</xx></newitem>The modify rss to new :<channel><item> <xx> TEST</xx></item><item> <xx> TEST2</xx></item></channel>redrawDisplayDescription: redraw the display.Input Parameters: None Output Parameters: None Sample Code: <script> redrawDisplay(); </script>getXMLElementCountDescription: get the count of a specific element from xml dom object.Input Parameters: name string of specific element Output Parameters: Count string Sample Code: <script> getXMLElementCount("FilmData","Film"); </script>If rss contain:<FilmData> <Film> </Film> <Film> </Film> <Film> </Film> <Film> </Film></FilmData>It will return "4".getXMLTextDescription: get the text of specific element from global xml dom objectInput Parameters: name string of specific element Output Parameters: Context of element Sample Code: <script> context = getXMLText("FilmData", "Film", 2, "context");print("context =",context);</script>If rss contain:<FileData> <Film> <context>"Hello !" </context> </Film> <Film> <context>"Hello world !" </context> </Film><FileData>It will return "context = Hello world!".getXMLAttributeDescription: get the attribute of a specific element from global xml dom objectInput Parameters: name string of specific element Output Parameters: attribute of element Sample Code: <script> attribute = getXMLAttribute ("FilmData", "Film", "context");print("attribute =", attribute);</script>If rss contain:<FileData> <Film> <context>"Hello !" </context> </Film> <Film> <context>"Hello world !" </context> </Film><FileData>It will return "attribute = text".getURLforStockDescription: get URL informations for stockInput Parameters: URL Path Output Parameters: None Sample Code: <script> dlok = getURLforStock(Xmlurl);</script>selectMenuDescription: function will select the menu.Input Parameters: Menu index Output Parameters: None Sample Code: <script> SelectMenu(2); // will select the 3rd menu item.</script>setItemFocusDescription: function will focus the menu.Input Parameters: Menu index Output Parameters: None Sample Code: <script> SelectFocus(2); // will focus the 3rd menu item.</script>executeScriptDescription: function will execute a script block.Input Parameters: specific element string name Output Parameters: None Sample Code: <script> executeScript("testFunction"); //will execute the script inside <testFunction> in the RSS scope</script>If rss contain:< testFunction > print("Hello !");< /testFunction >It will return "Hello!".jumpToLinkDescription: function will jump to other URL follow the description of a script block.Input Parameters: element link Output Parameters: None Sample Code: <script> jumplink("nextLink1");</script>If rss contain:<nextLink1> <link> ./multiMenu/scripts/help/help.rss</link> <mediaDisplay name=onePartView itemXPC = 2.5 itemYPC = 5 itemWidthPC = 95 itemHeightPC = 7 /> </nextLink1>It will jump to help.rsswriteStringToFileDescription: write value to fileInput Parameters: Filename; value Output Parameters: None Sample Code: <script> SelectTypePath = getStoragePath("tmp"); SelectTypePath = SelectTypePath + "thunderfocus.dat"; writeStringToFile(SelectTypePath, "movie");</script>the context of thunderfocus.dat contain "movie".playItemURLDescription: play the "playURL" of item in previewWindow or full screenInput Parameters: Index element1, element2 : the element tag name to previewWindow, Output Parameters: None Sample Code: <script> playItemURL(content, 0, "mediaDisplay", "previewWindow");</script>sprintf1Integer1sprintfIntegerAddMinusgetInputDecription: Function will pop up window to get user input. function will return the string from user input.If user escape the input window, function will return "null". postMessageDecription: postMessage() post a user message to systemyou can post, "left", "right", "up", "down", "enter", "return", "edit" setRefreshTimeDecription: set the refresh timer for the current page. when timer is up, the <onRefresh> element inside the script will be called.setRefreshTime(miliseconds); getURLDecription: fetch the content from internet site.getURL(url). function return the http content in full text. getCSVFromURLDecription: fetch the content from internet site.getCSVFromURL(url). function return the http content parse to string array basing on CSV fomat, which is comma separated string getItemInfoDecription: getItemInfo(index, name, indexForMultipleResults), function return the item[index]["name"][indexForMultipleResults] value associate with the name.getItemInfo(name, indexForMultipleResults), function return current focus item["name"][indexForMultipleResults]. indexForMultipleResults default to 0, and if index = -1, function will fetch current focus item, which equal to the second prototype of this function name: you can query the standard item elements defined inside RSS2.0. Any element text inside <item> <xx> TEST </xx> </item> can be queried by name. In this example, getItemInfo("xx") return "TEST". "mediaURL" : the direct URL path of the media file from internet. This link must be consistent on the web server. Or it can be the videoID on storage after user download from playURL "getplayURL" : the web URL to the internet contents. it is used when the web server will re-direct the link to other places like youtube. "link" : when user select the item, this is the url that the service will go to. we use "link" to go to services, for example "rss_file://test.rss" will open the rss file in our browser. for rss definition, please see RSS2.0 documentation. "length", "duration", "description", "title", "mediaType", "pubDate" are default RSS2.0 elements, please refer to RSS2.0 spec "pageNumber": the page number of requested item is located Any XML file conform to our dataProivder can have any custom name-value pair. For example, Flickr xml feed has "id" element, that you can use getItemInfo to get the value corresponding to the "id" element. youtube has "rating", "viewcount", "durationHHMMSS" getPageInfoDecription: getPageInfo(name), function return the value associate with the name. This is page releated attributese.g. name can be "itemCount" or "focusItemIndex". "itemCount" means how many items show in the current page. getQueryItemIndexDecription: getQueryItemIndex() return the current item index that the View is currently scanning atThis function is useful in item_template to get the item index. When your script is scanning the items by itself instead of user focus change, use getQueryItemIndex. It is not the focused item, it is the item that the view is currently drawing getQueryMenuIndexgetFocusItemIndexDecription: getFocusItemIndex() return the current item index that the View is currently focus on.getFocusMenuIndexgetSelectedItemIndexDecription: getSelectedItemIndex() return the last selected item. It might not equal to current focus.getDrawingItemStateDecription: getDrawingItemState() return the current drawing item state. The return value is "focus", "unfocus",or "inactive"getItemInfoArrayDecription: getItemInfoArray(itemElementName), function return a string with the values, separates with '\n'. If an item does not have the element, it will contain only the '\n' without valuethis function is useful to get one data column of all items. catStringArrayDecription: catStringArray(stringArray, "+"). Function replace the string array with separator.example: the "taipei \n tokyo \n" will become "taipei + tokyo +" getStringArrayAtDecription: getStringArrayAt(stringArray, index). Function get the indexth entry of the string array.if index = -1 mean current item index. Default value is -1. example: getStringArrayAt(stringArray) will get the getQueryItemIndex, then issue getStringArrayAt(string, getQueryItemIndex). deleteStringArrayAtDecription: deleteStringArrayAt(stringArray, index). Function delete the indexth entry of the string array.if index = -1 mean current item index. Default value is -1. example: deleteStringArrayAt(stringArray) will delete the getQueryItemIndex, t function will cause the number of element of the array reduce 1 addItemDecription: add Item to current document. Function add an element to current page.example: addItem("newItem"). the calling will find the <newItem> element under <rss> domain, then rename and resolve the scripts inside <newItem> element, insert the <newItem> element inside <channel> domain, and rename <newItem> to <item> redrawDisplayDecription: redraw the displayloadXMLFileDecription: load an xml file from url, and create a global xml dom objectonly one instance of xml at a time. Call loadXML will switch to another xml document. getXMLElementCountDecription: return the count of a specific element from xml dom objectexample: getXMLElementCount("rsp", "photos", "photo"); If return 5, means there are 5 <photo> elements under <photos> element getXMLTextDecription: get the text of specific element from global xml dom objectFor example, getXMLText("rss", "channel", "title"); For example, getXMLText("rss", "channel", "title", 5, "text"); The number 5 means the 5th "title" element. Default element index is 0 for each element. getXMLText("rss", "channel", "title", 5, "text", 5); is equal to ["rss"][0]["channel"][0]["title"][5]["text"][6] getXMLAttributeDecription: get the attribute of a specific element from global xml dom objectThe last parameter is the attribute of the element. For example, getXMLText("rss", "channel", "content", "url"); Usage, please see getXMLText pushBackStringArrayDescription: push a string to the back of the string array. A stringArray is a text string separated with \n.example. idArray = null;
idArray = pushBackStringArray(idArray, "1"); idArray = pushBackStringArray(idArray, "2");use catStringArray(idArray, "+") will generate "1+2+" getURLforStockDescription: get URL informations for stockselectMenuDescription: selectMenu(index); function will select the menu. selectMenu(2) will select the 3rd menu item.executeScriptDescription: executeScript will execute a script block.executeScript("testFunction"); will execute the script inside <testFunction> in the RSS scope jumpToLinkDescription: jumpToLink will jump to other URL follow the description of a script block.jumpToLink("nextLink1"); will follow the link inside <nextLink1> in the RSS scope example of <nextLink1> <nextLink1> <link>./multiMenu/scripts/help/help.rss</link>
<mediaDisplay name=onePartView
itemXPC = 2.5
itemYPC = 5
itemWidthPC = 95
itemHeightPC = 7 />
</nextLink1>setItemFocusDescription: setItemFocus(index); function will set the item focus. The setting will effect on the dataProviderIf want to reflect on view, you need to redraw the display. playItemURLDescription: control video. play video in previewWindow or full screen !!general usage of the script function is playItemURL(op, url, startupfullness, offset, chapIndex, element1, element2....). argument list: 1, op : required operation code, the valid numbers are op=1: stop current video op=2: pause current video op=0: play the video in URL op=10: play video in URL, and display idle image before video starts op=3: play video in URL, but pause the video on start op=4: play video in URL, pause video on start, and don't hide OSD op=5: play audio in URL (for audio file). 2, URL, required, and only relevant if op is "play" URL can be a number, playItemUrl will try to get the index item's playURL in current dataprovider. URL can be a file path, the specified file will be played URL can be http URL. 3, optional startupfullness, a integer specify how much to buffer before playing. not used, default -1 4, optional offset, a integer specify where to seek to to play, default -1 5, optional chapIndex, not used, a integer specify the chapter to start, default -1 3,4,5,6 - optional element strings to specify where the preview window is. If no preview window, video will play full screen. if arg 3/4/5 is not a number (startupfullness), then starting with 3, arg 3/4/5, all following arguments will be treated as element string. playAtTimegetPlaybackStatusDescription: get the status of video playback, in the format of "current/max"both are integers. If no video is playing, you get "0/100". getCachedStreamDataSizesetPreviewWindowtearDownPlaybackFlowsetVoutDisplayGetScreenSaverStatusSetScreenSaverStatusisInternalHDDExistgetPTSupdatePlaybackProgressDescription: update playback progress barupdatePlaybackProgress(progress, element1, element2....). element1, element2 is the element tag name to previewWindow, for example, ["mediaDisplay"][0]["previewWindow"][0], will be playItemURL(index, "mediaDisplay", "previewWindow"); last element must be previewWindow element, readStringFromFileDescription: read string from filereadStringFromFile(fileName) writeStringToFileDescription: write value to filewriteStringToFile(fileName, value) setEnvDescription: set environment variablesetEnv(name, value, overWrite) unsetEnvDescription: unset environment variablegetEnvDescription: read environment variablegetEnv(name) getStoragePathDescription: get the path of local storage. e.g. temporary storage "tmp", non-volitle storage "key"getStoragePath(symbol). symbol is "tmp", "key" drawImageOnScreenDescription: drawImageOnScreen will draw image on the on screen buffer. It will not effect backbufferdrawImageOnScreen(path, xPC, yPC, widthPC, heightPC). All refer to panelWidth and panelHeight drawImageDescription: drawImage will draw image on the back buffer.drawImage(path, xPC, yPC, widthPC, heightPC). All refer to panelWidth and panelHeight urlEncodeDescription: function return encoded urlmenuCmdDescription: menuCmd(AP_Name, cmd1, cmd2 .....). send command to AP by user selectgetCurrentAPNameDescription: getCurrentAPName(). get current AP's namesetParentFadeDescription: setParentFade(). set Parent AP's display area fadedeleteItemDescription: remove an item from saved file.setFocusItemIndexDescription: setFocusItemIndex set the current focus ItemsetFocusMenuIndexDescription: setFocusMenuIndex set the current focus menuconvertSpaceInUrlDescription: convert ' ' in url to %20prepareAnimationDescription: prepare system for animationgetErrorCodegetErrorStringdoModalRsssetReturnStringgoogleServiceLoginDescription: this is google authentication service (clientLogin), it take multiple keywords. The first word is the keyword,"youtube usr pass" - for log into youtube, with usr/pass return "success" if OK "status youtube Auth" - check youtube (logged in?) return auth string "status youtube ..." - check youtube (logged in?) return youtubeUsername to be extended to other google services (picasa etc) cancelDownloadDescription: cancel the url downloading, you can cancel multiple downloads in single function callSample code: cancelDownload("http://www.test.com/1.jpg", "http://www.test1.com/sample.jpg") |


