diff options
author | Klaus Schmidinger <vdr@tvdr.de> | 2018-02-13 09:33:41 +0100 |
---|---|---|
committer | Klaus Schmidinger <vdr@tvdr.de> | 2018-02-13 09:33:41 +0100 |
commit | 3090d8146fb9cbd2267f97e604bc3c376325686a (patch) | |
tree | 33d063b1c0bfda84ed5f0ceb8b92b2a500b554f9 /recording.c | |
parent | 78831a72d540444a3c2dc733d1c563c9f0788810 (diff) | |
download | vdr-3090d8146fb9cbd2267f97e604bc3c376325686a.tar.gz vdr-3090d8146fb9cbd2267f97e604bc3c376325686a.tar.bz2 |
Implemented storing timer id in .timer
Diffstat (limited to 'recording.c')
-rw-r--r-- | recording.c | 40 |
1 files changed, 38 insertions, 2 deletions
diff --git a/recording.c b/recording.c index 3a6ec4ff..9cd47687 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 4.19 2018/02/10 13:24:04 kls Exp $ + * $Id: recording.c 4.20 2018/02/13 08:44:19 kls Exp $ */ #include "recording.h" @@ -57,6 +57,7 @@ #define MARKSFILESUFFIX "/marks" #define SORTMODEFILE ".sort" +#define TIMERRECFILE ".timer" #define MINDISKSPACE 1024 // MB @@ -117,7 +118,7 @@ void cRemoveDeletedRecordingsThread::Action(void) r = DeletedRecordings->Next(r); } if (deleted) { - const char *IgnoreFiles[] = { SORTMODEFILE, NULL }; + const char *IgnoreFiles[] = { SORTMODEFILE, TIMERRECFILE, NULL }; cVideoDirectory::RemoveEmptyVideoDirectories(IgnoreFiles); } } @@ -3122,3 +3123,38 @@ void IncRecordingsSortMode(const char *Directory) RecordingsSortMode = eRecordingsSortMode(0); SetRecordingsSortMode(Directory, RecordingsSortMode); } + +// --- Recording Timer Indicator --------------------------------------------- + +void SetRecordingTimerId(const char *Directory, const char *TimerId) +{ + cString FileName = AddDirectory(Directory, TIMERRECFILE); + if (TimerId) { + dsyslog("writing timer id '%s' to %s", TimerId, *FileName); + if (FILE *f = fopen(FileName, "w")) { + fprintf(f, "%s\n", TimerId); + fclose(f); + } + else + LOG_ERROR_STR(*FileName); + } + else { + dsyslog("removing %s", *FileName); + unlink(FileName); + } +} + +cString GetRecordingTimerId(const char *Directory) +{ + cString FileName = AddDirectory(Directory, TIMERRECFILE); + const char *Id = NULL; + if (FILE *f = fopen(FileName, "r")) { + char buf[HOST_NAME_MAX + 10]; // +10 for numeric timer id and '@' + if (fgets(buf, sizeof(buf), f)) { + stripspace(buf); + Id = buf; + } + fclose(f); + } + return Id; +} |