Mailing List archive

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

[vdr] rename cuttings patch



hi,

for those who are interested, here's a small patch that modifies vdr to use
new names for each cutting, instead of overwriting the previous "%":

cu,
daniel

icebook ~ $ cat vdr-1.1.29-rename_cuttings.patch
diff -Naur vdr-1.1.29/recording.c vdr-1.1.29-patched/recording.c
--- vdr-1.1.29/recording.c      Sat Apr 12 11:51:44 2003
+++ vdr-1.1.29-patched/recording.c      Wed Apr 30 19:33:05 2003
@@ -533,13 +533,20 @@

 const char *cRecording::PrefixFileName(char Prefix)
 {
-  const char *p = PrefixVideoFileName(FileName(), Prefix);
-  if (p) {
-     free(fileName);
-     fileName = strdup(p);
-     return fileName;
-     }
-  return NULL;
+  while(1)
+  {
+    const char *p = PrefixVideoFileName(FileName(), Prefix);
+    if (p) {
+       free(fileName);
+       fileName = strdup(p);
+    }
+    else return NULL;
+
+    // check if name already exists, add prefix again if so
+    struct stat fs;
+    if (stat(fileName, &fs) == 0 ) continue;
+    return fileName;
+  }
 }

 int cRecording::HierarchyLevels(void)

-- 
                        --- unix _is_ user-friendly ---
                  --- it just decides who his friends are ---


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



Home | Main Index | Thread Index