Skip to content

Commit

Permalink
fix faulty epg, e.g. ATV
Browse files Browse the repository at this point in the history
  • Loading branch information
TangoCash authored and Frankenstone committed Oct 9, 2024
1 parent b6ddf40 commit 3587fa3
Showing 1 changed file with 24 additions and 5 deletions.
29 changes: 24 additions & 5 deletions src/eitd/SIevents.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -500,6 +500,7 @@ void SIevent::setName(unsigned int lang, const std::string &name)
{
std::string tmp = name;
std::replace(tmp.begin(), tmp.end(), '\n', ' ');
std::replace(tmp.begin(), tmp.end(), '\t', ' ');

if (CSectionsdClient::LANGUAGE_MODE_OFF == SIlanguage::getMode())
lang = 0;
Expand Down Expand Up @@ -537,19 +538,28 @@ void SIevent::setText(const std::string &lang, const std::string &text)

void SIevent::setText(unsigned int lang, const std::string &text)
{
std::string tmp = text;

std::string::size_type index = 0;
while ((index = tmp.find("\\n", index)) != std::string::npos)
{
tmp.replace(index, 2, "\n");
++index;
}

if (CSectionsdClient::LANGUAGE_MODE_OFF == SIlanguage::getMode())
lang = 0;

for (std::list<SILangData>::iterator it = langData.begin(); it != langData.end(); ++it)
if (it->lang == lang)
{
it->text[SILangData::langText] = text;
it->text[SILangData::langText] = tmp;
return;
}

SILangData ld;
ld.lang = lang;
ld.text[SILangData::langText] = text;
ld.text[SILangData::langText] = tmp;
langData.push_back(ld);
}

Expand All @@ -573,6 +583,15 @@ void SIevent::appendExtendedText(const std::string &lang, const std::string &tex

void SIevent::appendExtendedText(unsigned int lang, const std::string &text, bool append, bool endappend)
{
std::string tmp = text;

std::string::size_type index = 0;
while ((index = tmp.find("\\n", index)) != std::string::npos)
{
tmp.replace(index, 2, "\n");
++index;
}

if (CSectionsdClient::LANGUAGE_MODE_OFF == SIlanguage::getMode())
lang = 0;

Expand All @@ -581,22 +600,22 @@ void SIevent::appendExtendedText(unsigned int lang, const std::string &text, boo
{
if (append)
{
it->text[SILangData::langExtendedText] += text;
it->text[SILangData::langExtendedText] += tmp;
if (endappend && it->text[SILangData::langExtendedText].capacity() > it->text[SILangData::langExtendedText].size())
{
it->text[SILangData::langExtendedText].reserve();
}
}
else
{
it->text[SILangData::langExtendedText] = text;
it->text[SILangData::langExtendedText] = tmp;
}
return;
}

SILangData ld;
ld.lang = lang;
ld.text[SILangData::langExtendedText] = text;
ld.text[SILangData::langExtendedText] = tmp;
langData.push_back(ld);
}

Expand Down

0 comments on commit 3587fa3

Please sign in to comment.