1
0
mirror of https://github.com/VDR4Arch/vdr.git synced 2023-10-10 13:36:52 +02:00

The initial channel is now stored by the channel ID in the setup.conf file

This commit is contained in:
Klaus Schmidinger 2011-06-13 14:48:41 +02:00
parent 61a9b09403
commit 263dc29508
8 changed files with 40 additions and 13 deletions

View File

@ -1028,6 +1028,8 @@ Marc Rovira Vall <tm05462@salleURL.edu>, Ramon Roca <ramon.roca@xcombo.com> and
Lars Bläser <LBlaeser@hofheim.de> Lars Bläser <LBlaeser@hofheim.de>
for reporting a bug in EPG bugfix statistics which made log entries for undefined for reporting a bug in EPG bugfix statistics which made log entries for undefined
channels channels
for reporting a problem with the initial channel in case channels are reordered or
deleted
Niko Tarnanen <niko.tarnanen@hut.fi> Niko Tarnanen <niko.tarnanen@hut.fi>
for translating OSD texts to the Finnish language for translating OSD texts to the Finnish language

View File

@ -6607,7 +6607,7 @@ Video Disk Recorder Revision History
- Avoiding an unecessary call to Recordings.ResetResume() (thanks to Reinhard - Avoiding an unecessary call to Recordings.ResetResume() (thanks to Reinhard
Nissl). Nissl).
2011-06-12: Version 1.7.19 2011-06-13: Version 1.7.19
- Fixed cString's operator=(const char *String) in case the given string is the - Fixed cString's operator=(const char *String) in case the given string is the
same as the existing one (thanks to Dirk Leber). same as the existing one (thanks to Dirk Leber).
@ -6644,3 +6644,6 @@ Video Disk Recorder Revision History
that new value is not the default value (thanks to Derek Kelly for reporting a that new value is not the default value (thanks to Derek Kelly for reporting a
problem with the fps value being overwritten in case a recording was interrupted problem with the fps value being overwritten in case a recording was interrupted
and resumed, and the fps value could not be determined after resuming recording). and resumed, and the fps value could not be determined after resuming recording).
- The initial channel is now stored by the channel ID in the setup.conf file, in
order to avoid problems in case channels are reordered or deleted (reported by
Lars Bläser).

4
MANUAL
View File

@ -885,8 +885,8 @@ Version 1.6
key. Note that the total maximum is also limited by key. Note that the total maximum is also limited by
the "OSD/Channel info time" parameter. the "OSD/Channel info time" parameter.
Initial channel = 0 The number of the channel that shall be tuned to when Initial channel = The channel ID of the channel that shall be tuned to when
VDR starts. Default is 0, which means that it will VDR starts. Default is empty, which means that it will
tune to the channel that was on before VDR was stopped. tune to the channel that was on before VDR was stopped.
Initial volume = -1 The volume that shall be set when VDR starts. Default Initial volume = -1 The volume that shall be set when VDR starts. Default

View File

@ -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 2.13 2010/06/06 10:06:43 kls Exp $ * $Id: config.c 2.14 2011/06/13 14:41:01 kls Exp $
*/ */
#include "config.h" #include "config.h"
@ -395,7 +395,7 @@ cSetup::cSetup(void)
CurrentChannel = -1; CurrentChannel = -1;
CurrentVolume = MAXVOLUME; CurrentVolume = MAXVOLUME;
CurrentDolby = 0; CurrentDolby = 0;
InitialChannel = 0; // InitialChannel is initialized by constructor
InitialVolume = -1; InitialVolume = -1;
ChannelsWrap = 0; ChannelsWrap = 0;
EmergencyExit = 1; EmergencyExit = 1;
@ -404,6 +404,7 @@ cSetup::cSetup(void)
cSetup& cSetup::operator= (const cSetup &s) cSetup& cSetup::operator= (const cSetup &s)
{ {
memcpy(&__BeginData__, &s.__BeginData__, (char *)&s.__EndData__ - (char *)&s.__BeginData__); memcpy(&__BeginData__, &s.__BeginData__, (char *)&s.__EndData__ - (char *)&s.__BeginData__);
InitialChannel = s.InitialChannel;
return *this; return *this;
} }
@ -586,7 +587,7 @@ bool cSetup::Parse(const char *Name, const char *Value)
else if (!strcasecmp(Name, "CurrentChannel")) CurrentChannel = atoi(Value); else if (!strcasecmp(Name, "CurrentChannel")) CurrentChannel = atoi(Value);
else if (!strcasecmp(Name, "CurrentVolume")) CurrentVolume = atoi(Value); else if (!strcasecmp(Name, "CurrentVolume")) CurrentVolume = atoi(Value);
else if (!strcasecmp(Name, "CurrentDolby")) CurrentDolby = atoi(Value); else if (!strcasecmp(Name, "CurrentDolby")) CurrentDolby = atoi(Value);
else if (!strcasecmp(Name, "InitialChannel")) InitialChannel = atoi(Value); else if (!strcasecmp(Name, "InitialChannel")) InitialChannel = Value;
else if (!strcasecmp(Name, "InitialVolume")) InitialVolume = atoi(Value); else if (!strcasecmp(Name, "InitialVolume")) InitialVolume = atoi(Value);
else if (!strcasecmp(Name, "ChannelsWrap")) ChannelsWrap = atoi(Value); else if (!strcasecmp(Name, "ChannelsWrap")) ChannelsWrap = atoi(Value);
else if (!strcasecmp(Name, "EmergencyExit")) EmergencyExit = atoi(Value); else if (!strcasecmp(Name, "EmergencyExit")) EmergencyExit = atoi(Value);

