From patchwork Thu Sep 29 09:56:06 2005 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Luca Olivetti X-Patchwork-Id: 12048 Received: from 232.red-213-97-27.staticip.rima-tde.net ([213.97.27.232]) by www.linuxtv.org with esmtp (Exim 4.50) id 1EKv9f-0004SG-I6 for vdr@linuxtv.org; Thu, 29 Sep 2005 11:56:44 +0200 Received: from [127.0.0.1] (localhost.localdomain [127.0.0.1]) by 232.Red-213-97-27.staticIP.rima-tde.net (Postfix) with ESMTP id 4683818C7879 for ; Thu, 29 Sep 2005 11:56:12 +0200 (CEST) Message-ID: <433BBA36.4070001@ventoso.org> Date: Thu, 29 Sep 2005 11:56:06 +0200 From: Luca Olivetti User-Agent: Mozilla Thunderbird 1.0.6 (X11/20050716) X-Accept-Language: ca MIME-Version: 1.0 To: Klaus Schmidinger's VDR Subject: Re: [vdr] Vdr and Parental Lock References: <200509281730.11925.alexw@undercover.mine.nu> <433AC43B.9050008@ntica.com> <433AC44A.3050503@cadsoft.de> <433BA427.7040404@gmx.de> In-Reply-To: <433BA427.7040404@gmx.de> X-Enigmail-Version: 0.92.0.0 X-BeenThere: vdr@linuxtv.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: Klaus Schmidinger's VDR List-Id: Klaus Schmidinger's VDR List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 29 Sep 2005 09:56:44 -0000 Status: O X-Status: X-Keywords: X-UID: 5221 En/na Joerg Knitter ha escrit: > Any chance to get at least a separation of TV and radio channels? With > the new German radio channels and especially the DD5.1 radio channels, > this is getting much more interesting as before as I can use VDR as a > radio replacement during the day (when I don´t watch TV). See attached patch. It may depend on some other patch, so there may be some reject on a clean vdr source, but it should be easy to correct manually. Don't let the name mislead you: I'm using it with vdr-1.3.32 (didn't see any compelling reason in the changelog to switch to 1.3.33). Klaus, may I suggest channel categories (e.g. movies, news, films, general entertainmnent, music, children, adult, etc.) instead of/additionally to favorites? (with the provision that a channel may be in more than one category). Bye --- channels.c.cfilter 2005-03-20 20:02:45.383846604 +0100 +++ channels.c 2005-03-20 20:04:41.554758434 +0100 @@ -812,6 +812,15 @@ return fprintf(f, "%s", *ToText()) > 0; } +bool cChannel::Filtered(void) +{ + switch(Setup.ChannelFilter) { + case 1: return (groupSep || vpid != 0); + case 2: return (groupSep || vpid == 0); + default: return true; + } +} + // -- cChannels -------------------------------------------------------------- cChannels Channels; --- channels.h.cfilter 2005-03-20 20:02:45.402840856 +0100 +++ channels.h 2005-03-20 20:04:41.574752437 +0100 @@ -192,6 +192,7 @@ void SetLinkChannels(cLinkChannels *LinkChannels); void SetRefChannel(cChannel *RefChannel); void SetGroupSep(bool Sep = true); + bool Filtered(void); }; class cChannels : public cRwLock, public cConfig { --- config.c.cfilter 2005-02-20 13:52:59.000000000 +0100 +++ config.c 2005-03-20 20:04:41.628736245 +0100 @@ -301,6 +301,7 @@ CurrentChannel = -1; CurrentVolume = MAXVOLUME; CurrentDolby = 0; + ChannelFilter = 0; } cSetup& cSetup::operator= (const cSetup &s) @@ -458,6 +459,7 @@ else if (!strcasecmp(Name, "CurrentChannel")) CurrentChannel = atoi(Value); else if (!strcasecmp(Name, "CurrentVolume")) CurrentVolume = atoi(Value); else if (!strcasecmp(Name, "CurrentDolby")) CurrentDolby = atoi(Value); + else if (!strcasecmp(Name, "ChannelFilter")) ChannelFilter = atoi(Value); else return false; return true; @@ -522,6 +524,7 @@ Store("CurrentChannel", CurrentChannel); Store("CurrentVolume", CurrentVolume); Store("CurrentDolby", CurrentDolby); + Store("ChannelFilter", ChannelFilter); Sort(); --- config.h.cfilter 2005-03-05 16:44:35.000000000 +0100 +++ config.h 2005-03-20 20:04:41.645731148 +0100 @@ -255,6 +255,7 @@ int CurrentChannel; int CurrentVolume; int CurrentDolby; + int ChannelFilter; int __EndData__; cSetup(void); cSetup& operator= (const cSetup &s); --- device.c.cfilter 2005-02-27 14:55:15.000000000 +0100 +++ device.c 2005-03-20 20:04:41.663725751 +0100 @@ -530,7 +530,7 @@ cChannel *channel; while ((channel = Channels.GetByNumber(n, Direction)) != NULL) { // try only channels which are currently available - if (PrimaryDevice()->ProvidesChannel(channel, Setup.PrimaryLimit) || PrimaryDevice()->CanReplay() && GetDevice(channel, 0)) + if (channel->Filtered() && (PrimaryDevice()->ProvidesChannel(channel, Setup.PrimaryLimit) || PrimaryDevice()->CanReplay() && GetDevice(channel, 0))) break; n = channel->Number() + Direction; } --- i18n.c.cfilter 2005-03-12 11:43:16.000000000 +0100 +++ i18n.c 2005-03-20 20:18:11.845873246 +0100 @@ -3934,6 +3934,63 @@ "Kanalivahetuse ooteaeg (s)", "Zap timeout (s)", }, + { "Setup.Miscellaneous$Filter channels", + "",// TODO + "",// TODO + "Filtra canali", + "",// TODO + "",// TODO + "",// TODO + "",// TODO + "",// TODO + "",// TODO + "Filtra canales", + "",// TODO + "",// TODO + "",// TODO + "",// TODO + "Filtra canals", + "",// TODO + "",// hrv TODO + }, + { "Tv only", + "",// TODO + "",// TODO + "Solo Tv", + "",// TODO + "",// TODO + "",// TODO + "",// TODO + "",// TODO + "",// TODO + "Sólo Tv", + "",// TODO + "",// TODO + "",// TODO + "",// TODO + "Només Tv", + "",// TODO + "",// hrv TODO + }, + { "Radio only", + "",// TODO + "",// TODO + "Solo Radio", + "",// TODO + "",// TODO + "",// TODO + "",// TODO + "",// TODO + "",// TODO + "Sólo Radio", + "",// TODO + "",// TODO + "",// TODO + "",// TODO + "Només Radio", + "",// TODO + "",// hrv TODO + }, // The days of the week: { "MTWTFSS", "MDMDFSS", --- menu.c.cfilter 2005-03-20 16:14:51.000000000 +0100 +++ menu.c 2005-03-20 20:12:27.052996484 +0100 @@ -418,7 +418,7 @@ cMenuChannelItem *currentItem = NULL; Clear(); for (cChannel *channel = Channels.First(); channel; channel = Channels.Next(channel)) { - if (!channel->GroupSep() || cMenuChannelItem::SortMode() == cMenuChannelItem::csmNumber && *channel->Name()) { + if ((!channel->GroupSep() || cMenuChannelItem::SortMode() == cMenuChannelItem::csmNumber && *channel->Name()) && ( channel == currentChannel || channel->Filtered() )) { cMenuChannelItem *item = new cMenuChannelItem(channel); Add(item); if (channel == currentChannel) @@ -429,6 +429,16 @@ Sort(); SetCurrent(currentItem); SetHelp(tr("Edit"), tr("New"), tr("Delete"), cMenuChannelItem::SortMode() == cMenuChannelItem::csmNumber ? tr("Mark") : NULL); + char *buffer = NULL; + switch(::Setup.ChannelFilter) { + case 1: asprintf(&buffer, "%s (%s)", tr("Channels"),tr("Tv only")); + break; + case 2: asprintf(&buffer, "%s (%s)", tr("Channels"),tr("Radio only")); + break; + default: asprintf(&buffer, "%s", tr("Channels")); + } + SetTitle(buffer); + free(buffer); Display(); } @@ -534,6 +544,10 @@ case k0: cMenuChannelItem::IncSortMode(); Setup(); break; + case k1: ::Setup.ChannelFilter++; + if (::Setup.ChannelFilter>2) ::Setup.ChannelFilter=0; + Setup(); + break; case kOk: return Switch(); case kRed: return Edit(); case kGreen: return New(); @@ -2203,6 +2217,8 @@ // --- cMenuSetupMisc -------------------------------------------------------- class cMenuSetupMisc : public cMenuSetupBase { +private: + const char *channelFilterTexts[3]; public: cMenuSetupMisc(void); }; @@ -2210,10 +2226,14 @@ cMenuSetupMisc::cMenuSetupMisc(void) { SetSection(tr("Miscellaneous")); + channelFilterTexts[0] = tr("no"); + channelFilterTexts[1] = tr("Tv only"); + channelFilterTexts[2] = tr("Radio only"); Add(new cMenuEditIntItem( tr("Setup.Miscellaneous$Min. event timeout (min)"), &data.MinEventTimeout)); Add(new cMenuEditIntItem( tr("Setup.Miscellaneous$Min. user inactivity (min)"), &data.MinUserInactivity)); Add(new cMenuEditIntItem( tr("Setup.Miscellaneous$SVDRP timeout (s)"), &data.SVDRPTimeout)); Add(new cMenuEditIntItem( tr("Setup.Miscellaneous$Zap timeout (s)"), &data.ZapTimeout)); + Add(new cMenuEditStraItem(tr("Setup.Miscellaneous$Filter channels"), &data.ChannelFilter, 3, channelFilterTexts));; } // --- cMenuSetupPluginItem --------------------------------------------------