summaryrefslogtreecommitdiff
path: root/recording.c
diff options
context:
space:
mode:
authorKlaus Schmidinger <vdr@tvdr.de>2010-01-02 14:02:48 +0100
committerKlaus Schmidinger <vdr@tvdr.de>2010-01-02 14:02:48 +0100
commitb5edaaa7ccb55ae13f197be2b40c8de460233fd4 (patch)
tree1a6f3d053256becd8f05286ca862afccf2b3b753 /recording.c
parent0faae7c3f04abc13049b1a526a3d05a36e28d014 (diff)
downloadvdr-b5edaaa7ccb55ae13f197be2b40c8de460233fd4.tar.gz
vdr-b5edaaa7ccb55ae13f197be2b40c8de460233fd4.tar.bz2
Implemented --edit and --genindex options
Diffstat (limited to 'recording.c')
-rw-r--r--recording.c33
1 files changed, 31 insertions, 2 deletions
diff --git a/recording.c b/recording.c
index 7fdb2244..41ad47aa 100644
--- a/recording.c
+++ b/recording.c
@@ -4,7 +4,7 @@
* See the main source file 'vdr.c' for copyright information and
* how to reach the author.
*
- * $Id: recording.c 2.20 2009/12/06 12:55:36 kls Exp $
+ * $Id: recording.c 2.21 2010/01/02 13:46:05 kls Exp $
*/
#include "recording.h"
@@ -674,7 +674,9 @@ cRecording::cRecording(const char *FileName)
deleted = 0;
titleBuffer = NULL;
sortBuffer = NULL;
- fileName = strdup(FileName);
+ FileName = fileName = strdup(FileName);
+ if (*(fileName + strlen(fileName) - 1) == '/')
+ *(fileName + strlen(fileName) - 1) = 0;
FileName += strlen(VideoDirectory) + 1;
const char *p = strrchr(FileName, '/');
@@ -1751,6 +1753,33 @@ void cIndexFile::Delete(void)
}
}
+bool GenerateIndex(const char *FileName)
+{
+ if (DirectoryOk(FileName)) {
+ cRecording Recording(FileName);
+ if (Recording.Name()) {
+ if (!Recording.IsPesRecording()) {
+ cString IndexFileName = AddDirectory(FileName, INDEXFILESUFFIX);
+ unlink(IndexFileName);
+ cIndexFileGenerator *IndexFileGenerator = new cIndexFileGenerator(FileName);
+ while (IndexFileGenerator->Active())
+ cCondWait::SleepMs(INDEXFILECHECKINTERVAL);
+ if (access(IndexFileName, R_OK) == 0)
+ return true;
+ else
+ fprintf(stderr, "cannot create '%s'\n", *IndexFileName);
+ }
+ else
+ fprintf(stderr, "'%s' is not a TS recording\n", FileName);
+ }
+ else
+ fprintf(stderr, "'%s' is not a recording\n", FileName);
+ }
+ else
+ fprintf(stderr, "'%s' is not a directory\n", FileName);
+ return false;
+}
+
// --- cFileName -------------------------------------------------------------
#define MAXFILESPERRECORDINGPES 255