yWeb: /control/getchannelinfo for short channel info added.

Line 1: servicename
Line 2: epg info
Line 3: duration X/Y


Origin commit data
------------------
Branch: ni/coolstream
Commit: b24077eeb9
Author: BPanther <bpanther_ts@hotmail.com>
Date: 2024-05-03 (Fri, 03 May 2024)



------------------
This commit was generated by Migit
This commit is contained in:
BPanther
2024-05-03 21:09:51 +02:00
committed by vanhofen
parent 21465ade0c
commit 4a6676262a
2 changed files with 33 additions and 0 deletions

View File

@@ -213,6 +213,7 @@ const CControlAPI::TyCgiCall CControlAPI::yCgiCallList[]=
{"signal", &CControlAPI::SignalInfoCGI, "text/plain"},
{"getonidsid", &CControlAPI::GetChannelIDCGI, "text/plain"},
{"getchannelid", &CControlAPI::GetChannelIDCGI, ""},
{"getchannelinfo", &CControlAPI::GetChannelInfoCGI, ""},
{"getepgid", &CControlAPI::GetEpgIDCGI, ""},
{"currenttpchannels", &CControlAPI::GetTPChannel_IDCGI, "text/plain"},
// boxcontrol - system
@@ -771,6 +772,37 @@ void CControlAPI::GetChannelIDCGI(CyhookHandler *hh)
hh->SendResult(result);
}
// get actual channel_info
void CControlAPI::GetChannelInfoCGI(CyhookHandler *hh)
{
t_channel_id channel_id = CZapit::getInstance()->GetCurrentChannelID();
CZapitChannel *channel = CServiceManager::getInstance()->FindChannel48(channel_id);
hh->outStart();
std::string result = "";
result = hh->outObject("name", hh->outValue(channel->getName()) + "\n");
CShortEPGData epg;
CSectionsdClient::responseGetCurrentNextInfoChannelID currentNextInfo;
CEitManager::getInstance()->getCurrentNextServiceKey(channel->getChannelID(), currentNextInfo);
if (CEitManager::getInstance()->getEPGidShort(currentNextInfo.current_uniqueKey, &epg))
{
result += hh->outObject("title", hh->outValue(epg.title) + "\n");
}
CChannelEvent event;
NeutrinoAPI->GetChannelEvents();
NeutrinoAPI->GetChannelEvent(channel->getChannelID(), event);
if (event.eventID)
{
result += hh->outObject("duration", string_printf("%d/", (time(NULL) - event.startTime) / 60) + string_printf("%d\n", event.duration / 60));
}
hh->SendResult(result);
}
//-------------------------------------------------------------------------
/** Display epg id's
* @param hh CyhookHandler