webtv/xmltv: add remote hostname as group prefix to see where the stream is come from

Origin commit data
------------------
Branch: ni/coolstream
Commit: 3d669081fd
Author: vanhofen <vanhofen@gmx.de>
Date: 2018-12-21 (Fri, 21 Dec 2018)

Origin message was:
------------------
- webtv/xmltv: add remote hostname as group prefix to see where the stream is come from

------------------
No further description and justification available within origin commit message!

------------------
This commit was generated by Migit
This commit is contained in:
vanhofen
2018-12-21 23:50:26 +01:00
parent 774b23685e
commit 466f4d0b09
2 changed files with 13 additions and 2 deletions

View File

@@ -3321,6 +3321,10 @@ void CControlAPI::xmltvm3uCGI(CyhookHandler *hh)
else else
host = "http://" + hh->HeaderList["Host"]; host = "http://" + hh->HeaderList["Host"];
// get hostname
char hostname[HOST_NAME_MAX];
gethostname(hostname, HOST_NAME_MAX);
// build url // build url
std::string url = host; std::string url = host;
/* strip off optional custom port */ /* strip off optional custom port */
@@ -3350,6 +3354,7 @@ void CControlAPI::xmltvm3uCGI(CyhookHandler *hh)
result += " tvg-logo=\"" + host + NeutrinoAPI->getLogoFile(channel->getChannelID()) + "\""; result += " tvg-logo=\"" + host + NeutrinoAPI->getLogoFile(channel->getChannelID()) + "\"";
else else
result += " tvg-logo=\"\""; result += " tvg-logo=\"\"";
result += " group-prefix=\"" + std::string(hostname) + "\"";
result += " group-title=\"" + bouq_name + "\","; result += " group-title=\"" + bouq_name + "\",";
result += channel->getName() + "\n"; result += channel->getName() + "\n";
result += url + string_printf(PRINTF_CHANNEL_ID_TYPE_NO_LEADING_ZEROS, channel->getChannelID()) + "\n"; result += url + string_printf(PRINTF_CHANNEL_ID_TYPE_NO_LEADING_ZEROS, channel->getChannelID()) + "\n";

View File

@@ -53,6 +53,7 @@
#define TVG_INFO_NAME_MARKER "tvg-name=" #define TVG_INFO_NAME_MARKER "tvg-name="
#define TVG_INFO_LOGO_MARKER "tvg-logo=" #define TVG_INFO_LOGO_MARKER "tvg-logo="
#define TVG_INFO_SHIFT_MARKER "tvg-shift=" #define TVG_INFO_SHIFT_MARKER "tvg-shift="
#define GROUP_PREFIX_MARKER "group-prefix="
#define GROUP_NAME_MARKER "group-title=" #define GROUP_NAME_MARKER "group-title="
extern CBouquetManager *g_bouquetManager; extern CBouquetManager *g_bouquetManager;
@@ -975,6 +976,7 @@ void CBouquetManager::loadWebchannels(int mode)
char cLine[1024]; char cLine[1024];
std::string desc = ""; std::string desc = "";
std::string title = ""; std::string title = "";
std::string prefix = "";
std::string group = ""; std::string group = "";
std::string epgid = ""; std::string epgid = "";
std::string alogo = ""; std::string alogo = "";
@@ -1001,6 +1003,7 @@ void CBouquetManager::loadWebchannels(int mode)
int iColon = (int)strLine.find_first_of(':'); int iColon = (int)strLine.find_first_of(':');
int iComma = (int)strLine.find_last_of(','); int iComma = (int)strLine.find_last_of(',');
title = ""; title = "";
prefix = "";
group = ""; group = "";
desc = ""; desc = "";
alogo = ""; alogo = "";
@@ -1012,6 +1015,7 @@ void CBouquetManager::loadWebchannels(int mode)
title = strLine.substr(iComma); title = strLine.substr(iComma);
std::string strInfoLine = strLine.substr(iColon, --iComma - iColon); std::string strInfoLine = strLine.substr(iColon, --iComma - iColon);
desc = ReadMarkerValue(strInfoLine, TVG_INFO_NAME_MARKER); desc = ReadMarkerValue(strInfoLine, TVG_INFO_NAME_MARKER);
prefix = ReadMarkerValue(strInfoLine, GROUP_PREFIX_MARKER);
group = ReadMarkerValue(strInfoLine, GROUP_NAME_MARKER); group = ReadMarkerValue(strInfoLine, GROUP_NAME_MARKER);
epgid = ReadMarkerValue(strInfoLine, TVG_INFO_ID_MARKER); epgid = ReadMarkerValue(strInfoLine, TVG_INFO_ID_MARKER);
alogo = ReadMarkerValue(strInfoLine, TVG_INFO_LOGO_MARKER); alogo = ReadMarkerValue(strInfoLine, TVG_INFO_LOGO_MARKER);
@@ -1037,8 +1041,10 @@ void CBouquetManager::loadWebchannels(int mode)
CZapitBouquet* gbouquet = pbouquet; CZapitBouquet* gbouquet = pbouquet;
if (!group.empty()) if (!group.empty())
{ {
std::string bname = (mode == MODE_WEBTV) ? "[WebTV] " : "[WebRadio] "; std::string bname = prefix;
bname += group; if (bname.compare("") == 0)
bname = (mode == MODE_WEBTV) ? "WebTV" : "WebRadio";
bname += ": " + group;
gbouquet = addBouquetIfNotExist(bname); gbouquet = addBouquetIfNotExist(bname);
if (mode == MODE_WEBTV) if (mode == MODE_WEBTV)
gbouquet->bWebtv = true; gbouquet->bWebtv = true;