Patch for dvdselect-0.7a

Message ID 431F5BB8.700@syphir.sytes.net
State New
Headers

Commit Message

C.Y.M Sept. 7, 2005, 9:29 p.m. UTC
  Here is a patch I have compiled from various sources for dvdselect-0.7a.

1) Fixes saving DVDOutputDir variable
2) Fixes compilation for vdr-1.3.18+
3) Prevent VDR locking up upon deleting large files by sending command to AT
4) Confirm deletion of ISOs
5) Reset link in /dev/dvd back to default upon vdr shutdown

Regards,
  

Patch

--- dvdselect-0.7a/config.c.orig	2004-05-20 17:17:06.000000000 -0700
+++ dvdselect-0.7a/config.c	2005-01-05 01:52:36.000000000 -0800
@@ -84,9 +84,10 @@ 
 void cMenuSetupDVDSelect::Store(void)
 {
   DVDSelectSetup = data;
-  SetupStore( "NameDevice", data.NameDevice);
-  SetupStore( "NameOrgDevice", data.NameOrgDevice);
-  SetupStore( "ImageDir",   data.ImageDir );
-  SetupStore( "DVDReadScript",   data.DVDReadScript );
-  SetupStore( "DVDWriteScript",   data.DVDWriteScript );
+  SetupStore( "NameDevice", data.NameDevice );
+  SetupStore( "NameOrgDevice", data.NameOrgDevice );
+  SetupStore( "ImageDir", data.ImageDir );
+  SetupStore( "DVDOutputDir", data.DVDOutputDir );
+  SetupStore( "DVDReadScript", data.DVDReadScript );
+  SetupStore( "DVDWriteScript", data.DVDWriteScript );
 }
--- dvdselect-0.7a/dvdselect.c.orig	2004-05-22 14:57:53.000000000 -0700
+++ dvdselect-0.7a/dvdselect.c	2005-09-07 11:09:18.000000000 -0700
@@ -21,6 +21,7 @@ 
 class cPluginDVDSelect : public cPlugin {
  private:
   // Add any member variables or functions you may need here.
+  void Reset(void);
  public:
   cPluginDVDSelect(void);
   virtual ~cPluginDVDSelect();
@@ -51,6 +52,7 @@ 
 {
   // Clean up after yourself!
   // none needed
+  Reset();
 }
 
 const char *cPluginDVDSelect::CommandLineHelp(void)
@@ -68,6 +70,7 @@ 
 {
   // Initialize any background activities the plugin shall perform.
   RegisterI18n(Phrases);
+  Reset();
   return true;
 }
 
@@ -100,4 +103,18 @@ 
     return DVDSelectSetup.SetupParse(Name, Value);
 }
 
+void cPluginDVDSelect::Reset(void)
+{
+  char *device = NULL;
+  char *orgDevice = NULL;
+  char *cmd = NULL;
+
+  asprintf(&device, "%s",DVDSelectSetup.NameDevice);
+  asprintf(&orgDevice, "%s",DVDSelectSetup.NameOrgDevice);
+  asprintf(&cmd, "ln -nfs '%s' '%s' 2> /dev/null", orgDevice, device);
+
+  esyslog(cmd);
+  system(cmd);
+}
+
 VDRPLUGINCREATOR(cPluginDVDSelect); // Don't touch this!
--- dvdselect-0.7a/menu.c.orig	2004-05-22 15:04:37.000000000 -0700
+++ dvdselect-0.7a/menu.c	2005-02-07 06:11:59.000000000 -0800
@@ -18,7 +18,7 @@ 
 
 #define SCRIPT_DVDWRITE_CMD      "%s '%s'"
 #define SCRIPT_DVDREAD_CMD      "%s '%s' '%s' '%s'"
-#define RMCMD      "rm '%s' 2> /dev/null"
+#define RMCMD      "echo \"rm '%s' 2> /dev/null\" | at now"
 #define MOUNTCMD      "ln -nfs '%s' '%s' 2> /dev/null"
 #define RESETCMD      "ln -nfs '%s' '%s' 2> /dev/null"
 
@@ -35,7 +35,12 @@ 
   FILE *p = popen(cmd, "r");
   if (p) {
     char *s;
+#if VDRVERSNUM >= 10318
+    cReadLine ReadLine;
+    while ( (s = ReadLine.Read(p) ) != NULL ) {
+#else
     while ((s = readline(p)) != NULL) {
+#endif
       Add(new cMenuDVDItem(s,DVDSelectSetup.ImageDir), &i);
     }//while
     pclose(p);
@@ -251,9 +256,11 @@ 
 
   cMenuDVDItem *item = (cMenuDVDItem*)Get(Current());
   if (item) {
+    if (Interface->Confirm(tr("Burn DVD?"))) {
     asprintf(&cmd, SCRIPT_DVDWRITE_CMD,DVDSelectSetup.DVDWriteScript,item->dateiname);
     esyslog(cmd);
     rc=system(cmd);
+    }
   }
 
   //Nach Scriptausf├╝hrung Men├╝ ausblenden,
@@ -263,7 +270,7 @@ 
 
 
 void cDVDList::SetHelp() {
-  cOsdMenu::SetHelp(tr("start"),tr("dvdwritescript"),tr("delete"),tr("reset"));
+  cOsdMenu::SetHelp(tr("start"),tr("burn"),tr("delete"),tr("reset"));
 }