summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authoranbr <vdr07@deltab.de>2011-01-17 20:04:01 +0100
committeranbr <vdr07@deltab.de>2011-01-17 20:04:01 +0100
commitdf5b0f99465e049819fa5f200dffea467e64cce8 (patch)
tree8576b60e5f718f9b5ba8d987313d287b97dd8923
parentfe18f7e3c3294e2b9b772070896c9f96184f86a5 (diff)
downloadvdr-plugin-dvdswitch-df5b0f99465e049819fa5f200dffea467e64cce8.tar.gz
vdr-plugin-dvdswitch-df5b0f99465e049819fa5f200dffea467e64cce8.tar.bz2
Add missing base link (revert bug from commit:63370045)
-rw-r--r--dvdplugin.c24
-rw-r--r--dvdplugin.h6
-rw-r--r--dvdswitch.c1
-rw-r--r--setup.h6
-rw-r--r--tools.c2
5 files changed, 22 insertions, 17 deletions
diff --git a/dvdplugin.c b/dvdplugin.c
index 0579238..498a068 100644
--- a/dvdplugin.c
+++ b/dvdplugin.c
@@ -5,7 +5,7 @@
#include "imagelist.h"
#include "dvdplugin.h"
-cDVDPluginThread::cDVDPluginThread(char *image)
+cDVDPluginThread::cDVDPluginThread(const char *image)
:cThread("DVDPluginThread")
{
dsyslog("dvdswitch: Create new DVD Thread");
@@ -24,11 +24,10 @@ void cDVDPluginThread::Action(void)
{
dsyslog("dvdswitch: DVD Thread started");
if(Image)
- cDVDPlugin::ChangeLink(Image);
+ cDVDPlugin::ChangeLink(Image, DVDSwitchSetup.DVDLink);
#if VDRVERSNUM < 10332
cPlugin *plugin = cPluginManager::GetPlugin("dvd");
-
if(plugin)
{
plugin->MainMenuAction();
@@ -41,7 +40,7 @@ void cDVDPluginThread::Action(void)
cCondWait::SleepMs(2 * 1000);
cControl *control = cControl::Control();
- dsyslog(control ? "DVD control found" : "DVD control not found");
+ dsyslog("dvdswitch: DVD control %s",control ? "found" : "not found");
while(control)
{
cCondWait::SleepMs(5 * 1000);
@@ -50,7 +49,7 @@ void cDVDPluginThread::Action(void)
dsyslog("dvdswitch: DVD control closed");
if(Image)
- cDVDPlugin::ChangeLink(DVDSwitchSetup.DVDLinkOrg);
+ cDVDPlugin::ChangeLink(DVDSwitchSetup.DVDLinkOrg, DVDSwitchSetup.DVDLink);
dsyslog("dvdswitch: DVD Thread closed");
cDVDPlugin::Exit();
@@ -136,7 +135,6 @@ void cDVDPlugin::SetLink(void)
if(0 < asprintf(&argv[1], "--dvd=%s", DVDSwitchSetup.DVDLink)) {
cPlugin *plugin = cPluginManager::GetPlugin("dvd");
-
if(plugin)
{
optind = 0; //reset for getopt
@@ -164,20 +162,20 @@ void cDVDPlugin::Exit(void)
DELETENULL(thread);
}
-void cDVDPlugin::ChangeLink(char *target)
+void cDVDPlugin::ChangeLink(const char *target,const char *link)
{
- if(target)
+ if(target && link)
{
- isyslog("dvdswitch: create link %s to %s", DVDSwitchSetup.DVDLink, target);
+ isyslog("dvdswitch: create link %s to %s", link, target);
- if(-1 == unlink(DVDSwitchSetup.DVDLink) && errno != ENOENT) {
+ if(-1 == unlink(link) && errno != ENOENT) {
char* szErr = get_strerror(errno);
- esyslog("dvdswitch: could not remove symbolic link %s : %s (%d)", DVDSwitchSetup.DVDLink, szErr ? szErr : "", errno);
+ esyslog("dvdswitch: could not remove symbolic link %s : %s (%d)", link, szErr ? szErr : "", errno);
if(szErr) free(szErr);
}
- if(-1 == symlink(target, DVDSwitchSetup.DVDLink)) {
+ if(-1 == symlink(target, link)) {
char* szErr = get_strerror(errno);
- esyslog("dvdswitch: could not create link %s to %s :%s (%d)", DVDSwitchSetup.DVDLink, target, szErr ? szErr : "", errno);
+ esyslog("dvdswitch: could not create link %s to %s :%s (%d)", link, target, szErr ? szErr : "", errno);
if(szErr) free(szErr);
}
}
diff --git a/dvdplugin.h b/dvdplugin.h
index e7ff69f..499093e 100644
--- a/dvdplugin.h
+++ b/dvdplugin.h
@@ -12,7 +12,7 @@ class cDVDPluginThread : public cThread
protected:
virtual void Action(void);
public:
- cDVDPluginThread(char *image = NULL);
+ cDVDPluginThread(const char *image = NULL);
~cDVDPluginThread(void);
};
@@ -29,11 +29,11 @@ class cDVDPlugin
public:
static void Start(char *image = NULL);
static void Exit(void);
- static void ChangeLink(char *target);
+ static void ChangeLink(const char *target, const char *link);
static void Init(void)
{
DetectDevice();
- ChangeLink(DVDSwitchSetup.DVDLinkOrg);
+ ChangeLink(DVDSwitchSetup.DVDLinkOrg, DVDSwitchSetup.DVDLink);
SetLink();
}
static void Finish(void)
diff --git a/dvdswitch.c b/dvdswitch.c
index bc2393e..e083576 100644
--- a/dvdswitch.c
+++ b/dvdswitch.c
@@ -81,6 +81,7 @@ bool cPluginDvdswitch::Initialize(void)
// Initialize any background activities the plugin shall perform.
dsyslog("dvdswitch: Initialize plugin");
+ DVDSwitchSetup.SetConfDir(ConfigDirectory(Name()));
cDVDPlugin::Init();
ImageList.Init();
DVDSwitchSetup.Init();
diff --git a/setup.h b/setup.h
index 582c318..8446b75 100644
--- a/setup.h
+++ b/setup.h
@@ -61,6 +61,12 @@ class cDVDSwitchSetup
void Init(void);
bool SetupParse(const char *Name, const char *Value, cImageList &ImageList);
+ void SetConfDir(const char *value)
+ {
+ strncpy(DVDLink, value, memberof(DVDLink));
+ strncat(DVDLink, "/dvdlink", memberof(DVDLink));
+ }
+
void SetDVDDevice(const char *value) { strncpy(DVDLinkOrg, value, memberof(DVDLinkOrg)); }
bool ProcessArgs(int argc, char *argv[]);
diff --git a/tools.c b/tools.c
index 59f7df9..b040e1b 100644
--- a/tools.c
+++ b/tools.c
@@ -139,7 +139,7 @@ void cFileMoveThread::Action(void)
errno = 0;
if(!cFileCMD::Rn(File, buffer)) {
char* err = get_strerror(errno);
- esyslog("dvdswitch: could not move file failed %s to %s :%s", File, buffer, err ? err : "");
+ esyslog("dvdswitch: could not move file %s to %s :%s", File, buffer, err ? err : "");
if(err) free(err);
}
free(buffer);