Example #1
0
bool cPluginReelblogReader::Start(void)
{
  // Start any background activities the plugin shall perform.
  if (!ReelblogItems.Load(AddDirectory(ConfigDirectory(), "reelblog.conf")))
    Skins.Message(mtInfo, tr("ConfigFile reelblog.conf not found!"));
  return true;
}
Example #2
0
bool cScPlugin::Start(void)
{
  if(APIVERSNUM<MINAPIVERSNUM) {
    PRINTF(L_GEN_ERROR,"SC plugin needs at least VDR API version %d.%d.%d",MIN_VERS,MIN_MAJOR,MIN_MINOR);
    return false;
    }
  if(sizeof(int)!=4) {
    PRINTF(L_GEN_ERROR,"compiled with 'int' as %d bit. Only supporting 32 bit.",(int)sizeof(int)*8);
    return false;
    }
  if(sizeof(long long)!=8) {
    PRINTF(L_GEN_ERROR,"compiled with 'long long' as %d bit. Only supporting 64 bit.",(int)sizeof(long long)*8);
    return false;
    }
    
  ScPlugin=this;
  const char *cfgdir=ConfigDirectory(cfgsub);
  filemaps.SetCfgDir(cfgdir);
  cStructLoaders::SetCfgDir(cfgdir);
  ScSetup.Check();
  if(!cSoftCAM::Load(cfgdir)) return false;
  cScDevices::Startup();
  keeper=new cScHousekeeper;
  return true;
}
Example #3
0
bool cPluginXVDRServer::Initialize(void)
{
  // Initialize any background activities the plugin shall perform.
  XVDRServerConfig.ConfigDirectory = ConfigDirectory(PLUGIN_NAME_I18N);
  XVDRServerConfig.Load();
  return true;
}
Example #4
0
bool cPluginVNSIServer::Initialize(void)
{
  // Initialize any background activities the plugin shall perform.
  VNSIServerConfig.ConfigDirectory = ConfigDirectory(PLUGIN_NAME_I18N);

  VNSIServer = this;
  return true;
}
Example #5
0
bool cPluginDvdswitch::Initialize(void)
{
  // Initialize any background activities the plugin shall perform.
  MYDEBUG("Plugin wird initialisiert");

  DVDSwitchSetup.SetConfDir((char*)ConfigDirectory(Name()));
  ImageList.Init();
  DVDSwitchSetup.Init();
  listThread = new cDVDListThread();

  return true;
}
Example #6
0
bool cPluginRadio::Initialize(void)
{
    // Initialize any background activities the plugin shall perform.
    radioImage = new cRadioImage;
    radioAudio = new cRadioAudio;
    
    if (!ConfigDirParam) 
        ConfigDir = strdup(ConfigDirectory(Name()));
    if (!DataDirParam) {
        DataDir = strdup("/tmp/vdr-radio.XXXXXX");
        mkdtemp(DataDir);
        }
    if (!LiveFileParam)
        asprintf(&LiveFile, "%s/radio.mpg", ConfigDir);
    if (!ReplayFileParam)
        asprintf(&ReplayFile, "%s/replay.mpg", ConfigDir);
    
    return true;
}
Example #7
0
cString cScPlugin::SVDRPCommand(const char *Command, const char *Option, int &ReplyCode)
{
  if(!strcasecmp(Command,"RELOAD")) {
    if(cGlobal::Active(true)) {
      ReplyCode=550;
      return "Softcam active. Can't reload files now";
      }
    else {
      if(cSoftCAM::Load(ConfigDirectory(cfgsub)))
        return "Files reloaded successfully";
      else {
        ReplyCode=901;
        return "Reloading files not entirely successfull";
        }
      }
    }
  else if(!strcasecmp(Command,"KEY")) {
    if(Option && *Option) {
      if(keys.NewKeyParse(skipspace(Option),"from SVDR"))
        return "Key update successfull";
      else {
        ReplyCode=901;
        return "Key already known or invalid key format";
        }
      }
    else { ReplyCode=501; return "Missing args"; }
    }
  else if(!strcasecmp(Command,"LOG")) {
    if(Option && *Option) {
      char tmp[1024];
      strn0cpy(tmp,Option,sizeof(tmp));
      char *opt=tmp;
      opt=skipspace(opt);
      bool mode;
      if(!strncasecmp(opt,"ON ",3)) { mode=true; opt+=3; }
      else if(!strncasecmp(opt,"OFF ",4)) { mode=false; opt+=4; }
      else { ReplyCode=501; return "Bad mode, valid: on off"; }
      do {
        char *s=index(opt,',');
        if(s) *s++=0;
        int c=cLogging::GetClassByName(opt);
        if(c>=0) cLogging::SetModuleOption(c,mode);
        else { ReplyCode=501; return "Unknown message class"; }
        opt=s;
        } while(opt);
      ScSetup.Store(true);
      Setup.Save();
      return "Done";
      }
    else { ReplyCode=501; return "Missing args"; }
    }
  else if(!strcasecmp(Command,"LOGCFG")) {
    cLineBuff lb(256);
    for(int m=1; m<LMOD_MAX; m++) {
      const char *name=cLogging::GetModuleName(LCLASS(m,0));
      if(name) {
        int o=cLogging::GetModuleOptions(LCLASS(m,0));
        if(o>=0) {
          for(int i=0; i<LOPT_NUM; i++) {
            const char *opt;
            if(i==0) opt="enable";
            else opt=cLogging::GetOptionName(LCLASS(m,1<<i));
            if(opt)
              lb.Printf("%s.%s %s\n",name,opt,(o&(1<<i))?"on":"off");
            }
          }
        }
      }
    if(lb.Length()>0) return lb.Line();
    ReplyCode=901; return "No config available";
    }
  else if(!strcasecmp(Command,"LOGFILE")){
    if(Option && *Option) {
      char tmp[1024];
      strn0cpy(tmp,Option,sizeof(tmp));
      char *opt=tmp;
      opt=skipspace(opt);
      bool mode;
      if(!strncasecmp(opt,"ON",2)) { mode=true; opt+=2; }
      else if(!strncasecmp(opt,"OFF",3)) { mode=false; opt+=3; }
      else { ReplyCode=501; return "Bad mode, valid: on off"; }
      cLineBuff lb(256);
      if(mode) {
        logcfg.logFile=true;
        if(*opt==' ' || *opt=='\t') {
          opt=stripspace(skipspace(opt));
          strn0cpy(logcfg.logFilename,opt,sizeof(logcfg.logFilename));
          }
        lb.Printf("logging to file enabled, file %s",logcfg.logFilename);
        }
      else {
        logcfg.logFile=false;
        lb.Printf("logging to file disabled");
        }
      ScSetup.Store(true);
      Setup.Save();
      return lb.Line();
      }
    else { ReplyCode=501; return "Missing args"; }
    }
  return NULL;
}
Example #8
0
cMenuSetupPage *cScPlugin::SetupMenu(void)
{
  return new cMenuSetupSc(ConfigDirectory(cfgsub));
}
Example #9
0
bool cPluginRssReader::Initialize(void)
{
  // Initialize any background activities the plugin shall perform.
  RssReaderConfig.SetConfigFile(*AddDirectory(ConfigDirectory(PLUGIN_NAME_I18N), PLUGIN_NAME_I18N ".conf"));
  return true;
}
Example #10
0
bool cPluginGraphLCD::Initialize()
{
    unsigned int displayNumber = 0;
    const char * cfgDir;

    RegisterI18n(Phrases);

    if (mConfigName.length() == 0)
    {
        mConfigName = kDefaultConfigFile;
        isyslog("graphlcd plugin: No config file specified, using default (%s).\n", mConfigName.c_str());
    }
    if (GLCD::Config.Load(mConfigName) == false)
    {
        esyslog("graphlcd plugin: Error loading config file!\n");
        return false;
    }
    if (GLCD::Config.driverConfigs.size() > 0)
    {
        if (mDisplayName.length() > 0)
        {
            for (displayNumber = 0; displayNumber < GLCD::Config.driverConfigs.size(); displayNumber++)
            {
                if (GLCD::Config.driverConfigs[displayNumber].name == mDisplayName)
                    break;
            }
            if (displayNumber == GLCD::Config.driverConfigs.size())
            {
                esyslog("graphlcd plugin: ERROR: Specified display %s not found in config file!\n", mDisplayName.c_str());
                return false;
            }
        }
        else
        {
            isyslog("graphlcd plugin: WARNING: No display specified, using first one (%s).\n", GLCD::Config.driverConfigs[0].name.c_str());
            displayNumber = 0;
            mDisplayName = GLCD::Config.driverConfigs[0].name;
        }
    }
    else
    {
        esyslog("graphlcd plugin: ERROR: No displays specified in config file!\n");
        return false;
    }

    mLcd = GLCD::CreateDriver(GLCD::Config.driverConfigs[displayNumber].id, &GLCD::Config.driverConfigs[displayNumber]);
    if (!mLcd)
    {
        esyslog("graphlcd plugin: ERROR: Failed creating display object %s\n", mDisplayName.c_str());
        return false;
    }

    cfgDir = ConfigDirectory(kPluginName);
    if (!cfgDir)
        return false;

    mDisplay = new cGraphLCDDisplay();
    if (!mDisplay)
        return false;
    if (mSkinName == "")
        mSkinName = "default";
    if (!mDisplay->Initialise(mLcd, cfgDir, mSkinsPath, mSkinName))
        return false;

    return true;
}