Page 2 of 2

Re: Search functionality explained

PostPosted: Wed Mar 23, 2011 9:05 am
by avkiev
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...

Re: Search functionality explained

PostPosted: Wed Mar 23, 2011 9:25 am
by recliq
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...)

Re: Search functionality explained

PostPosted: Wed Mar 23, 2011 9:36 am
by avkiev
Yes, I tried SUDO and SLEEP - no results

Re: Search functionality explained

PostPosted: Wed Mar 23, 2011 11:27 am
by mad_ady
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

Re: Search functionality explained

PostPosted: Wed Mar 23, 2011 12:33 pm
by shunte
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;
   }

Re: Search functionality explained

PostPosted: Thu Mar 24, 2011 1:54 pm
by avkiev
shunte wrote:exec("sudo chmod 666 /tmp/ir_injection && sleep 2 && sudo echo E > /tmp/ir_injection &");

Thanks, it works !

May be it should help some time a lot

PostPosted: Sat Oct 29, 2011 8:43 am
by Kimjohn8496
May be it should help some time a lot... but no all the time i recommended this for as a alternate