View File

@ -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 2.31 2011/05/15 11:46:30 kls Exp $ * $Id: config.h 2.32 2011/06/13 14:24:40 kls Exp $
*/ */
#ifndef __CONFIG_H #ifndef __CONFIG_H
@ -287,11 +287,11 @@ public:
int CurrentChannel; int CurrentChannel;
int CurrentVolume; int CurrentVolume;
int CurrentDolby; int CurrentDolby;
int InitialChannel;
int InitialVolume; int InitialVolume;
int ChannelsWrap; int ChannelsWrap;
int EmergencyExit; int EmergencyExit;
int __EndData__; int __EndData__;
cString InitialChannel;
cSetup(void); cSetup(void);
cSetup& operator= (const cSetup &s); cSetup& operator= (const cSetup &s);
bool Load(const char *FileName); bool Load(const char *FileName);

View File

@ -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: menuitems.c 2.8 2010/12/12 13:41:09 kls Exp $ * $Id: menuitems.c 2.9 2011/06/13 14:48:41 kls Exp $
*/ */
#include "menuitems.h" #include "menuitems.h"
@ -713,7 +713,19 @@ void cMenuEditStraItem::Set(void)
cMenuEditChanItem::cMenuEditChanItem(const char *Name, int *Value, const char *NoneString) cMenuEditChanItem::cMenuEditChanItem(const char *Name, int *Value, const char *NoneString)
:cMenuEditIntItem(Name, Value, NoneString ? 0 : 1, Channels.MaxNumber()) :cMenuEditIntItem(Name, Value, NoneString ? 0 : 1, Channels.MaxNumber())
{ {
channelID = NULL;
noneString = NoneString; noneString = NoneString;
dummyValue = 0;
Set();
}
cMenuEditChanItem::cMenuEditChanItem(const char *Name, cString *ChannelID, const char *NoneString)
:cMenuEditIntItem(Name, &dummyValue, NoneString ? 0 : 1, Channels.MaxNumber())
{
channelID = ChannelID;
noneString = NoneString;
cChannel *channel = Channels.GetByChannelID(tChannelID::FromString(*ChannelID));
dummyValue = channel ? channel->Number() : 0;
Set(); Set();
} }
@ -744,6 +756,8 @@ eOSState cMenuEditChanItem::ProcessKey(eKeys Key)
*value = channel->Number(); *value = channel->Number();
else if (delta < 0 && noneString) else if (delta < 0 && noneString)
*value = 0; *value = 0;
if (channelID)
*channelID = channel ? channel->GetChannelID().ToString() : "";
Set(); Set();
} }
break; break;

View File

@ -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: menuitems.h 2.4 2010/06/06 10:32:38 kls Exp $ * $Id: menuitems.h 2.5 2011/06/13 13:46:03 kls Exp $
*/ */
#ifndef __MENUITEMS_H #ifndef __MENUITEMS_H
@ -133,9 +133,12 @@ public:
class cMenuEditChanItem : public cMenuEditIntItem { class cMenuEditChanItem : public cMenuEditIntItem {
protected: protected:
const char *noneString; const char *noneString;
int dummyValue;
cString *channelID;
virtual void Set(void); virtual void Set(void);
public: public:
cMenuEditChanItem(const char *Name, int *Value, const char *NoneString = NULL); cMenuEditChanItem(const char *Name, int *Value, const char *NoneString = NULL);
cMenuEditChanItem(const char *Name, cString *ChannelID, const char *NoneString = NULL);
virtual eOSState ProcessKey(eKeys Key); virtual eOSState ProcessKey(eKeys Key);
}; };

10
vdr.c
View File

@ -22,7 +22,7 @@
* *
* The project's page is at http://www.tvdr.de * The project's page is at http://www.tvdr.de
* *
* $Id: vdr.c 2.20 2010/12/12 13:42:00 kls Exp $ * $Id: vdr.c 2.21 2011/06/13 14:40:12 kls Exp $
*/ */
#include <getopt.h> #include <getopt.h>
@ -704,8 +704,12 @@ int main(int argc, char *argv[])
if (!cDevice::WaitForAllDevicesReady(DEVICEREADYTIMEOUT)) if (!cDevice::WaitForAllDevicesReady(DEVICEREADYTIMEOUT))
dsyslog("not all devices ready after %d seconds", DEVICEREADYTIMEOUT); dsyslog("not all devices ready after %d seconds", DEVICEREADYTIMEOUT);
if (Setup.InitialChannel > 0) if (isnumber(Setup.InitialChannel)) { // for compatibility with old setup.conf files
Setup.CurrentChannel = Setup.InitialChannel; if (cChannel *Channel = Channels.GetByNumber(atoi(Setup.InitialChannel)))
Setup.InitialChannel = Channel->GetChannelID().ToString();
}
if (cChannel *Channel = Channels.GetByChannelID(tChannelID::FromString(Setup.InitialChannel)))
Setup.CurrentChannel = Channel->Number();
if (Setup.InitialVolume >= 0) if (Setup.InitialVolume >= 0)
Setup.CurrentVolume = Setup.InitialVolume; Setup.CurrentVolume = Setup.InitialVolume;
Channels.SwitchTo(Setup.CurrentChannel); Channels.SwitchTo(Setup.CurrentChannel);