Vdr and Parental Lock

Message ID 433BBA36.4070001@ventoso.org
State New
Headers

Commit Message

Luca Olivetti Sept. 29, 2005, 9:56 a.m. UTC
  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
  

Comments

Luca Olivetti Sept. 29, 2005, 11:17 a.m. UTC | #1
En/na Joerg Knitter ha escrit:
> 
> Hi,
> thanks a lot for the patch. I am going to test it when I find the time 
> (maybe this weekend).

I forgot to explain how it is supposed to work: it adds a new setup
option to filter channels  "All channels"->"Radio only"->"Tv only".
The filter is also switchable in the channels menu using the "1" key.
When the filter is active, channel zapping will only switch to the kind
of channel selected and only these channels are visible on the channels
menu (with the exception of the current channel which is always visible).

Bye
  
Klaus Schmidinger Oct. 1, 2005, 12:26 p.m. UTC | #2
Luca Olivetti wrote:
> ...
> 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).

The user will be able to create an arbitrary folder structure, and
any channel may be in any number of different folders.

But this is post-1.4 stuff...

Klaus
  
Gavin Hamill Oct. 1, 2005, 12:44 p.m. UTC | #3
On Saturday 01 October 2005 13:26, Klaus Schmidinger wrote:
> Luca Olivetti wrote:

> The user will be able to create an arbitrary folder structure, and
> any channel may be in any number of different folders.
>
> But this is post-1.4 stuff...

Sounds cool - 'profiles' will certainly add flexibility :) While we're all 
staring at the sky, can I put forward a suggestion in the channels theme?

I receive many channels via both DVB-T and DVB-C (and sure if I had a DVB-S 
card + dish I could get many via FTA from Astra, too) and it would be a great 
boon to be able to have single 'logical' channels rather than "BBC ONE" via  
DVB-C and another "BBC ONE" via DVB-T in a section of channels.conf just 
called 'Freeview'.

Would it make sense to implement this in post 1.4 so that recordings and 
channel-changing may take place without having to think that 'hmm I want to 
record programme X on the BBC, but I better remember to record using the 
DVB-T card, otherwise I'll lose access to all the cable channels'..

Just a suggestion :)

Cheers,
Gavin.
  

Patch

--- 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<cChannel> {
--- 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 --------------------------------------------------