From 8079619a12800f5c907a48d5814576ea515d70c0 Mon Sep 17 00:00:00 2001 From: phunkyfish Date: Mon, 21 Aug 2023 11:41:30 +0100 Subject: [PATCH 1/4] Refactor out uneeded argument --- src/iptvsimple/PlaylistLoader.cpp | 4 ++-- src/iptvsimple/PlaylistLoader.h | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/iptvsimple/PlaylistLoader.cpp b/src/iptvsimple/PlaylistLoader.cpp index a28c7e714..40cc87971 100644 --- a/src/iptvsimple/PlaylistLoader.cpp +++ b/src/iptvsimple/PlaylistLoader.cpp @@ -179,7 +179,7 @@ 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()) { @@ -277,7 +277,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; From bdf1660238f2c4ec2aa3ebe5a8dd459e5f2193bf Mon Sep 17 00:00:00 2001 From: phunkyfish Date: Mon, 21 Aug 2023 11:43:01 +0100 Subject: [PATCH 2/4] Only reset channel group list when a channel URL is read from M3U Playlist --- src/iptvsimple/PlaylistLoader.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/iptvsimple/PlaylistLoader.cpp b/src/iptvsimple/PlaylistLoader.cpp index 40cc87971..a332c7363 100644 --- a/src/iptvsimple/PlaylistLoader.cpp +++ b/src/iptvsimple/PlaylistLoader.cpp @@ -170,7 +170,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 || @@ -249,6 +248,8 @@ bool PlaylistLoader::LoadPlayList() overrideRealTime = false; isMediaEntry = false; channelHadGroups = false; + + currentChannelGroupIdList.clear(); } } From d98072299a8b2313e8dcb50ebc0d440cdf7ad623 Mon Sep 17 00:00:00 2001 From: phunkyfish Date: Tue, 22 Aug 2023 10:37:39 +0100 Subject: [PATCH 3/4] 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 --- README.md | 2 +- src/iptvsimple/PlaylistLoader.cpp | 12 +++++++++++- 2 files changed, 12 insertions(+), 2 deletions(-) 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/src/iptvsimple/PlaylistLoader.cpp b/src/iptvsimple/PlaylistLoader.cpp index a332c7363..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}; @@ -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(); } } From 0f9ede71d31652db8fc2af7ac09ef2fb396a735f Mon Sep 17 00:00:00 2001 From: phunkyfish Date: Fri, 3 Nov 2023 20:36:43 +0000 Subject: [PATCH 4/4] changelog and version v20.13.0 --- pvr.iptvsimple/addon.xml.in | 2 +- pvr.iptvsimple/changelog.txt | 5 +++++ 2 files changed, 6 insertions(+), 1 deletion(-) 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