From 55141b21b3b6c937614009f76b8340e42a0f50af Mon Sep 17 00:00:00 2001 From: Jochen Dolze Date: Sat, 16 Apr 2011 13:05:31 +0200 Subject: Disabling pre-/post timer on live recordings Prevent overwriting logfiles when two instances start on same recording New logo for Sat1Comedy Changed logo for Puls4 Austria Changed logo for ComedyCentral (still bad) --- command/markad-standalone.cpp | 42 ++++++++++++++++++++++++------------------ 1 file changed, 24 insertions(+), 18 deletions(-) (limited to 'command/markad-standalone.cpp') diff --git a/command/markad-standalone.cpp b/command/markad-standalone.cpp index 1ec9b7a..4096477 100644 --- a/command/markad-standalone.cpp +++ b/command/markad-standalone.cpp @@ -1929,7 +1929,7 @@ bool cMarkAdStandalone::CreatePidfile() if (stat(procname,&statbuf)!=-1) { // found another, running markad - isyslog("another instance is running on this recording"); + fprintf(stderr,"another instance is running on %s",directory); abort=duplicate=true; } } @@ -2020,6 +2020,23 @@ cMarkAdStandalone::cMarkAdStandalone(const char *Directory, const MarkAdConfig * macontext.Info.DPid.Type=MARKAD_PIDTYPE_AUDIO_AC3; macontext.Info.APid.Type=MARKAD_PIDTYPE_AUDIO_MP2; + if (!config->NoPid) + { + CreatePidfile(); + if (abort) return; + } + + if (LOG2REC) + { + char *fbuf; + if (asprintf(&fbuf,"%s/markad.log",directory)!=-1) + { + if (freopen(fbuf,"w+",stdout)) {}; + SetFileUID(fbuf); + free(fbuf); + } + } + isyslog("starting v%s",VERSION); isyslog("on %s",Directory); @@ -2041,14 +2058,14 @@ cMarkAdStandalone::cMarkAdStandalone(const char *Directory, const MarkAdConfig * bDecodeVideo=true; } - if (!config->NoPid) + if (config->Before) sleep(10); + + if (strstr(directory,"/@")) { - CreatePidfile(); - if (abort) return; + isyslog("live-recording, disabling pre-/post timer"); + bIgnoreTimerInfo=true; } - if (config->Before) sleep(10); - if (!CheckTS()) return; if (isTS) @@ -2206,7 +2223,7 @@ cMarkAdStandalone::~cMarkAdStandalone() etime,framecnt,framecnt2,ftime,ptime); } - if (osd) + if ((osd) && (!duplicate)) { if (abort) { @@ -2926,17 +2943,6 @@ int main(int argc, char *argv[]) signal(SIGTSTP, signal_handler); signal(SIGCONT, signal_handler); - if (LOG2REC) - { - char *fbuf; - if (asprintf(&fbuf,"%s/markad.log",recDir)!=-1) - { - if (freopen(fbuf,"w+",stdout)) {}; - if (chown(fbuf,statbuf.st_uid, statbuf.st_gid)) {}; - free(fbuf); - } - } - cmasta = new cMarkAdStandalone(recDir,&config); if (!cmasta) return -1; -- cgit v1.2.3