From bca0d06e603172d1580d061b585c6b6cbe853f71 Mon Sep 17 00:00:00 2001 From: BPanther Date: Fri, 3 May 2024 21:09:51 +0200 Subject: [PATCH] yWeb: /control/getchannelinfo changed. Line 1: servicename Line 2: epg now Line 3: epg now duration X/Y Line 4: epg next Origin commit data ------------------ Commit: https://github.com/Duckbox-Developers/neutrino-ddt/commit/866fc19dd0fcaee085304721e11ce9af977d536d Author: BPanther Date: 2024-04-30 (Tue, 30 Apr 2024) ------------------ This commit was generated by Migit --- src/nhttpd/tuxboxapi/controlapi.cpp | 24 ++++++++++++++---------- 1 file changed, 14 insertions(+), 10 deletions(-) diff --git a/src/nhttpd/tuxboxapi/controlapi.cpp b/src/nhttpd/tuxboxapi/controlapi.cpp index 7a2783a40..3827a852f 100644 --- a/src/nhttpd/tuxboxapi/controlapi.cpp +++ b/src/nhttpd/tuxboxapi/controlapi.cpp @@ -774,22 +774,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); }