Diskussion:Telecable-plugin

Aus VDR Wiki
Version vom 5. Mai 2005, 09:16 Uhr von 213.6.81.103 (Diskussion)

(Unterschied) ← Nächstältere Version | Aktuelle Version (Unterschied) | Nächstjüngere Version → (Unterschied)
Wechseln zu: Navigation, Suche

Wegen den bissel extra ein Plugin draus machen?

Das Script könnte man bequem via commands.conf ausführen lassen.

Villeicht kennen manche die commands.conf nicht, deshalb gibt es soviele Plugins. LOL

Das ist es:

/*
 * telecable.c: A plugin for the Video Disk Recorder
 *
 */

#include <getopt.h>
#include <stdlib.h>
#include <vdr/interface.h>
#include <vdr/plugin.h>
#include "i18n.h"

static const char *VERSION        = "0.1.0";
static const char *DESCRIPTION    = "Update TV programs";
static const char *MAINMENUENTRY  = "Update TV programs";
static const char *UPDATING  = "Updating TV programs, please wait...";


class cPluginTelecable : public cPlugin {
/*
private:
  // Add any member variables or functions you may need here.
  const char *option_a;
  bool option_b;
*/
public:
  cPluginTelecable(void);
  virtual ~cPluginTelecable();
  virtual const char *Version(void) { return VERSION; }
  virtual const char *Description(void) { return tr(DESCRIPTION); }
  virtual const char *CommandLineHelp(void);
  virtual bool ProcessArgs(int argc, char *argv[]);
  virtual bool Start(void);
  virtual void Housekeeping(void);
  virtual const char *MainMenuEntry(void) { return tr(MAINMENUENTRY); }
  virtual cOsdObject *MainMenuAction(void);
//  virtual cMenuSetupPage *SetupMenu(void);
//  virtual bool SetupParse(const char *Name, const char *Value);
  };



// --- cMenuSetupTelecable -------------------------------------------------------
/*
class cMenuSetupTelecable : public cMenuSetupPage {
private:
protected:
  virtual void Store(void);
public:
  cMenuSetupTelecable(void);
  };

cMenuSetupTelecable::cMenuSetupTelecable(void)
{
  newGreetingTime = GreetingTime;
  newUseAlternateGreeting = UseAlternateGreeting;
  Add(new cMenuEditIntItem( tr("Greeting time (s)"),      &newGreetingTime));
  Add(new cMenuEditBoolItem(tr("Use alternate greeting"), &newUseAlternateGreeting));
}

void cMenuSetupTelecable::Store(void)
{
  SetupStore("GreetingTime", GreetingTime = newGreetingTime);
  SetupStore("UseAlternateGreeting", UseAlternateGreeting = newUseAlternateGreeting);
}
*/
// --- cPluginTelecable ----------------------------------------------------------

cPluginTelecable::cPluginTelecable(void)
{
  // Initialize any member variables here.
  // DON'T DO ANYTHING ELSE THAT MAY HAVE SIDE EFFECTS, REQUIRE GLOBAL
  // VDR OBJECTS TO EXIST OR PRODUCE ANY OUTPUT!
/*
  option_a = NULL;
  option_b = false;
*/
}

cPluginTelecable::~cPluginTelecable()
{
  // Clean up after yourself!
}

const char *cPluginTelecable::CommandLineHelp(void)
{
  // Return a string that describes all known command line options.
  return "no CLI\n";
}

bool cPluginTelecable::ProcessArgs(int argc, char *argv[])
{
/*
  // Implement command line argument processing here if applicable.
  static struct option long_options[] = {
       { "aaa",      required_argument, NULL, 'a' },
       { "bbb",      no_argument,       NULL, 'b' },
       { NULL }
     };

  int c;
  while ((c = getopt_long(argc, argv, "a:b", long_options, NULL)) != -1) {
        switch (c) {
          case 'a': option_a = optarg;
                    break;
          case 'b': option_b = true;
                    break;
          default:  return false;
          }
        }
*/
  return true;
}

bool cPluginTelecable::Start(void)
{
  // Start any background activities the plugin shall perform.
  RegisterI18n(Phrases);
  return true;
}

void cPluginTelecable::Housekeeping(void)
{
  // Perform any cleanup or other regular tasks.
}

cOsdObject *cPluginTelecable::MainMenuAction(void)
{
  // Perform the action when selected from the main VDR menu.
  char sysCall[400];
  strcpy(sysCall,ConfigDirectory());
  strcat(sysCall,"/telecable/RunTelecable.sh ");
  strcat(sysCall,ConfigDirectory());
  strcat(sysCall," &");
  system(sysCall);
  Interface->Confirm( tr(UPDATING), 3);
  return NULL;
}

/*
cMenuSetupPage *cPluginTelecable::SetupMenu(void)
{
  // Return a setup menu in case the plugin supports one.
  return new cMenuSetupTelecable;
}

bool cPluginTelecable::SetupParse(const char *Name, const char *Value)
{
  // Parse your own setup parameters and store their values.
  if      (!strcasecmp(Name, "GreetingTime"))         GreetingTime = atoi(Value);
  else if (!strcasecmp(Name, "UseAlternateGreeting")) UseAlternateGreeting = atoi(Value);
  else
     return false;
  return true;
}
*/
VDRPLUGINCREATOR(cPluginTelecable); // Don't touch this!