Skip to content

Commit

Permalink
yWeb: /control/getchannelinfo for short channel info added. Line 1: s…
Browse files Browse the repository at this point in the history
…ervicename, Line 2: epg info, Line 3: duration X/Y
  • Loading branch information
BPanther committed Apr 30, 2024
1 parent 3424569 commit 3498c8c
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 0 deletions.
32 changes: 32 additions & 0 deletions src/nhttpd/tuxboxapi/controlapi.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -173,6 +173,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
Expand Down Expand Up @@ -737,6 +738,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
Expand Down
1 change: 1 addition & 0 deletions src/nhttpd/tuxboxapi/controlapi.h
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,7 @@ class CControlAPI : public Cyhook
void GetBouquetsxmlCGI(CyhookHandler *hh);
void GetUBouquetsxmlCGI(CyhookHandler *hh);
void GetChannelIDCGI(CyhookHandler *hh);
void GetChannelInfoCGI(CyhookHandler *hh);
void GetEpgIDCGI(CyhookHandler *hh);
void GetTPChannel_IDCGI(CyhookHandler *hh);
void MessageCGI(CyhookHandler *hh);
Expand Down

0 comments on commit 3498c8c

Please sign in to comment.