Пример #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;
}
Пример #2
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();
}
Пример #3
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;
}
Пример #4
0
void cPluginEpgsearch::MainThreadHook(void)
{
  if (!VDR_readyafterStartup)
    {
      // signal VDR is ready, otherwise the search timer thread could use SVDRP before it works
      LogFile.Log(2, "VDR ready");
      VDR_readyafterStartup = true;
    }
}
Пример #5
0
bool cPluginEpgsearch::Start(void)
{
   if (!ConfigDir)
      ConfigDir = strdup(cPlugin::ConfigDirectory("epgsearch"));

   cPlugconfdirVar::dir = cPlugin::ConfigDirectory();

   if (cLogFile::LogFileName)
      LogFile.Open(cLogFile::LogFileName, Version());
   else
      LogFile.Open(AddDirectory(CONFIGDIR, "epgsearch.log"), Version());

   gl_recStatusMonitor = new cRecStatusMonitor;
   gl_timerStatusMonitor = new cTimerStatusMonitor;

   SearchExtCats.Load(AddDirectory(CONFIGDIR, "epgsearchcats.conf"), true);

   LoadMenuTemplates();
   LoadConfD();
   LoadUserVars();

   ChannelGroups.Load(AddDirectory(CONFIGDIR, "epgsearchchangrps.conf"), true);
   Blacklists.Load(AddDirectory(CONFIGDIR, "epgsearchblacklists.conf"));
   SearchExts.Load(AddDirectory(CONFIGDIR, "epgsearch.conf"));
   SearchTemplates.Load(AddDirectory(CONFIGDIR, "epgsearchtemplates.conf"));
   RecsDone.Load(AddDirectory(CONFIGDIR, "epgsearchdone.data"));
   SwitchTimers.Load(AddDirectory(CONFIGDIR, "epgsearchswitchtimers.conf"));
   NoAnnounces.Load(AddDirectory(CONFIGDIR, "noannounce.conf"));
   DefTimerCheckModes.Load(AddDirectory(CONFIGDIR, "deftimerchkmodes.conf"));
   TimersDone.Load(AddDirectory(CONFIGDIR, "timersdone.conf"));
   PendingNotifications.Load(AddDirectory(CONFIGDIR, "pendingnotifications.conf"));

   cSearchTimerThread::Init(this);
   cSwitchTimerThread::Init();
   cConflictCheckThread::Init(this);

   CheckUTF8();

   return true;
}
Пример #6
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);
}
Пример #7
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;
}