bool cPluginRestfulapi::Start(void) { // Start any background activities the plugin shall perform. Settings* settings = Settings::get(); std::string headers = "activated"; if ( settings->Headers() == false ) { headers = "deactivated"; } esyslog("restfulapi: Used settings: port: %i, ip: %s, eimgs: %s, cimgs: %s, headers: %s", settings->Port(), settings->Ip().c_str(), settings->EpgImageDirectory().c_str(), settings->ChannelLogoDirectory().c_str(), headers.c_str()); FileCaches::get(); //cache files serverThread.Initialize(); serverThread.Start(); return true; }
bool cPluginRestfulapi::ProcessArgs(int argc, char *argv[]) { Settings* settings = Settings::get(); esyslog("restfulapi: trying to parse command line arguments"); static struct option long_options[] = { { "port", required_argument, NULL, 'p' }, { "ip", required_argument, NULL, 'i' }, { "epgimages", required_argument, NULL, 'e' }, { "channellogos", required_argument, NULL, 'c' }, { "headers", required_argument, NULL, 'h' } }; int optchar, optind = 0; while ( ( optchar = getopt_long( argc, argv, "p:i:e:c:h:", long_options, &optind ) ) != -1 ) { switch ( optchar ) { case 'p': settings->SetPort((std::string)optarg); break; case 'i': settings->SetIp((std::string)optarg); break; case 'e': settings->SetEpgImageDirectory((std::string)optarg); break; case 'c': settings->SetChannelLogoDirectory((std::string)optarg); break; case 'h': settings->SetHeaders((std::string)optarg); break; }; } std::string headers = "activated"; if ( settings->Headers() == false ) { headers = "deactivated"; } esyslog("RESTful-API Settings: port: %i, ip: %s, eimgs: %s, cimgs: %si, headers: %s", settings->Port(), settings->Ip().c_str(), settings->EpgImageDirectory().c_str(), settings->ChannelLogoDirectory().c_str(), headers.c_str()); return true; }