Skip to content

Commit

Permalink
Fix custom genre strings
Browse files Browse the repository at this point in the history
For custom genre strings xbmc/xbmc#16541 states that is GenreSubType that needs to be used.
  • Loading branch information
emveepee committed Jan 22, 2025
1 parent 80f2cd6 commit c88418c
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 10 deletions.
1 change: 0 additions & 1 deletion src/EPG.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,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_subtype"));

}

NextPVR::GenreBlock genreBlock = { sGenre, broadcast.GetGenreType(), EPG_EVENT_CONTENTMASK_UNDEFINED };
Expand Down
13 changes: 5 additions & 8 deletions src/utilities/GenreMapper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ GenreMapper::GenreMapper(const std::shared_ptr<InstanceSettings>& settings) : m_
GenreMapper::~GenreMapper() {}


bool GenreMapper::IsEnabled()
bool GenreMapper::UseDvbGenre()
{
return !m_settings->m_genreString;
}
Expand Down 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 c88418c

Please sign in to comment.