diff --git a/README.md b/README.md index d2bc8e81..b2ef1d1d 100644 --- a/README.md +++ b/README.md @@ -523,7 +523,7 @@ http://path-to-stream/live/channel-z.ts - `media-dir`: An optional directory path which should specifiy where in the hierarchy this media entry should be represented. The path separator is `/`. - `media-size`: An optional size of the media entry in bytes. Note: this is not usually available for VOD libraries. - `realtime`: Live streams in PVR disable features such as passthrough by default. Set this item to "false" to bypass this behaviour if the stream should not be treated like VOD/Media in the UI. -- `#EXTGRP`: A semi-colon separted list of channel groups that this channel belongs to. +- `#EXTGRP`: A semi-colon separted list of channel groups. Note that this is a begin directive, i.e. all channels following this directive will have these groups until an empty `#EXTGRP` directive is reached. These groupings wil also be reset by any `group-title` tag for an `#EXTINF` channel directive. - `#KODIPROP`: A single property in the format `key=value` that can be passed to Kodi. Multiple can be passed each on a separate line. - `#EXTVLCOPT`: A single property in the format `key=value` that can be passed to Kodi. Multiple can be passed each on a separate line. Note that if either a `http-user-agent` or a `http-referrer` property is found it will added to the URL as a HTTP header as `user-agent` or `referrer` respectively if not already provided in the URL. These two fields specifically will be dropped as properties whether or not they are added as header values. They will be added in the same format as the `URL` below. - `#EXT-X-PLAYLIST-TYPE`: If this element is present with a value of `VOD` (Video on Demand) the stream is marked as not being live. diff --git a/src/iptvsimple/PlaylistLoader.cpp b/src/iptvsimple/PlaylistLoader.cpp index a332c736..d05abf8f 100644 --- a/src/iptvsimple/PlaylistLoader.cpp +++ b/src/iptvsimple/PlaylistLoader.cpp @@ -98,6 +98,7 @@ bool PlaylistLoader::LoadPlayList() std::vector currentChannelGroupIdList; bool channelHadGroups = false; bool xeevCatchup = false; + bool groupsFromBeginDirective = false; //From EXTGRP begin directive Channel tmpChannel{m_settings}; MediaEntry tmpMediaEntry{m_settings}; @@ -183,6 +184,7 @@ bool PlaylistLoader::LoadPlayList() if (!groupNamesListString.empty()) { ParseAndAddChannelGroups(groupNamesListString, currentChannelGroupIdList, tmpChannel.IsRadio()); + groupsFromBeginDirective = false; channelHadGroups = true; } } @@ -200,10 +202,15 @@ bool PlaylistLoader::LoadPlayList() } else if (StringUtils::StartsWith(line, M3U_GROUP_MARKER)) //#EXTGRP: { + //Clear any previous Group Ids + currentChannelGroupIdList.clear(); + groupsFromBeginDirective = false; + const std::string groupNamesListString = ReadMarkerValue(line, M3U_GROUP_MARKER); if (!groupNamesListString.empty()) { ParseAndAddChannelGroups(groupNamesListString, currentChannelGroupIdList, tmpChannel.IsRadio()); + groupsFromBeginDirective = true; channelHadGroups = true; } } @@ -249,7 +256,10 @@ bool PlaylistLoader::LoadPlayList() isMediaEntry = false; channelHadGroups = false; - currentChannelGroupIdList.clear(); + // We want to clear the groups if they came from a 'group-title' tag from a channel + // But if it's from an EXTGRP tag we don't as that's a begin directive. + if (!groupsFromBeginDirective) + currentChannelGroupIdList.clear(); } }