Skip to content

Commit

Permalink
yWeb: /control/getchannelinfo changed. Line 1: servicename, Line 2: e…
Browse files Browse the repository at this point in the history
…pg now, Line 3: epg now duration X/Y, Line 4: epg next
  • Loading branch information
BPanther committed Apr 30, 2024
1 parent 3498c8c commit 866fc19
Showing 1 changed file with 14 additions and 10 deletions.
24 changes: 14 additions & 10 deletions src/nhttpd/tuxboxapi/controlapi.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -749,22 +749,26 @@ void CControlAPI::GetChannelInfoCGI(CyhookHandler *hh)
result = hh->outObject("name", hh->outValue(channel->getName()) + "\n");

CShortEPGData epg;
CSectionsdClient::responseGetCurrentNextInfoChannelID currentNextInfo;
CEitManager::getInstance()->getCurrentNextServiceKey(channel->getChannelID(), currentNextInfo);
CSectionsdClient::CurrentNextInfo CurrentNext;
CEitManager::getInstance()->getCurrentNextServiceKey(channel_id, CurrentNext);

if (CEitManager::getInstance()->getEPGidShort(currentNextInfo.current_uniqueKey, &epg))
if (CurrentNext.flags & CSectionsdClient::epgflags::has_current)
{
result += hh->outObject("title", hh->outValue(epg.title) + "\n");
result += hh->outObject("epg_now", hh->outValue(CurrentNext.current_name) + "\n");
result += hh->outObject("duration", string_printf("%d/", (abs(time(NULL) - CurrentNext.current_zeit.startzeit) + 30) / 60) + string_printf("%d\n", CurrentNext.current_zeit.dauer / 60));
}
else
{
result += hh->outObject("epg_now", "\n");
result += hh->outObject("duration", "0/0\n");
}

CChannelEvent event;
NeutrinoAPI->GetChannelEvents();
NeutrinoAPI->GetChannelEvent(channel->getChannelID(), event);

if (event.eventID)
if (CurrentNext.flags & CSectionsdClient::epgflags::has_next)
{
result += hh->outObject("duration", string_printf("%d/", (time(NULL) - event.startTime) / 60) + string_printf("%d\n", event.duration / 60));
result += hh->outObject("epg_next", hh->outValue(CurrentNext.next_name) + "\n");
}
else
result += hh->outObject("epg_next", "\n");

hh->SendResult(result);
}
Expand Down

0 comments on commit 866fc19

Please sign in to comment.