As I am only vaguely familiar with PHP, I attempted to simply replace the existing XMl portion of the example file with the video and audio content of my own. I placed each video item under 'video results' and audio items under 'audio results.
My result was that no matter what I type in the Search, the results are EVERY Video and Audio item in my inventory. LOL
Any help would be greatly appreciated. An Example would be Fantastic!!
Many Thanks!
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
The search script doesn't have to be programmed in php. You could use perl or python or any server-side scripting language. The search script included in the openrokn package is not a functioning script. It was only included to show which parameters (?keywords=the+query) are used by openrokn when a search is performed.
The meta-data (title, description, bitrate, length, etc) for video and audio files is typically stored in a database. If your media is already indexed in a db then coding the search script should be as simple as making a sql query. If you haven't yet indexed your media in a db then I suppose you could search the xml files but it won't be as efficient or as simple as making a single sql query. You can probably find a free php script on the internet to perform the xml search but you'll need to modify it to output the results in orml.
If you've already indexed your media then I'd be happy to post a complete php example if you'll post an example of your sql table structure (i.e., table names and column names).
header("Content-type: application/xml");$xml=newDOMDocument("1.0","UTF-8");$xml->formatOutput=true;//thiswilladdlinebreaksandindentationtooutput$orml=$xml->createElement("orml");$orml->setAttribute("version","1.2");$orml->setAttribute("xmlns","http://sourceforge.net/p/openrokn/home/ORML");$xml->appendChild($orml);$feed=$xml->createElement("channel");$orml->appendChild($feed);$poster=$xml->createElement("item");$poster->setAttribute("type","poster");$poster->setAttribute("style","flat-episodic-16x9");$poster->setAttribute("title",$title);$feed->appendChild($poster);//connecttosqlserver$link=mysql_connect($SQL_HOST,$SQL_USER,$SQL_PASS)ordie($xml->saveXML());//selectmysqldbmysql_select_db($SQL_DBNAME)ordie($xml->saveXML());$query="SELECT * FROM `media` WHERE `title` LIKE '%$keywords%' ORDER BY `title` ASC LIMIT 30";//performthesqlquery$result=mysql_query($query)ordie($xml->saveXML());while($row=mysql_fetch_array($result,MYSQL_ASSOC)){//createormlcodehereforeachsearchresult$item=$xml->createElement("item");$item->setAttribute("type",$row['type']);$item->setAttribute("title",$row['title']);$item->setAttribute("url","http://yoursite.com/".$row['filename']);$poster->appendChild($item);}mysql_free_result($result);mysql_close($link);//outputormlfeed/searchresultsecho$xml->saveXML();
Last edit: kavulix 2012-12-10
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
As I am only vaguely familiar with PHP, I attempted to simply replace the existing XMl portion of the example file with the video and audio content of my own. I placed each video item under 'video results' and audio items under 'audio results.
My result was that no matter what I type in the Search, the results are EVERY Video and Audio item in my inventory. LOL
Any help would be greatly appreciated. An Example would be Fantastic!!
Many Thanks!
The search script doesn't have to be programmed in php. You could use perl or python or any server-side scripting language. The search script included in the openrokn package is not a functioning script. It was only included to show which parameters (?keywords=the+query) are used by openrokn when a search is performed.
The meta-data (title, description, bitrate, length, etc) for video and audio files is typically stored in a database. If your media is already indexed in a db then coding the search script should be as simple as making a sql query. If you haven't yet indexed your media in a db then I suppose you could search the xml files but it won't be as efficient or as simple as making a single sql query. You can probably find a free php script on the internet to perform the xml search but you'll need to modify it to output the results in orml.
If you've already indexed your media then I'd be happy to post a complete php example if you'll post an example of your sql table structure (i.e., table names and column names).
Last edit: kavulix 2012-12-10