Mailing List archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[vdr] Re: PATCH: Replay vdr recordings from CD/DVD



On Tuesday 22 April 2003 19:16, Andreas Kool wrote:
> -- Binary/unsupported file stripped by Listar --
> -- Type: text/x-diff
> -- File: vdr-1.1.28.patch

Ok Listar, here is my answer:

diff -ub vdr-1.1.27.orig/recording.c vdr-1.1.27/recording.c
--- vdr-1.1.27.orig/recording.c Sat Apr 12 11:51:44 2003
+++ vdr-1.1.27/recording.c      Tue Apr 15 12:59:20 2003
@@ -43,6 +43,7 @@
 // end of implementation for brain dead systems

 #define RESUMEFILESUFFIX  "/resume%s%s.vdr"
+#define CDCACHEPREFIX    "/tmp/cache.vdr"
 #define SUMMARYFILESUFFIX "/summary.vdr"
 #define MARKSFILESUFFIX   "/marks.vdr"

@@ -151,6 +152,29 @@

 cResumeFile::cResumeFile(const char *FileName)
 {
+  char fn[1024];
+  int  f, l;
+
+  sprintf(fn, "%s/testfile", FileName);
+
+  f = open(fn, O_WRONLY | O_CREAT);
+  isReadOnly = ((f < 0) && (errno == EROFS));
+
+  if (isReadOnly) {
+    fileName = MALLOC(char, strlen(FileName) + strlen(RESUMEFILESUFFIX) + 
strlen(CDCACHEPREFIX) + 1);
+    if (fileName) {
+      l = sprintf(fileName, "%s/%s", CDCACHEPREFIX, FileName);
+      sprintf(fileName + l, RESUMEFILESUFFIX, Setup.ResumeID ? "." : "", 
Setup.ResumeID ? itoa(Setup.ResumeID) : "");
+      MakeDirs(fileName, false);
+    }
+    else
+      esyslog("ERROR: can't allocate memory for resume file name");
+
+  }
+  else {
+    close(f);
+    unlink(fn);
+
   fileName = MALLOC(char, strlen(FileName) + strlen(RESUMEFILESUFFIX) + 1);
   if (fileName) {
      strcpy(fileName, FileName);
@@ -158,6 +182,7 @@
      }
   else
      esyslog("ERROR: can't allocate memory for resume file name");
+  }
 }

 cResumeFile::~cResumeFile()
diff -ub vdr-1.1.27.orig/recording.h vdr-1.1.27/recording.h
--- vdr-1.1.27.orig/recording.h Sat Oct 19 17:48:52 2002
+++ vdr-1.1.27/recording.h      Tue Apr 15 12:24:05 2003
@@ -21,6 +21,7 @@
 class cResumeFile {
 private:
   char *fileName;
+  bool  isReadOnly;
 public:
   cResumeFile(const char *FileName);
   ~cResumeFile();

Ciao,
Andreas
-- 
Andreas Kool (akool<nospam>@</nospam>akool.de * http://www.akool.de)
PGP: 3FBF2411 Fingerprint: B5 35 34 74 25 60 2A 7A  89 06 92 C4 08 BA A5 BD

Transmission of this message via the Microsoft Network is prohibited



-- 
Info:
To unsubscribe send a mail to listar@linuxtv.org with "unsubscribe vdr" as subject.



Home | Main Index | Thread Index