diff --git a/README.md b/README.md index d2bc8e815..b2ef1d1d1 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/pvr.iptvsimple/addon.xml.in b/pvr.iptvsimple/addon.xml.in index 00d485548..5b2763bcd 100644 --- a/pvr.iptvsimple/addon.xml.in +++ b/pvr.iptvsimple/addon.xml.in @@ -1,7 +1,7 @@ @ADDON_DEPENDS@ diff --git a/pvr.iptvsimple/changelog.txt b/pvr.iptvsimple/changelog.txt index 4a1a2fe86..5d7474d97 100644 --- a/pvr.iptvsimple/changelog.txt +++ b/pvr.iptvsimple/changelog.txt @@ -1,3 +1,8 @@ + +v20.13.0 +- Only reset channel group list when a channel URL is read from M3U playlist +- Modify EXTGRP behaviour so it is a begin directive for channels groups, i.e. it carries across channels unless reset by an empty EXTGRP directive or any group-title tag for a EXTINF channel directive + v20.12.0 - Extract season from medis title for path if not available - Set default to include media Group name in path if no dir present diff --git a/src/iptvsimple/PlaylistLoader.cpp b/src/iptvsimple/PlaylistLoader.cpp index a28c7e714..d05abf8f4 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}; @@ -170,7 +171,6 @@ bool PlaylistLoader::LoadPlayList() if (StringUtils::StartsWith(line, M3U_INFO_MARKER)) //#EXTINF { tmpChannel.SetChannelNumber(m_channels.GetCurrentChannelNumber()); - currentChannelGroupIdList.clear(); isMediaEntry = line.find(MEDIA) != std::string::npos || line.find(MEDIA_DIR) != std::string::npos || @@ -179,11 +179,12 @@ bool PlaylistLoader::LoadPlayList() overrideRealTime = GetOverrideRealTime(line); - const std::string groupNamesListString = ParseIntoChannel(line, tmpChannel, tmpMediaEntry, currentChannelGroupIdList, epgTimeShift, catchupCorrectionSecs, xeevCatchup); + const std::string groupNamesListString = ParseIntoChannel(line, tmpChannel, tmpMediaEntry, epgTimeShift, catchupCorrectionSecs, xeevCatchup); if (!groupNamesListString.empty()) { ParseAndAddChannelGroups(groupNamesListString, currentChannelGroupIdList, tmpChannel.IsRadio()); + groupsFromBeginDirective = false; channelHadGroups = true; } } @@ -201,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,6 +255,11 @@ bool PlaylistLoader::LoadPlayList() overrideRealTime = false; isMediaEntry = false; channelHadGroups = false; + + // 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(); } } @@ -277,7 +288,7 @@ bool PlaylistLoader::LoadPlayList() return true; } -std::string PlaylistLoader::ParseIntoChannel(const std::string& line, Channel& channel, MediaEntry& mediaEntry, std::vector& groupIdList, int epgTimeShift, int catchupCorrectionSecs, bool xeevCatchup) +std::string PlaylistLoader::ParseIntoChannel(const std::string& line, Channel& channel, MediaEntry& mediaEntry, int epgTimeShift, int catchupCorrectionSecs, bool xeevCatchup) { size_t colonIndex = line.find(':'); size_t commaIndex = line.rfind(','); //default to last comma on line in case we don't find a better match diff --git a/src/iptvsimple/PlaylistLoader.h b/src/iptvsimple/PlaylistLoader.h index ed50102f7..b2cdaa6cb 100644 --- a/src/iptvsimple/PlaylistLoader.h +++ b/src/iptvsimple/PlaylistLoader.h @@ -78,7 +78,7 @@ namespace iptvsimple static std::string ReadMarkerValue(const std::string& line, const std::string& markerName); static void ParseSinglePropertyIntoChannel(const std::string& line, iptvsimple::data::Channel& channel, const std::string& markerName); - std::string ParseIntoChannel(const std::string& line, iptvsimple::data::Channel& channel, data::MediaEntry& mediaEntry, std::vector& groupIdList, int epgTimeShift, int catchupCorrectionSecs, bool xeevCatchup); + std::string ParseIntoChannel(const std::string& line, iptvsimple::data::Channel& channel, data::MediaEntry& mediaEntry, int epgTimeShift, int catchupCorrectionSecs, bool xeevCatchup); void ParseAndAddChannelGroups(const std::string& groupNamesListString, std::vector& groupIdList, bool isRadio); std::string m_m3uLocation;