From 144b098a1a24d2cc6664513e6951e1215c0b3acb Mon Sep 17 00:00:00 2001 From: methodus Date: Thu, 3 Jan 2013 08:23:02 +0100 Subject: Added channel group to channel item properties (genre) to use that for filtering and sorting in Windows Media Player 12, which is absolutely unaware of folders. --- plugins/profiler/vdrDVBProfiler/dvbProfiler.cpp | 31 +++++++++++++++++++++++++ 1 file changed, 31 insertions(+) (limited to 'plugins/profiler/vdrDVBProfiler') diff --git a/plugins/profiler/vdrDVBProfiler/dvbProfiler.cpp b/plugins/profiler/vdrDVBProfiler/dvbProfiler.cpp index 84b50a8..1725006 100644 --- a/plugins/profiler/vdrDVBProfiler/dvbProfiler.cpp +++ b/plugins/profiler/vdrDVBProfiler/dvbProfiler.cpp @@ -136,6 +136,31 @@ public: } } + int GetGroupByChannel(const cChannel* channel) + { + if(!channel) return -1; + int Idx = 0, Idx2; + cChannel *group, *chan; + + for(group = Channels.First(); group; group = Channels.Next(group)){ + if(group->GroupSep() && *group->Name()){ + Idx2 = Idx; + for(chan = Channels.Next(group); chan; chan = Channels.Next(chan)){ + if(chan->GroupSep() && *group->Name()){ + group = Channels.Prev(chan); + break; + } + if(channel == chan) return Idx; + ++Idx2; + } + Idx = Idx2; + } + ++Idx; + } + + return -1; + } + ::cConfig channelTitleConfig; cCharSetConv conv; @@ -341,6 +366,12 @@ private: metadata.SetProperty(cMetadata::Property(property::object::KEY_CHANNEL_NAME, channelName)); metadata.SetProperty(cMetadata::Property(property::object::KEY_CHANNEL_NR, (long int)channel->Number())); + int group = GetGroupByChannel(channel); + if(group != -1){ + LOG(4, "Channel group: %s (%d)", Channels.Get(group)->Name(), group); + metadata.SetProperty(cMetadata::Property("upnp:genre", tools::ToUTF8String(Channels.Get(group)->Name()))); + } + // Now, we try to get the present event of the schedule { cSchedulesLock lock; -- cgit v1.2.3