From 13edfc13820efc784c08b7b93e73f34a73c1e80e Mon Sep 17 00:00:00 2001 From: Klaus Schmidinger Date: Sat, 1 Sep 2012 14:03:45 +0200 Subject: Implemented FHS support; fixed handling config directory if only -v is given --- PLUGINS.html | 72 ++++++++++++++++++++++++++++++++++++++++++++---------------- 1 file changed, 53 insertions(+), 19 deletions(-) (limited to 'PLUGINS.html') diff --git a/PLUGINS.html b/PLUGINS.html index a7a0a9d2..859ca705 100644 --- a/PLUGINS.html +++ b/PLUGINS.html @@ -82,7 +82,7 @@ structures and allows it to hook itself into specific areas to perform special a
  • Wakeup
  • Setup parameters
  • The Setup menu -
  • Configuration files +
  • Additional files
  • Internationalization
  • Custom services
  • SVDRP commands @@ -885,39 +885,70 @@ You can first assign the temporary values to the global variables and then do th your setup parameters and use that one to copy all parameters with one single statement (like VDR does with its cSetup class). -

    Configuration files

    +

    Additional files

    I want my own stuff!

    -There may be situations where a plugin requires configuration files of its own, maybe -for data that can't be stored in the simple setup parameters -of VDR, or maybe because it needs to launch other programs that simply need a separate -configuration file. While the plugin is free to store such files anywhere it -sees fit, it might be a good idea to put them in a common place, preferably -where other configuration data already exists. VDR provides the function + +There may be situations where a plugin requires files of its own. While the plugin is +free to store such files anywhere it sees fit, it might be a good idea to put them in a common +place, preferably where such data already exists. + +

    + +configuration files, maybe for data that can't be stored in the simple +setup parameters of VDR, or maybe because it needs to +launch other programs that simply need a separate configuration file. + +

    + +cache files, to store data so that future requests for that data can be served faster. The data +that is stored within a cache might be values that have been computed earlier or duplicates of +original values that are stored elsewhere. + +

    + +resource files, for providing additional files, like pictures, movie clips or channel logos. + +

    + +Threfore VDR provides the functions

    +
     const char *ConfigDirectory(const char *PluginName = NULL);
    +const char *CacheDirectory(const char *PluginName = NULL);
    +const char *ResourceDirectory(const char *PluginName = NULL);
    +
     

    -which returns a string containing the directory that VDR uses for its own configuration -files (defined through the -c option in the call to VDR), extended by + +each of which returns a string containing the directory that VDR uses for its own +files (defined through the options in the call to VDR), extended by + "/plugins". So assuming the VDR configuration directory is /video (the default if no -c or -v option is given), a call to ConfigDirectory() will return /video/plugins. The first call to ConfigDirectory() will automatically make sure that the plugins subdirectory will exist. If, for some reason, this cannot be achieved, NULL will be returned. + +The behavoir of CacheDirectory() and ResourceDirectory() is similar. +

    The additional plugins directory is used to keep files from plugins apart from those of VDR itself, making sure there will be no name clashes. If a plugin -needs only one extra configuration file, it is suggested that this file be named -name.conf, where name shall be the name of the plugin. + +needs only one extra file, it is suggested that this file be named name.*, +where name shall be the name of the plugin. +

    If a plugin needs more than one such file, it is suggested that the plugin stores these in a subdirectory of its own, named after the plugin. To easily get such a name -the ConfigDirectory() function can be given an additional string that will -be appended to the returned directory name, as in + +the functions can be given an additional string that will be appended to the returned +directory name, as in +

     const char *MyConfigDir = ConfigDirectory(Name());
    @@ -928,13 +959,16 @@ plugin's name. Again, VDR will make sure that the requested directory will exist
     (or return NULL in case of an error).
     

    -The returned string is statically allocated and will be overwritten by subsequent -calls to ConfigDirectory()! + +The returned strings are statically allocated and will be overwritten by subsequent calls! +

    -The ConfigDirectory() function is a static member function of the cPlugin -class. This allows it to be called even from outside any member function of the derived -plugin class, by writing + +The ConfigDirectory(), CacheDirectory() and ResourceDirectory() +functions are static member functions of the cPlugin class. This allows them to be +called even from outside any member function of the derived plugin class, by writing +

     const char *MyConfigDir = cPlugin::ConfigDirectory();
    -- 
    cgit v1.2.3