Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[PlaylistLoader] Fix KODIPROP parsing #889

Merged
merged 2 commits into from
Sep 16, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion pvr.iptvsimple/addon.xml.in
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<addon
id="pvr.iptvsimple"
version="22.1.1"
version="22.1.2"
name="IPTV Simple Client"
provider-name="nightik and Ross Nicholson">
<requires>@ADDON_DEPENDS@
Expand Down
3 changes: 3 additions & 0 deletions pvr.iptvsimple/changelog.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
v22.1.2
- Fix #KODIPROP parsing from playlists

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is Fix wrong fix to manifest user-agent header for inputstream.adaptive missing from changelog / commits? Or is it not required for Piers branch?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

piers its ok, it is only on omega that i accidentally cherry-picked the old commit without realizing it

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok, so any change needed for Omega?

Copy link
Contributor Author

@CastagnaIT CastagnaIT Sep 16, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you have already merged the omega backport that contains reverted "bad" commit and applied the correct one
so now omega its ok

v22.1.1
- Always add mimetype for inputstream.adaptive
- Better handled user-agent header for inputstream.adaptive use cases
Expand Down
38 changes: 24 additions & 14 deletions src/iptvsimple/PlaylistLoader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -552,7 +552,7 @@ void PlaylistLoader::ParseAndAddChannelGroups(const std::string& groupNamesListS

void PlaylistLoader::ParseSinglePropertyIntoChannel(const std::string& line, Channel& channel, const std::string& markerName)
{
const std::string value = ReadMarkerValue(line, markerName);
const std::string value = ReadMarkerValue(line, markerName, markerName != KODIPROP_MARKER);
auto pos = value.find('=');
if (pos != std::string::npos)
{
Expand Down Expand Up @@ -604,7 +604,9 @@ void PlaylistLoader::ReloadPlayList()
}
}

std::string PlaylistLoader::ReadMarkerValue(const std::string& line, const std::string& markerName)
std::string PlaylistLoader::ReadMarkerValue(const std::string& line,
const std::string& markerName,
bool isCheckDelimiters /* = true */)
{
size_t markerStart = line.find(markerName);
if (markerStart != std::string::npos)
Expand All @@ -613,21 +615,29 @@ std::string PlaylistLoader::ReadMarkerValue(const std::string& line, const std::
markerStart += marker.length();
if (markerStart < line.length())
{
if (marker == M3U_GROUP_MARKER && line[markerStart] != '"')
size_t markerEnd;
if (isCheckDelimiters)
{
//For this case we just want to return the full string without splitting it
//This is because groups use semi-colons and not spaces as a delimiter
return line.substr(markerStart, line.length());
}
if (marker == M3U_GROUP_MARKER && line[markerStart] != '"')
{
//For this case we just want to return the full string without splitting it
//This is because groups use semi-colons and not spaces as a delimiter
return line.substr(markerStart, line.length());
}

char find = ' ';
if (line[markerStart] == '"')
{
find = '"';
markerStart++;
char find = ' ';
if (line[markerStart] == '"')
{
find = '"';
markerStart++;
}
markerEnd = line.find(find, markerStart);
if (markerEnd == std::string::npos)
{
markerEnd = line.length();
}
}
size_t markerEnd = line.find(find, markerStart);
if (markerEnd == std::string::npos)
else
{
markerEnd = line.length();
}
Expand Down
2 changes: 1 addition & 1 deletion src/iptvsimple/PlaylistLoader.h
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ namespace iptvsimple
void ReloadPlayList();

private:
static std::string ReadMarkerValue(const std::string& line, const std::string& markerName);
static std::string ReadMarkerValue(const std::string& line, const std::string& markerName, bool isCheckDelimiters = true);
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, int epgTimeShift, int catchupCorrectionSecs, bool xeevCatchup);
Expand Down