bool cPluginMhp::Initialize(void) { // Initialize any background activities the plugin shall perform. /* //VDR loads plugins without the RTDL_GLOBAL flag in dlopen. //Dynamic modules dlopen'ed by the plugin, however, will link against symbols from //the plugin itself, so it is necessary to reload its symbols globally. //Needed by the MHPOutput module and Java native libraries. char *buffer = NULL; //from vdr/plugin.c asprintf(&buffer, "%s/%s%s%s%s", VDRPluginPath, LIBVDR_PREFIX, "mhp", SO_INDICATOR, VDRVERSION); if (!ownPlugin.Load(buffer)) { esyslog("MHP: Failed to re-open own dynamic object (this plugin)." "Remember to give the plugin the same \"-L\" option as VDR!"); printf("MHP: Failed to re-dlopen the dynamic object of this plugin.\n" "You have to give the plugin the same \"-L\" option as you specified on the command line for VDR!\n"); return false; } free(buffer); */ InitializeLocalApps(); if (Mhp::ConfigPath==0) { char *c; asprintf(&c, "%s%s", VideoDirectory, "/mhp"); Mhp::ConfigPath=c; } MakeDirs(Mhp::ConfigPath, true); if (!DirectoryOk(Mhp::ConfigPath, true)) esyslog("MHP: Config directory is not accessible. Settings will not be stored."); return true; }
bool cVideoDirectory::Next(void) { if (name) { if (number < 0) { int l = length; while (l-- > 0 && isdigit(name[l])) ; l++; digits = length - l; int n = atoi(&name[l]); if (n == 0) number = n; else return false; // base video directory must end with zero } if (++number > 0) { char buf[16]; if (sprintf(buf, "%0*d", digits, number) == digits) { strcpy(&name[length - digits], buf); return DirectoryOk(name); } } } return false; }
bool cPinPlugin::Initialize(void) { char* path; asprintf(&path, "%s/%s", cPlugin::ConfigDirectory(), "pin"); if (!DirectoryOk(path, no)) { if (mkdir(path, 0770)) { // cannot create the directory esyslog("Creating of directory '%s' failed, errno was (%d) - '%s'", path, errno, strerror(errno)); free(path); return true; // anyhow let vdr start } } free(path); lockedChannels.Load(AddDirectory(cPlugin::ConfigDirectory(), "pin/channellocks.conf"), true, false); lockedBroadcasts.Load(AddDirectory(cPlugin::ConfigDirectory(), "pin/broadcastlocks.conf"), true, false); lockedPlugins.Load(AddDirectory(cPlugin::ConfigDirectory(), "pin/pluginlocks.conf"), true, false); return true; }
bool cPluginDvdswitch::CheckError(void) { MYDEBUG("Fehlercheck"); MYDEBUG("Check ImageDir"); if(!DirectoryOk(DVDSwitchSetup.ImageDir)) { esyslog("ImageDir '%s' not readable or does not exist", DVDSwitchSetup.ImageDir); OSD_ERRMSG(tr("Image Directory not readable or does not exist")); return true; } MYDEBUG("Check DVD Plugin"); if(!cPluginManager::GetPlugin("xinemediaplayer")) { esyslog("DVDPlugin is not available!"); OSD_INFOMSG(tr("DVD-Plugin not found! Function deactivated!")); } else DVDSwitchSetup.HaveXinePlugin = true; return false; }
// returns path to nVid'th video directory or NULL if not existing char *cVideoDirectory::GetVidPath(int nVid) { char *b = strdup(VideoDirectory); int l = strlen(b), di, n; while (l-- > 0 && isdigit(b[ l ])); l++; di = strlen(b) - l; // di == number of digits n = atoi(&b[ l ]); if (n != 0) return NULL; // add requested number to dir name sprintf(&b[ l ], "%0*d", di, nVid); if (DirectoryOk(b) == true) return b; free(b); return NULL; }