Skip to content

Commit

Permalink
Backport PR 286
Browse files Browse the repository at this point in the history
Fix custom genre strings
  • Loading branch information
emveepee committed Jan 22, 2025
1 parent 24e9ea0 commit 3a88ec2
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 10 deletions.
3 changes: 1 addition & 2 deletions src/EPG.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,6 @@ PVR_ERROR EPG::GetEPGForChannel(int channelUid, time_t start, time_t end, kodi::
// genre type
broadcast.SetGenreType(XMLUtils::GetIntValue(pListingNode, "genre_type"));
broadcast.SetGenreSubType(XMLUtils::GetIntValue(pListingNode, "genre_sub_type"));

}

NextPVR::GenreBlock genreBlock = { sGenre, broadcast.GetGenreType(), EPG_EVENT_CONTENTMASK_UNDEFINED };
Expand All @@ -137,7 +136,7 @@ PVR_ERROR EPG::GetEPGForChannel(int channelUid, time_t start, time_t end, kodi::
broadcast.SetEpisodePartNumber(EPG_TAG_INVALID_SERIES_EPISODE);
// Backend could send epidode only as S00 and parts are not support
if (season <= 0 || episode == EPG_TAG_INVALID_SERIES_EPISODE)
{
{
std::regex base_regex("^.*\\([eE][pP](\\d+)(?:/?(\\d+))?\\)");
std::smatch base_match;
if (std::regex_search(description, base_match, base_regex))
Expand Down
11 changes: 4 additions & 7 deletions src/utilities/GenreMapper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ bool GenreMapper::ParseAllGenres(const tinyxml2::XMLNode* node, GenreBlock& genr
{
if (allGenres.find(EPG_STRING_TOKEN_SEPARATOR) != std::string::npos)
{
if (IsEnabled())
if (UseDvbGenre())
{
std::vector<std::string> genreCodes = kodi::tools::StringUtils::Split(allGenres, EPG_STRING_TOKEN_SEPARATOR);
if (genreCodes.size() == 2)
Expand All @@ -86,17 +86,14 @@ bool GenreMapper::ParseAllGenres(const tinyxml2::XMLNode* node, GenreBlock& genr
}
if (genreBlock.genreSubType == EPG_EVENT_CONTENTMASK_UNDEFINED)
{
if (genreBlock.genreType != EPG_GENRE_USE_STRING)
{
genreBlock.genreType = EPG_GENRE_USE_STRING;
}
genreBlock.genreSubType = EPG_GENRE_USE_STRING;
genreBlock.description = allGenres;
}
}
else if (!IsEnabled() && genreBlock.genreSubType != EPG_GENRE_USE_STRING)
else if (!UseDvbGenre() && genreBlock.genreSubType == EPG_EVENT_CONTENTMASK_UNDEFINED)
{
genreBlock.description = allGenres;
genreBlock.genreType = EPG_GENRE_USE_STRING;
genreBlock.genreSubType = EPG_GENRE_USE_STRING;
}

return true;
Expand Down
2 changes: 1 addition & 1 deletion src/utilities/GenreMapper.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ namespace NextPVR
int GetGenreType(std::string code);
int GetGenreSubType(std::string code);
bool ParseAllGenres(const tinyxml2::XMLNode* node, GenreBlock& genreBlock);
bool IsEnabled();
bool UseDvbGenre();

private:
GenreMapper() = default;
Expand Down

0 comments on commit 3a88ec2

Please sign in to comment.