Esempio n. 1
0
cOsdObject *cPluginEpgsearch::DoInitialSearch(char* rcFilename)
{
   cRCFile rcFile;
   if (rcFile.Load(rcFilename))
   {
      cSearchExt* SearchExt = new cSearchExt;
      strn0cpy(SearchExt->search,rcFile.Search, sizeof(SearchExt->search));
      if (rcFile.ChannelNr != -1)
      {
#if VDRVERSNUM > 20300
         LOCK_CHANNELS_READ;
         const cChannels *vdrchannels = Channels;
#else
         cChannels *vdrchannels = &Channels;
#endif
         SearchExt->useChannel = true;
         SearchExt->channelMin = vdrchannels->GetByNumber(rcFile.ChannelNr);
         SearchExt->channelMax = vdrchannels->GetByNumber(rcFile.ChannelNr);
      }
      SearchExt->mode = rcFile.SearchMode;
      SearchExt->useTitle = rcFile.UseTitle;
      SearchExt->useSubtitle = rcFile.UseSubtitle;
      SearchExt->useDescription = rcFile.UseDescr;

      remove(rcFilename);
      return new cMenuSearchResultsForSearch(SearchExt, cTemplFile::GetTemplateByName("MenuSearchResults"));
   }
   else
      LogFile.eSysLog("could not load '%s'", rcFilename);

   return NULL;
}
Esempio n. 2
0
cOsdObject *cPluginEpgsearch::DoInitialSearch(char* rcFilename)
{
   cRCFile rcFile;
   if (rcFile.Load(rcFilename))
   {
      cSearchExt* SearchExt = new cSearchExt;
      strcpy(SearchExt->search,rcFile.Search);
      if (rcFile.ChannelNr != -1)
      {
         SearchExt->useChannel = true;
         SearchExt->channelMin = Channels.GetByNumber(rcFile.ChannelNr);
         SearchExt->channelMax = Channels.GetByNumber(rcFile.ChannelNr);
      }
      SearchExt->mode = rcFile.SearchMode;
      SearchExt->useTitle = rcFile.UseTitle;
      SearchExt->useSubtitle = rcFile.UseSubtitle;
      SearchExt->useDescription = rcFile.UseDescr;

      remove(rcFilename);
      return new cMenuSearchResultsForSearch(SearchExt, cTemplFile::GetTemplateByName("MenuSearchResults"));
   }
   else
      LogFile.eSysLog("could not load '%s'", rcFilename);

   return NULL;
}
Esempio n. 3
0
void cPluginEpgsearch::LoadMenuTemplates()
{
   char* templateFilename = strdup(AddDirectory(CONFIGDIR, "epgsearchmenu.conf"));
   if (access(templateFilename, F_OK) == 0)
   {
      cTemplFile templFile;
      if (!templFile.Load(templateFilename))
      {
         templFile.Reset();
         LogFile.eSysLog("could not load '%s'", templateFilename);
      }
   }
   cTemplFile::PrepareDefaultTemplates();
   free(templateFilename);
}
Esempio n. 4
0
void cPluginEpgsearch::LoadUserVars()
{
   char* userVarFilename = strdup(AddDirectory(CONFIGDIR, "epgsearchuservars.conf"));
   if (access(userVarFilename, F_OK) == 0)
   {
      LogFile.Log(1, "loading %s", userVarFilename);
      cUserVarFile userVarFile;
      if (!userVarFile.Load(userVarFilename))
         LogFile.eSysLog("could not load '%s'", userVarFilename);
      else
         LogFile.Log(2,"loaded uservars from %s", userVarFilename);
   }
   free(userVarFilename);
   UserVars.InitInternalVars();
   UserVars.InitExtEPGVars();
}
Esempio n. 5
0
bool cPluginEpgsearch::ProcessArgs(int argc, char *argv[])
{
   // Implement command line argument processing here if applicable.


   if (argc==5 && !strcmp(argv[0], "timermenu"))
   { // yes, this is an ugly hack!
      argv[1] = (char*) new cMenuMyEditTimer((cTimer*) argv[2], (bool) argv[3], (const cEvent*) argv[4]);
      return true;
   }

   if (argc==8 && !strcmp(argv[0], "searchepg"))
   {
      cSearchExt* SearchExt = new cSearchExt;
      strn0cpy(SearchExt->search,argv[2], sizeof(SearchExt->search));
      if (atoi(argv[3]) > 0)
      {
#if VDRVERSNUM > 20300
         LOCK_CHANNELS_READ;
         const cChannels *vdrchannels = Channels;
#else
         cChannels *vdrchannels = &Channels;
#endif
         SearchExt->useChannel = true;
         SearchExt->channelMin = vdrchannels->GetByNumber(atoi(argv[3]));
         SearchExt->channelMax = vdrchannels->GetByNumber(atoi(argv[3]));
      }
      SearchExt->mode = atoi(argv[4]);
      SearchExt->useTitle = atoi(argv[5]);
      SearchExt->useSubtitle = atoi(argv[6]);
      SearchExt->useDescription = atoi(argv[7]);
      argv[1] = (char*) new cMenuSearchResultsForSearch(SearchExt, cTemplFile::GetTemplateByName("MenuSearchResults"));
      return true;
   }

   static const struct option long_options[] = {
      { "svdrpsendcmd",   required_argument, NULL, 'f' },
      { "config",         required_argument, NULL, 'c' },
      { "logfile",        required_argument, NULL, 'l' },
      { "verbose",        required_argument, NULL, 'v' },
      { "mailcmd",        required_argument, NULL, 'm' },
      { "reloadmenuconf", no_argument, NULL, 'r' },
      { NULL,             no_argument, NULL, 0 }
   };

   int c=0,i=0;

   while ((c = getopt_long(argc, argv, "f:c:l:v:m:r", long_options, &i)) != -1) {
      switch (c) {

         case 'f':
            cSVDRPClient::SVDRPSendCmd = optarg;
            EPGSearchConfig.useExternalSVDRP = 1;
            break;
         case 'c':
            ConfigDir = strdup(optarg);
            break;
         case 'l':
            cLogFile::LogFileName = optarg;
            break;
         case 'v':
            cLogFile::loglevellimit = atoi(optarg);
            break;
         case 'r':
            reloadMenuConf = true;
            break;
         case 'm':
            cMailNotifier::MailCmd = optarg;
            break;
         default:  return false;
      }
   }

   if (EPGSearchConfig.useExternalSVDRP && access(cSVDRPClient::SVDRPSendCmd, F_OK) != 0)
   {
      LogFile.eSysLog("ERROR - can't find svdrpsend script: '%s'", cSVDRPClient::SVDRPSendCmd);
      cSVDRPClient::SVDRPSendCmd = NULL;
   }

   return true;
}