mirror of
				https://github.com/vdr-projects/vdr.git
				synced 2025-03-01 10:50:46 +00:00 
			
		
		
		
	Saving and restoring the current channel
This commit is contained in:
		| @@ -46,3 +46,6 @@ Miha Setina <mihasetina@softhome.net> | |||||||
|  |  | ||||||
| Alberto Carraro <bertocar@tin.it> | Alberto Carraro <bertocar@tin.it> | ||||||
|  for translating the OSD texts to the Italian language. |  for translating the OSD texts to the Italian language. | ||||||
|  |  | ||||||
|  | Deti Fliegl <deti@fliegl.de> | ||||||
|  |  for implementing the 'CurrentChannel' setup parameter. | ||||||
|   | |||||||
							
								
								
									
										2
									
								
								HISTORY
									
									
									
									
									
								
							
							
						
						
									
										2
									
								
								HISTORY
									
									
									
									
									
								
							| @@ -344,3 +344,5 @@ Video Disk Recorder Revision History | |||||||
|   and then renames it). |   and then renames it). | ||||||
| - In case the video data stream is broken the log message will come only every | - In case the video data stream is broken the log message will come only every | ||||||
|   5 seconds. |   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). | ||||||
|   | |||||||
							
								
								
									
										5
									
								
								config.c
									
									
									
									
									
								
							
							
						
						
									
										5
									
								
								config.c
									
									
									
									
									
								
							| @@ -4,7 +4,7 @@ | |||||||
|  * See the main source file 'vdr.c' for copyright information and |  * See the main source file 'vdr.c' for copyright information and | ||||||
|  * how to reach the author. |  * 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" | #include "config.h" | ||||||
| @@ -724,6 +724,7 @@ cSetup::cSetup(void) | |||||||
|   MarginStart = 2; |   MarginStart = 2; | ||||||
|   MarginStop = 10; |   MarginStop = 10; | ||||||
|   EPGScanTimeout = 5; |   EPGScanTimeout = 5; | ||||||
|  |   CurrentChannel = -1; | ||||||
| } | } | ||||||
|  |  | ||||||
| bool cSetup::Parse(char *s) | 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, "MarginStart"))         MarginStart        = atoi(Value); | ||||||
|      else if (!strcasecmp(Name, "MarginStop"))          MarginStop         = atoi(Value); |      else if (!strcasecmp(Name, "MarginStop"))          MarginStop         = atoi(Value); | ||||||
|      else if (!strcasecmp(Name, "EPGScanTimeout"))      EPGScanTimeout     = atoi(Value); |      else if (!strcasecmp(Name, "EPGScanTimeout"))      EPGScanTimeout     = atoi(Value); | ||||||
|  |      else if (!strcasecmp(Name, "CurrentChannel"))      CurrentChannel     = atoi(Value); | ||||||
|      else |      else | ||||||
|         return false; |         return false; | ||||||
|      return true; |      return true; | ||||||
| @@ -795,6 +797,7 @@ bool cSetup::Save(const char *FileName) | |||||||
|         fprintf(f, "MarginStart        = %d\n", MarginStart); |         fprintf(f, "MarginStart        = %d\n", MarginStart); | ||||||
|         fprintf(f, "MarginStop         = %d\n", MarginStop); |         fprintf(f, "MarginStop         = %d\n", MarginStop); | ||||||
|         fprintf(f, "EPGScanTimeout     = %d\n", EPGScanTimeout); |         fprintf(f, "EPGScanTimeout     = %d\n", EPGScanTimeout); | ||||||
|  |         fprintf(f, "CurrentChannel     = %d\n", CurrentChannel); | ||||||
|         f.Close(); |         f.Close(); | ||||||
|         isyslog(LOG_INFO, "saved setup to %s", FileName); |         isyslog(LOG_INFO, "saved setup to %s", FileName); | ||||||
|         return true; |         return true; | ||||||
|   | |||||||
							
								
								
									
										3
									
								
								config.h
									
									
									
									
									
								
							
							
						
						
									
										3
									
								
								config.h
									
									
									
									
									
								
							| @@ -4,7 +4,7 @@ | |||||||
|  * See the main source file 'vdr.c' for copyright information and |  * See the main source file 'vdr.c' for copyright information and | ||||||
|  * how to reach the author. |  * 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 | #ifndef __CONFIG_H | ||||||
| @@ -268,6 +268,7 @@ public: | |||||||
|   int SetSystemTime; |   int SetSystemTime; | ||||||
|   int MarginStart, MarginStop; |   int MarginStart, MarginStop; | ||||||
|   int EPGScanTimeout; |   int EPGScanTimeout; | ||||||
|  |   int CurrentChannel; | ||||||
|   cSetup(void); |   cSetup(void); | ||||||
|   bool Load(const char *FileName); |   bool Load(const char *FileName); | ||||||
|   bool Save(const char *FileName = NULL); |   bool Save(const char *FileName = NULL); | ||||||
|   | |||||||
							
								
								
									
										6
									
								
								vdr.c
									
									
									
									
									
								
							
							
						
						
									
										6
									
								
								vdr.c
									
									
									
									
									
								
							| @@ -22,7 +22,7 @@ | |||||||
|  * |  * | ||||||
|  * The project's page is at http://www.cadsoft.de/people/kls/vdr |  * 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 <getopt.h> | #include <getopt.h> | ||||||
| @@ -179,7 +179,7 @@ int main(int argc, char *argv[]) | |||||||
|  |  | ||||||
|   cDvbApi::SetPrimaryDvbApi(Setup.PrimaryDVB); |   cDvbApi::SetPrimaryDvbApi(Setup.PrimaryDVB); | ||||||
|  |  | ||||||
|   Channels.SwitchTo(1); |   Channels.SwitchTo(Setup.CurrentChannel); | ||||||
|  |  | ||||||
|   cEITScanner EITScanner; |   cEITScanner EITScanner; | ||||||
|  |  | ||||||
| @@ -312,6 +312,8 @@ int main(int argc, char *argv[]) | |||||||
|            } |            } | ||||||
|         } |         } | ||||||
|   isyslog(LOG_INFO, "caught signal %d", Interrupted); |   isyslog(LOG_INFO, "caught signal %d", Interrupted); | ||||||
|  |   Setup.CurrentChannel = cDvbApi::CurrentChannel(); | ||||||
|  |   Setup.Save(); | ||||||
|   cVideoCutter::Stop(); |   cVideoCutter::Stop(); | ||||||
|   delete Menu; |   delete Menu; | ||||||
|   delete ReplayControl; |   delete ReplayControl; | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user