Skip to content

Commit

Permalink
Modify EXTGRP behaviour so it is a begin directive for channels group…
Browse files Browse the repository at this point in the history
…s, i.e. it carries across channels unless reset by an empty EXTGRP directive or any group-title tag for a EXTINF channel directive
  • Loading branch information
phunkyfish committed Nov 3, 2023
1 parent bdf1660 commit d980722
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 2 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
12 changes: 11 additions & 1 deletion src/iptvsimple/PlaylistLoader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,7 @@ bool PlaylistLoader::LoadPlayList()
std::vector<int> currentChannelGroupIdList;
bool channelHadGroups = false;
bool xeevCatchup = false;
bool groupsFromBeginDirective = false; //From EXTGRP begin directive

Channel tmpChannel{m_settings};
MediaEntry tmpMediaEntry{m_settings};
Expand Down Expand Up @@ -183,6 +184,7 @@ bool PlaylistLoader::LoadPlayList()
if (!groupNamesListString.empty())
{
ParseAndAddChannelGroups(groupNamesListString, currentChannelGroupIdList, tmpChannel.IsRadio());
groupsFromBeginDirective = false;
channelHadGroups = true;
}
}
Expand All @@ -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;
}
}
Expand Down Expand Up @@ -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();
}
}

Expand Down

0 comments on commit d980722

Please sign in to comment.