From 3b88ba1cd2d44b47c619e1a49275377fcd9af7a3 Mon Sep 17 00:00:00 2001 From: Klaus Schmidinger Date: Sun, 22 Dec 2002 14:07:51 +0100 Subject: [PATCH] The SVDRP command CHAN now also accepts channel IDs --- HISTORY | 6 +----- svdrp.c | 26 +++++++++++++++----------- 2 files changed, 16 insertions(+), 16 deletions(-) diff --git a/HISTORY b/HISTORY index 1697f256..916e15b9 100644 --- a/HISTORY +++ b/HISTORY @@ -1901,11 +1901,7 @@ Video Disk Recorder Revision History 2002-12-22: Version 1.1.21 -- The 'C' record in the 'epg.data' file now also contains the channel numbers (see - man vdr(5)). This does mean some redundancy, but it helps applications that don't - want to parse the channel definitions in order to work with the channel numbers. - When reading the 'epg.data' file VDR only interprets the channel IDs, everyting - else is optional and has no meaning to VDR. - Fixed the 'channels.conf' entries for "Studio Universal" and "Disney Channel". - Fixed handling channels in the "Channels" menu in case there are ':@nnn' group separators without names (thanks to Guy Roussin for reporting this one). +- The SVDRP command CHAN now also accepts channel IDs. diff --git a/svdrp.c b/svdrp.c index 66b420cf..102abe0d 100644 --- a/svdrp.c +++ b/svdrp.c @@ -10,7 +10,7 @@ * and interact with the Video Disk Recorder - or write a full featured * graphical interface that sits on top of an SVDRP connection. * - * $Id: svdrp.c 1.49 2002/11/10 12:09:56 kls Exp $ + * $Id: svdrp.c 1.50 2002/12/22 14:04:08 kls Exp $ */ #include "svdrp.h" @@ -174,8 +174,8 @@ bool cPUTEhandler::Process(const char *s) #define MAXHELPTOPIC 10 const char *HelpPages[] = { - "CHAN [ + | - | | ]\n" - " Switch channel up, down or to the given channel number or name.\n" + "CHAN [ + | - | | | ]\n" + " Switch channel up, down or to the given channel number, name or id.\n" " Without option (or after successfully switching to the channel)\n" " it returns the current channel number and name.", "CLRE\n" @@ -412,15 +412,19 @@ void cSVDRP::CmdCHAN(const char *Option) } } else { - int i = 1; - cChannel *channel; - while ((channel = Channels.GetByNumber(i, 1)) != NULL) { - if (strcasecmp(channel->Name(), Option) == 0) { - n = i; - break; + cChannel *channel = Channels.GetByChannelID(tChannelID::FromString(Option)); + if (channel) + n = channel->Number(); + else { + int i = 1; + while ((channel = Channels.GetByNumber(i, 1)) != NULL) { + if (strcasecmp(channel->Name(), Option) == 0) { + n = channel->Number(); + break; + } + i = channel->Number() + 1; } - i = channel->Number() + 1; - } + } } if (n < 0) { Reply(501, "Undefined channel \"%s\"", Option);