summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKlaus Schmidinger <vdr@tvdr.de>2009-01-18 11:10:29 +0100
committerKlaus Schmidinger <vdr@tvdr.de>2009-01-18 11:10:29 +0100
commit3434f061b38c5d809a2fc6630e504cec2f0f093a (patch)
treeb7d36825a43064af0157deb1d60ce2406b349b99
parent3def525dc45f52a5e50f29f0106fe16dcd1b85c9 (diff)
downloadvdr-3434f061b38c5d809a2fc6630e504cec2f0f093a.tar.gz
vdr-3434f061b38c5d809a2fc6630e504cec2f0f093a.tar.bz2
Implemented option '-i'
-rw-r--r--CONTRIBUTORS2
-rw-r--r--HISTORY4
-rw-r--r--recording.c13
-rw-r--r--recording.h5
-rw-r--r--vdr.111
-rw-r--r--vdr.c12
6 files changed, 36 insertions, 11 deletions
diff --git a/CONTRIBUTORS b/CONTRIBUTORS
index 13692e0c..03d7cd99 100644
--- a/CONTRIBUTORS
+++ b/CONTRIBUTORS
@@ -2214,6 +2214,8 @@ Frank Schmirler <vdr@schmirler.de>
allowed characters
for fixing handling address masks in SVDRP host settings
for fixing handling the 'pointer field' in generating and parsing PAT/PMT
+ for suggesting to use an "instance id" instead of the "resume id" to distinguish
+ recordings of the same broadcast made by different instances of VDR
Jörn Reder <joern@zyn.de>
for reporting that a recording may unnecessarily block a device with a CAM, while
diff --git a/HISTORY b/HISTORY
index 84b8e43f..4bdad344 100644
--- a/HISTORY
+++ b/HISTORY
@@ -5939,3 +5939,7 @@ Video Disk Recorder Revision History
to Make.config.template (thanks to Johann Friedrichs for pointing this out).
Plugin authors should add this line to their Makefile or Make.config if they use
file access functions that need special versions for 64 bit offsets.
+- The new command line option -i can be used to set an "instance id", which will
+ be used to distinguish recordings of the same broadcast made by different instances
+ of VDR (suggested by Frank Schmirler). This replaces the use of the "resume id"
+ that was introduced in version 1.7.3.
diff --git a/recording.c b/recording.c
index fcd49554..4d60c17c 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.5 2009/01/16 15:55:18 kls Exp $
+ * $Id: recording.c 2.6 2009/01/18 11:02:09 kls Exp $
*/
#include "recording.h"
@@ -64,6 +64,7 @@
#define MAX_LINK_LEVEL 6
bool VfatFileSystem = false;
+int InstanceId = 0;
cRecordings DeletedRecordings(true);
@@ -602,7 +603,7 @@ cRecording::cRecording(cTimer *Timer, const cEvent *Event)
name = NULL;
fileSizeMB = -1; // unknown
channel = Timer->Channel()->Number();
- resumeId = Setup.ResumeID;
+ instanceId = InstanceId;
isPesRecording = false;
framesPerSecond = DEFAULTFRAMESPERSECOND;
deleted = 0;
@@ -659,7 +660,7 @@ cRecording::cRecording(const char *FileName)
resume = RESUME_NOT_INITIALIZED;
fileSizeMB = -1; // unknown
channel = -1;
- resumeId = -1;
+ instanceId = -1;
priority = MAXPRIORITY; // assume maximum in case there is no info file
lifetime = MAXLIFETIME;
isPesRecording = false;
@@ -678,7 +679,7 @@ cRecording::cRecording(const char *FileName)
struct tm tm_r;
struct tm t = *localtime_r(&now, &tm_r); // this initializes the time zone in 't'
t.tm_isdst = -1; // makes sure mktime() will determine the correct DST setting
- if (7 == sscanf(p + 1, DATAFORMATTS, &t.tm_year, &t.tm_mon, &t.tm_mday, &t.tm_hour, &t.tm_min, &channel, &resumeId)
+ if (7 == sscanf(p + 1, DATAFORMATTS, &t.tm_year, &t.tm_mon, &t.tm_mday, &t.tm_hour, &t.tm_min, &channel, &instanceId)
|| 7 == sscanf(p + 1, DATAFORMATPES, &t.tm_year, &t.tm_mon, &t.tm_mday, &t.tm_hour, &t.tm_min, &priority, &lifetime)) {
t.tm_year -= 1900;
t.tm_mon--;
@@ -688,7 +689,7 @@ cRecording::cRecording(const char *FileName)
strncpy(name, FileName, p - FileName);
name[p - FileName] = 0;
name = ExchangeChars(name, false);
- isPesRecording = resumeId < 0;
+ isPesRecording = instanceId < 0;
}
else
return;
@@ -827,7 +828,7 @@ const char *cRecording::FileName(void) const
struct tm *t = localtime_r(&start, &tm_r);
const char *fmt = isPesRecording ? NAMEFORMATPES : NAMEFORMATTS;
int ch = isPesRecording ? priority : channel;
- int ri = isPesRecording ? lifetime : resumeId;
+ int ri = isPesRecording ? lifetime : instanceId;
name = ExchangeChars(name, true);
fileName = strdup(cString::sprintf(fmt, VideoDirectory, name, t->tm_year + 1900, t->tm_mon + 1, t->tm_mday, t->tm_hour, t->tm_min, ch, ri));
name = ExchangeChars(name, false);
diff --git a/recording.h b/recording.h
index a1d497d7..3a9b7154 100644
--- a/recording.h
+++ b/recording.h
@@ -4,7 +4,7 @@
* See the main source file 'vdr.c' for copyright information and
* how to reach the author.
*
- * $Id: recording.h 2.1 2009/01/06 10:49:59 kls Exp $
+ * $Id: recording.h 2.2 2009/01/18 11:02:00 kls Exp $
*/
#ifndef __RECORDING_H
@@ -19,6 +19,7 @@
#include "tools.h"
extern bool VfatFileSystem;
+extern int InstanceId;
void RemoveDeletedRecordings(void);
void AssertFreeDiskSpace(int Priority = 0, bool Force = false);
@@ -82,7 +83,7 @@ private:
mutable char *name;
mutable int fileSizeMB;
int channel;
- int resumeId;
+ int instanceId;
bool isPesRecording;
double framesPerSecond;
cRecordingInfo *info;
diff --git a/vdr.1 b/vdr.1
index 8510610c..3df16847 100644
--- a/vdr.1
+++ b/vdr.1
@@ -8,7 +8,7 @@
.\" License as specified in the file COPYING that comes with the
.\" vdr distribution.
.\"
-.\" $Id: vdr.1 1.33 2008/03/09 16:07:06 kls Exp $
+.\" $Id: vdr.1 2.1 2009/01/18 11:05:56 kls Exp $
.\"
.TH vdr 1 "10 Feb 2008" "1.6" "Video Disk Recorder"
.SH NAME
@@ -71,6 +71,15 @@ grabbing images to disk is disabled.
.B \-h, \-\-help
Print a help message and exit.
.TP
+.BI \-i\ instance ,\ \-\-instance= instance
+Use \fIinstance\fR as the id of this VDR instance (default is 0).
+In an environment where several instances of VDR use the same video
+directory, this parameter can be set to a positive integer value
+that's unique for each instance, so that they won't interfere with
+each other in case they record exactly the same broadcast.
+The number given here will be part of the directory name in which
+the recordings will be stored.
+.TP
.BI \-l\ level ,\ \-\-log= level
Set logging to \fIlevel\fR.
\fB0\fR\ =\ no logging, \fB1\fR\ =\ errors only,
diff --git a/vdr.c b/vdr.c
index fa36b881..34ad856f 100644
--- a/vdr.c
+++ b/vdr.c
@@ -22,7 +22,7 @@
*
* The project's page is at http://www.cadsoft.de/vdr
*
- * $Id: vdr.c 2.3 2008/09/06 14:08:44 kls Exp $
+ * $Id: vdr.c 2.4 2009/01/18 11:02:37 kls Exp $
*/
#include <getopt.h>
@@ -223,6 +223,7 @@ int main(int argc, char *argv[])
{ "epgfile", required_argument, NULL, 'E' },
{ "grab", required_argument, NULL, 'g' },
{ "help", no_argument, NULL, 'h' },
+ { "instance", required_argument, NULL, 'i' },
{ "lib", required_argument, NULL, 'L' },
{ "lirc", optional_argument, NULL, 'l' | 0x100 },
{ "localedir",required_argument, NULL, 'l' | 0x200 },
@@ -245,7 +246,7 @@ int main(int argc, char *argv[])
};
int c;
- while ((c = getopt_long(argc, argv, "a:c:dD:E:g:hl:L:mp:P:r:s:t:u:v:Vw:", long_options, NULL)) != -1) {
+ while ((c = getopt_long(argc, argv, "a:c:dD:E:g:hi:l:L:mp:P:r:s:t:u:v:Vw:", long_options, NULL)) != -1) {
switch (c) {
case 'a': AudioCommand = optarg;
break;
@@ -268,6 +269,13 @@ int main(int argc, char *argv[])
break;
case 'h': DisplayHelp = true;
break;
+ case 'i': if (isnumber(optarg)) {
+ InstanceId = atoi(optarg);
+ if (InstanceId >= 0)
+ break;
+ }
+ fprintf(stderr, "vdr: invalid instance id: %s\n", optarg);
+ return 2;
case 'l': {
char *p = strchr(optarg, '.');
if (p)