From bb7a4fc19f83a1ed58b3acb86df30b60ea113703 Mon Sep 17 00:00:00 2001 From: TangoCash Date: Sun, 20 Sep 2020 21:10:53 +0200 Subject: [PATCH] keep all logo-naming conventions together Origin commit data ------------------ Branch: ni/coolstream Commit: https://github.com/neutrino-images/ni-neutrino/commit/978fcedcbed484fb20167cb596874db699dc22a8 Author: TangoCash Date: 2020-09-20 (Sun, 20 Sep 2020) ------------------ No further description and justification available within origin commit message! ------------------ This commit was generated by Migit --- src/driver/pictureviewer/pictureviewer.cpp | 34 ++-------------------- src/gui/streaminfo2.cpp | 12 +------- src/system/helpers.cpp | 32 ++++++++++++++++++++ src/system/helpers.h | 1 + 4 files changed, 36 insertions(+), 43 deletions(-) diff --git a/src/driver/pictureviewer/pictureviewer.cpp b/src/driver/pictureviewer/pictureviewer.cpp index d696846b7..549efa716 100644 --- a/src/driver/pictureviewer/pictureviewer.cpp +++ b/src/driver/pictureviewer/pictureviewer.cpp @@ -570,20 +570,7 @@ bool CPictureViewer::GetLogoName(const uint64_t &ChannelID, const std::string &C if (g_settings.logo_hdd_dir != LOGODIR) v_path.push_back(LOGODIR); - std::transform(EventName.begin(), EventName.end(), EventName.begin(), ::tolower); - EventName = str_replace(" ", "-", EventName); - EventName = str_replace(",", "-", EventName); - EventName = str_replace(";", "-", EventName); - EventName = str_replace(":", "-", EventName); - EventName = str_replace("+", "-", EventName); - EventName = str_replace("'", "-", EventName); - EventName = str_replace("?", "-", EventName); - EventName = str_replace("!", "-", EventName); - EventName = str_replace("&", "-", EventName); - EventName = str_replace("ä", "ae", EventName); - EventName = str_replace("ö", "oe", EventName); - EventName = str_replace("ü", "ue", EventName); - EventName = str_replace("ß", "ss", EventName); + EventName = GetSpecialName(EventName); //printf("GetLogoName(): EventName \"%s\"\n", EventName.c_str()); for (size_t i = 0; i < (sizeof(fileType) / sizeof(fileType[0])); i++) @@ -607,24 +594,7 @@ bool CPictureViewer::GetLogoName(const uint64_t &ChannelID, const std::string &C } // create special filename from channelname - std::string SpecialChannelName = ChannelName; - std::transform(SpecialChannelName.begin(), SpecialChannelName.end(), SpecialChannelName.begin(), ::tolower); - SpecialChannelName = str_replace(" ", "-", SpecialChannelName); - SpecialChannelName = str_replace("ä", "a", SpecialChannelName); - SpecialChannelName = str_replace("ö", "o", SpecialChannelName); - SpecialChannelName = str_replace("ü", "u", SpecialChannelName); - SpecialChannelName = str_replace("+", "___plus___", SpecialChannelName); - SpecialChannelName = str_replace("&", "___and___", SpecialChannelName); - // - SpecialChannelName = str_replace(",", "-", SpecialChannelName); - SpecialChannelName = str_replace(";", "-", SpecialChannelName); - SpecialChannelName = str_replace(":", "-", SpecialChannelName); - SpecialChannelName = str_replace("*", "-", SpecialChannelName); - SpecialChannelName = str_replace("'", "-", SpecialChannelName); - SpecialChannelName = str_replace("?", "-", SpecialChannelName); - SpecialChannelName = str_replace("|", "-", SpecialChannelName); - SpecialChannelName = str_replace("/", "-", SpecialChannelName); - SpecialChannelName = str_replace("\\", "-", SpecialChannelName); + std::string SpecialChannelName = GetSpecialName(ChannelName); // create channel id as string char strChnId[16]; diff --git a/src/gui/streaminfo2.cpp b/src/gui/streaminfo2.cpp index ab7fe1222..d614bb5b4 100644 --- a/src/gui/streaminfo2.cpp +++ b/src/gui/streaminfo2.cpp @@ -1149,17 +1149,7 @@ void CStreamInfo2::paint_techinfo(int xpos, int ypos) // special channellogo r.key = "Special Logo"; r.key += ": "; - std::string SpecialChannelName = channel->getName().c_str(); - SpecialChannelName = str_replace(" ", "_", SpecialChannelName); - SpecialChannelName = str_replace(",", "-", SpecialChannelName); - SpecialChannelName = str_replace(";", "-", SpecialChannelName); - SpecialChannelName = str_replace(":", "-", SpecialChannelName); - SpecialChannelName = str_replace("*", "-", SpecialChannelName); - SpecialChannelName = str_replace("'", "-", SpecialChannelName); - SpecialChannelName = str_replace("?", "-", SpecialChannelName); - SpecialChannelName = str_replace("|", "-", SpecialChannelName); - SpecialChannelName = str_replace("/", "-", SpecialChannelName); - SpecialChannelName = str_replace("\\", "-", SpecialChannelName); + std::string SpecialChannelName = GetSpecialName(channel->getName()); snprintf(buf, sizeof(buf), "%s.png", SpecialChannelName.c_str()); r.val = buf; v.push_back(r); diff --git a/src/system/helpers.cpp b/src/system/helpers.cpp index 74fd4b465..c7e6998ef 100644 --- a/src/system/helpers.cpp +++ b/src/system/helpers.cpp @@ -2104,3 +2104,35 @@ int getActivePartition() return c; } + +// Why different name conventions ? +// i put them all together here, and keep the simplest +//name = str_replace(" ", "_", name); +//name = str_replace("ä", "a", name); +//name = str_replace("ö", "o", name); +//name = str_replace("ü", "u", name); +//name = str_replace("+", "___plus___", name); +//name = str_replace("&", "___and___", name); +std::string GetSpecialName(std::string name) +{ + std::transform(name.begin(), name.end(), name.begin(), ::tolower); + name = str_replace(" ", "-", name); + name = str_replace("ä", "ae", name); + name = str_replace("ö", "oe", name); + name = str_replace("ü", "ue", name); + name = str_replace("ß", "ss", name); + name = str_replace("+", "-", name); + name = str_replace("&", "-", name); + name = str_replace("!", "-", name); + name = str_replace(",", "-", name); + name = str_replace(";", "-", name); + name = str_replace(":", "-", name); + name = str_replace("*", "-", name); + name = str_replace("'", "-", name); + name = str_replace("?", "-", name); + name = str_replace("|", "-", name); + name = str_replace("/", "-", name); + name = str_replace("\\", "-", name); + + return name; +} diff --git a/src/system/helpers.h b/src/system/helpers.h index 05875112a..8ef730d52 100644 --- a/src/system/helpers.h +++ b/src/system/helpers.h @@ -194,4 +194,5 @@ bool isDigitWord(std::string str); int getActivePartition(); +std::string GetSpecialName(std::string NormalName); #endif