Sign up here and you can log into the forum!

Search functionality explained

Discussion, features, plugins--everything about zoster's UMSP UPnP Media Server software

Re: Search functionality explained   

Postby avkiev » Wed Mar 23, 2011 9:05 am

avkiev wrote:exec("echo E > /tmp/ir_injection");

Unfortunately, it doesn't works.
User Input Dialog doesn't appears.
It is not very important, but it's a pity...
avkiev
Developer
 
Posts: 167
Joined: Tue Apr 27, 2010 5:02 am
Location: Ukraine, Kiev

Re: Search functionality explained   

Postby recliq » Wed Mar 23, 2011 9:25 am

did you try with sudo?
Code: Select all
exec("sudo echo E >/tmp/ir_injection");

this should work, maybe it's triggered too early, might also try to delay execution...
Code: Select all
exec("(sleep 2 && sudo echo E >/tmp/ir_injection) &");

(haven't tested the last statement if this works from php...)
­WDLXTV Project Maintainer
-:] If you like my contributions feel free to donate for a beer or a new flash drive. ...and always remember: RTFM! (README, FAQ, WIKI) [:-
User avatar
recliq
WDLXTV Team
 
Posts: 5513
Joined: Thu Apr 15, 2010 8:09 am
Location: Kiel, Germany

Re: Search functionality explained   

Postby avkiev » Wed Mar 23, 2011 9:36 am

Yes, I tried SUDO and SLEEP - no results
avkiev
Developer
 
Posts: 167
Joined: Tue Apr 27, 2010 5:02 am
Location: Ukraine, Kiev

Re: Search functionality explained   

Postby mad_ady » Wed Mar 23, 2011 11:27 am

Try the following as well:
Code: Select all
exec("sudo su -c 'echo E >/tmp/ir_injection' 2>&1", $output);

... and inspect the output - maybe there is an error message that can get you on your way. If you run it this way, the error output of sudo su gets sent to stdin (which is still captured in $output), and the echo command's output gets sent to the file. The way you did it before, sudo's output would get sent to the file (and I'm not sure it copies the stdout of the echo process...)

Also, keep a tail -f on /tmp/messages.txt and /var/log/php5/error_log and /var/log/apache2/error.log to see if something interesting is printed...

Best of luck!

Edit: had a better idea for a command
User avatar
mad_ady
Developer
 
Posts: 4522
Joined: Fri Nov 05, 2010 9:08 am
Location: Bucharest, Romania

Re: Search functionality explained   

Postby shunte » Wed Mar 23, 2011 12:33 pm

apologies for the big chunk of code but hopefully a working example will get you on your way

nothing more than the webend remote is doing

Code: Select all
<?php

   /*

   (C) 2011 Stuart Hunter

   This Uitzending Gemist plugin is designed for Zoster's UMSP server which runs
   (amongst others) inside the EM7075 and DTS variant.

   This is free software: you can redistribute it and/or modify
   it under the terms of the GNU General Public License as published by
   the Free Software Foundation, either version 3 of the License, or
   (at your option) any later version.

   This is distributed in the hope that it will be useful,
   but WITHOUT ANY WARRANTY; without even the implied warranty of
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
   GNU General Public License for more details.

   See <http://www.gnu.org/licenses/>.

   Thank you, and enjoy this plugin.

   */

   function _pluginMain($prmQuery)
   {
      $configData = getConfigData();
      $queryData = array();
      $items = array();
      if (strpos($prmQuery,'&amp;')!==false) $prmQuery=str_replace('&amp;','&',$prmQuery);
      parse_str($prmQuery, $queryData);
      if ((''!=$queryData['type'])&&('url'==$queryData['type']))
         $items = createUrlItems($configData,$queryData);
      elseif ((''!=$queryData['type'])&&('rss'==$queryData['type']))
         $items = createRSSItems($configData,$queryData);
      elseif ((''!=$queryData['type'])&&('playable'==$queryData['type']))
         $items = getStreamAttribs($configData,$queryData);
      elseif ((''!=$queryData['type'])&&('search'==$queryData['type']))
      {
         $items = createSections($configData);
         exec("sudo chmod 666 /tmp/ir_injection && sleep 2 && sudo echo E > /tmp/ir_injection &");
      }
      else
         $items = createSections($configData);
      unset($configData);
      return $items;
   }

   function _pluginSearch($prmQuery='')
   {
      $retItems = array();
      if(preg_match('/and dc:(title|album|genre) contains "(.*?)"/', $prmQuery, $searchterm))
      {
         $configData = getConfigData();
      }
      if(empty($retItems))
         $retItems[] = array (
            'id'      => 'umsp://plugins/gemist/gemist?bad=',
            'dc:title'   => 'Apologies, I don\'t understand the search you entered, please try again',
            'upnp:album_art'=> $configData['stopbadge'],
            'upnp:class'   => 'object.container',
         );
      return $retItems;
   }

   function createSections($configData)
   {
      $sections = array (
         array (
            'title'      => 'Net 5 - Programma gemist',
            'baseuri'   => 'http://www.net5.nl',
            'uri'      => 'http://www.net5.nl/web/show/id=1017155/langid=43/dbid=435/typeofpage=78934',
            'badgeuri'   => 'http://www.net5.nl/design/channel/net5/pix/global/header/g-logo.gif',
            'scrapenav'   => false,
            'regex_pre'   => null,
            'strip'      => false,
            'thumbs'   => false,
            'regex_pre'   => '|<div class="mo-a alphabetical">(?P<data>.*?)<div class="clearer"></div>|mis',
            'regex'      => '|<span class="title"><a  href="(?P<upart>.*?)" class="navigation" title="(?P<show>.*?)">(?P<title>.*?)</a></span>|',
            'feed'      => 'urlpaged',
            'type'      => 'url',
         ),
         array (
            'title'      => 'SBS 6 - Programma gemist',
            'baseuri'   => 'http://www.sbs6.nl',
            'uri'      => 'http://www.sbs6.nl/web/show/id=985609/langid=43/dbid=427/typeofpage=73941',
            'badgeuri'   => 'http://www.sbs6.nl/design/channel/sbs6/pix/global/header/g-logo.gif',
            'scrapenav'   => false,
            'regex_pre'   => null,
            'strip'      => false,
            'thumbs'   => false,
            'regex_pre'   => '|<div class="mo-a alphabetical">(?P<data>.*?)<div class="clearer"></div>|mis',
            'regex'      => '|<span class="title"><a  href="(?P<upart>.*?)" class="navigation" title="(?P<show>.*?)">(?P<title>.*?)</a></span>|',
            'feed'      => 'urlpaged',
            'type'      => 'url',
         ),
         array (
            'title'      => 'Veronica TV',
            'baseuri'   => 'http://www.veronicatv.nl',
            'uri'      => 'http://www.veronicatv.nl/web/show/id=997234/langid=43/dbid=430/typeofpage=78964',
            'badgeuri'   => 'http://www.veronicatv.nl/design/channel/veronicatv/pix/global/header/g-logo.gif',
            'scrapenav'   => false,
            'regex_pre'   => null,
            'strip'      => false,
            'thumbs'   => false,
            'regex_pre'   => '|<div class="mo-a alphabetical">(?P<data>.*?)<div class="clearer"></div>|mis',
            'regex'      => '|<span class="title"><a  href="(?P<upart>.*?)" class="navigation" title="(?P<show>.*?)">(?P<title>.*?)</a></span>|',
            'feed'      => 'urlpaged',
            'type'      => 'url',
         ),
/*
         array (
            'title'      => 'Veamer.nl',
            'baseuri'   => 'http://www.veamer.nl/',
            'uri'      => '',
            'badgeuri'   => 'http://www.veamer.nl/design/channel/veamer/pix/global/header/g-logo.gif',
            'scrapenav'   => false,
            'regex_pre'   => null,
            'strip'      => false,
            'thumbs'   => false,
            'regex_pre'   => '|<div class="mo-a alphabetical">(?P<data>.*?)<div class="clearer"></div>|mis',
            'regex'      => '|<span class="title"><a  href="(?P<upart>.*?)" class="navigation" title="(?P<show>.*?)">(?P<title>.*?)</a></span>|',
            'feed'      => 'urlpaged',
            'type'      => 'url',
         ),
*/
         array (
            'title'      => 'Tryck Search på fjärrkontrollen för att söka efter innehåll på SVT Play',
            'badgeuri'   => 'http://lh3.googleusercontent.com/_xJcSFBlLg_Y/TYTR2Blv9zI/AAAAAAAAApo/xw5eIIKCHE4/s160/svtsearch.png',
            'type'      => 'search',
         ),
      );
      foreach ($sections as $section)
      {
         $dataStr = http_build_query($section,'','&amp;');
         $retMediaItems[] = array (
            'id'      => 'umsp://plugins/gemist/gemist?'.$dataStr,
            'dc:title'   => $section['title'],
            'upnp:album_art'=> $section['badgeuri'],
            'upnp:class'   => 'object.container'
         );
      }
      return $retMediaItems;
   }
If you like the work I do please feel free to make a donation to the Red Cross
User avatar
shunte
Developer
 
Posts: 420
Joined: Sun Sep 19, 2010 1:43 am
Location: Cambridge, MA U. S. and A.

Re: Search functionality explained   

Postby avkiev » Thu Mar 24, 2011 1:54 pm

shunte wrote:exec("sudo chmod 666 /tmp/ir_injection && sleep 2 && sudo echo E > /tmp/ir_injection &");

Thanks, it works !
avkiev
Developer
 
Posts: 167
Joined: Tue Apr 27, 2010 5:02 am
Location: Ukraine, Kiev

May be it should help some time a lot   

Postby Kimjohn8496 » Sat Oct 29, 2011 8:43 am

May be it should help some time a lot... but no all the time i recommended this for as a alternate
Kimjohn8496
n00b
 
Posts: 2
Joined: Sat Oct 29, 2011 8:28 am

Previous

Return to UMSP Media Server

Who is online

Users browsing this forum: No registered users and 3 guests