From c0fa83065d9f190fa2b9e8e7e4df0b088514cdaf Mon Sep 17 00:00:00 2001 From: Klaus Schmidinger Date: Sun, 14 Jan 2001 15:29:51 +0100 Subject: [PATCH] Saving and restoring the current channel --- CONTRIBUTORS | 3 +++ HISTORY | 2 ++ config.c | 5 ++++- config.h | 3 ++- vdr.c | 6 ++++-- 5 files changed, 15 insertions(+), 4 deletions(-) diff --git a/CONTRIBUTORS b/CONTRIBUTORS index d94f88f2..ee44ada6 100644 --- a/CONTRIBUTORS +++ b/CONTRIBUTORS @@ -46,3 +46,6 @@ Miha Setina Alberto Carraro for translating the OSD texts to the Italian language. + +Deti Fliegl + for implementing the 'CurrentChannel' setup parameter. diff --git a/HISTORY b/HISTORY index 9fc79db9..26242c17 100644 --- a/HISTORY +++ b/HISTORY @@ -344,3 +344,5 @@ Video Disk Recorder Revision History and then renames it). - In case the video data stream is broken the log message will come only every 5 seconds. +- The current channel is now saved in the 'setup.conf' file when VDR is cancelled, + and will be restored next time it is started (thanks to Deti Fliegl). diff --git a/config.c b/config.c index a20c801b..5838c68c 100644 --- a/config.c +++ b/config.c @@ -4,7 +4,7 @@ * See the main source file 'vdr.c' for copyright information and * how to reach the author. * - * $Id: config.c 1.38 2001/01/13 15:36:31 kls Exp $ + * $Id: config.c 1.39 2001/01/14 15:29:15 kls Exp $ */ #include "config.h" @@ -724,6 +724,7 @@ cSetup::cSetup(void) MarginStart = 2; MarginStop = 10; EPGScanTimeout = 5; + CurrentChannel = -1; } bool cSetup::Parse(char *s) @@ -743,6 +744,7 @@ bool cSetup::Parse(char *s) else if (!strcasecmp(Name, "MarginStart")) MarginStart = atoi(Value); else if (!strcasecmp(Name, "MarginStop")) MarginStop = atoi(Value); else if (!strcasecmp(Name, "EPGScanTimeout")) EPGScanTimeout = atoi(Value); + else if (!strcasecmp(Name, "CurrentChannel")) CurrentChannel = atoi(Value); else return false; return true; @@ -795,6 +797,7 @@ bool cSetup::Save(const char *FileName) fprintf(f, "MarginStart = %d\n", MarginStart); fprintf(f, "MarginStop = %d\n", MarginStop); fprintf(f, "EPGScanTimeout = %d\n", EPGScanTimeout); + fprintf(f, "CurrentChannel = %d\n", CurrentChannel); f.Close(); isyslog(LOG_INFO, "saved setup to %s", FileName); return true; diff --git a/config.h b/config.h index 8f3cc77a..277e957e 100644 --- a/config.h +++ b/config.h @@ -4,7 +4,7 @@ * See the main source file 'vdr.c' for copyright information and * how to reach the author. * - * $Id: config.h 1.37 2001/01/13 14:56:29 kls Exp $ + * $Id: config.h 1.38 2001/01/14 15:29:27 kls Exp $ */ #ifndef __CONFIG_H @@ -268,6 +268,7 @@ public: int SetSystemTime; int MarginStart, MarginStop; int EPGScanTimeout; + int CurrentChannel; cSetup(void); bool Load(const char *FileName); bool Save(const char *FileName = NULL); diff --git a/vdr.c b/vdr.c index 6a87ab63..698cc7a6 100644 --- a/vdr.c +++ b/vdr.c @@ -22,7 +22,7 @@ * * The project's page is at http://www.cadsoft.de/people/kls/vdr * - * $Id: vdr.c 1.48 2000/12/25 09:43:08 kls Exp $ + * $Id: vdr.c 1.49 2001/01/14 15:29:51 kls Exp $ */ #include @@ -179,7 +179,7 @@ int main(int argc, char *argv[]) cDvbApi::SetPrimaryDvbApi(Setup.PrimaryDVB); - Channels.SwitchTo(1); + Channels.SwitchTo(Setup.CurrentChannel); cEITScanner EITScanner; @@ -312,6 +312,8 @@ int main(int argc, char *argv[]) } } isyslog(LOG_INFO, "caught signal %d", Interrupted); + Setup.CurrentChannel = cDvbApi::CurrentChannel(); + Setup.Save(); cVideoCutter::Stop(); delete Menu; delete ReplayControl;