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 c5c6578
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 12 deletions.
3 changes: 2 additions & 1 deletion pvr.nextpvr/changelog.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
v21.3.1
- Fix custom genres
- Translations updates from Weblate
- af_za, am_et, ar_sa, ast_es, az_az, be_by, bg_bg, bs_ba, ca_es, cs_cz, cy_gb, da_dk, de_de, el_gr, en_au, en_nz, en_us, eo, es_ar, es_es, es_mx, et_ee, eu_es, fa_af, fa_ir, fi_fi, fo_fo, fr_ca, fr_fr, gl_es, he_il, hi_in, hr_hr, hu_hu, hy_am, id_id, is_is, it_it, ja_jp, ko_kr, lt_lt, lv_lv, mi, mk_mk, ml_in, mn_mn, ms_my, mt_mt, my_mm, nb_no, nl_nl, pl_pl, pt_br, pt_pt, ro_ro, ru_ru, si_lk, sk_sk, sl_si, sq_al, sr_rs, sr_rs@latin, sv_se, szl, ta_in, te_in, tg_tj, th_th, tr_tr, uk_ua, uz_uz, vi_vn, zh_cn, zh_tw
- af_za, am_et, ar_sa, ast_es, az_az, be_by, bg_bg, bs_ba, ca_es, cs_cz, cy_gb, da_dk, de_de, el_gr, en_au, en_nz, en_us, eo, es_ar, es_es, es_mx, et_ee, eu_es, fa_af, fa_ir, fi_fi, fo_fo, fr_ca, fr_fr, gl_es, he_il, hi_in, hr_hr, hu_hu, hy_am, id_id, is_is, it_it, ja_jp, ko_kr, lt_lt, lv_lv, mi, mk_mk, ml_in, mn_mn, ms_my, mt_mt, my_mm, nb_no, nl_nl, pl_pl, pt_br, pt_pt, ro_ro, ru_ru, si_lk, sk_sk, sl_si, sq_al, sr_rs, sr_rs@latin, sv_se, szl, ta_in, te_in, tg_tj, th_th, tr_tr, uk_ua, uz_uz, vi_vn, zh_cn, zh_tw

v21.3.0
- Support EPG genre sub type for better genre display
Expand Down
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
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 c5c6578

Please sign in to comment.