void CControlAPI::SendTimers(CWebserverRequest* request) { CTimerd::TimerList timerlist; // List of bouquets timerlist.clear(); Parent->Timerd->getTimerList(timerlist); CZapitClient::BouquetChannelList channellist; channellist.clear(); CTimerd::TimerList::iterator timer = timerlist.begin(); for(; timer != timerlist.end();timer++) { // Add Data char zAddData[20+1]={0}; switch(timer->eventType) { case CTimerd::TIMER_NEXTPROGRAM : case CTimerd::TIMER_ZAPTO : case CTimerd::TIMER_RECORD : { if(channellist.size()==0) { Parent->Zapit->getChannels(channellist); } CZapitClient::BouquetChannelList::iterator channel = channellist.begin(); for(; channel != channellist.end();channel++) { if(channel->channel_id==timer->channel_id) { strncpy(zAddData, channel->name, 20); zAddData[20]=0; break; } } if(channel == channellist.end()) strcpy(zAddData,"Unknown"); } break; case CTimerd::TIMER_STANDBY : { sprintf(zAddData,"Standby: %s",(timer->standby_on ? "ON" : "OFF")); } break; default:{} } request->printf("%d %d %d %d %d %d %s\n",timer->eventID,(int)timer->eventType, (int)timer->eventRepeat,(int)timer->announceTime, (int)timer->alarmTime,(int)timer->stopTime,zAddData); } }
void CTimerdClient::getTimerList(CTimerd::TimerList &timerlist) { CTimerdMsg::generalInteger responseInteger; CTimerd::responseGetTimer response; send(CTimerdMsg::CMD_GETTIMERLIST); timerlist.clear(); if (CBasicClient::receive_data((char* )&responseInteger, sizeof(responseInteger))) { while (responseInteger.number-- > 0) { if (CBasicClient::receive_data((char*)&response, sizeof(response))) if (response.eventState != CTimerd::TIMERSTATE_TERMINATED) timerlist.push_back(response); }; } close_connection(); }
//------------------------------------------------------------------------- // Template 1:classname, 2:zAlarmTime, 3: zStopTime, 4:zRep, 5:zRepCouunt // 6:zType, 7:sAddData, 8:timer->eventID, 9:timer->eventID //------------------------------------------------------------------------- std::string CNeutrinoYParser::func_get_timer_list(CyhookHandler *, std::string para) { std::string yresult; CTimerd::TimerList timerlist; // List of bouquets timerlist.clear(); NeutrinoAPI->Timerd->getTimerList(timerlist); sort(timerlist.begin(), timerlist.end()); CZapitClient::BouquetChannelList channellist_tv; CZapitClient::BouquetChannelList channellist_radio; channellist_tv.clear(); channellist_radio.clear(); int i = 1; char classname= 'a'; CTimerd::TimerList::iterator timer = timerlist.begin(); for(; timer != timerlist.end();++timer) { classname = (i++&1)?'a':'b'; // build alarm/stoptime char zAlarmTime[25] = {0}; struct tm *alarmTime = localtime(&(timer->alarmTime)); strftime(zAlarmTime,20,"%d.%m. %H:%M",alarmTime); char zAnnounceTime[25] = {0}; struct tm *announceTime = localtime(&(timer->announceTime)); strftime(zAnnounceTime,20,"%d.%m. %H:%M",announceTime); char zStopTime[25] = {0}; if(timer->stopTime > 0) { struct tm *stopTime = localtime(&(timer->stopTime)); strftime(zStopTime,20,"%d.%m. %H:%M",stopTime); } // repeat std::string zRep = NeutrinoAPI->timerEventRepeat2Str(timer->eventRepeat); std::string zRepCount; if (timer->eventRepeat == CTimerd::TIMERREPEAT_ONCE) zRepCount = "-"; else zRepCount = (timer->repeatCount == 0) ? "∞" : string_printf("%dx",timer->repeatCount); // timer type std::string zType = NeutrinoAPI->timerEventType2Str(timer->eventType); // Add Data std::string sAddData=""; switch(timer->eventType) { //case CTimerd::TIMER_NEXTPROGRAM : case CTimerd::TIMER_ZAPTO : case CTimerd::TIMER_RECORD : { sAddData = NeutrinoAPI->GetServiceName(timer->channel_id); if (sAddData.empty()) sAddData = CServiceManager::getInstance()->IsChannelTVChannel(timer->channel_id) ? "Unknown TV-Channel" : "Unknown Radio-Channel"; if( timer->apids != TIMERD_APIDS_CONF) { std::string separator = ""; sAddData += '('; if( timer->apids & TIMERD_APIDS_STD ) { sAddData += "STD"; separator = "/"; } if( timer->apids & TIMERD_APIDS_ALT ) { sAddData += separator; sAddData += "ALT"; separator = "/"; } if( timer->apids & TIMERD_APIDS_AC3 ) { sAddData += separator; sAddData += "AC3"; separator = "/"; } sAddData += ')'; } if(timer->epgID!=0) { CEPGData epgdata; if (CEitManager::getInstance()->getEPGid(timer->epgID, timer->epg_starttime, &epgdata)) sAddData+="<br/>" + epgdata.title; else sAddData+=std::string("<br/>")+timer->epgTitle; } else sAddData+=std::string("<br/>")+timer->epgTitle; } break; case CTimerd::TIMER_STANDBY : { sAddData = "Standby: "; if(timer->standby_on) sAddData+= "An"; else sAddData+="Aus"; } break; case CTimerd::TIMER_REMIND : sAddData = std::string(timer->message).substr(0,20); break; case CTimerd::TIMER_EXEC_PLUGIN : sAddData = std::string(timer->pluginName); break; default:{} } yresult += string_printf(para.c_str(), classname, zAlarmTime, zStopTime, zRep.c_str(), zRepCount.c_str(), zType.c_str(), sAddData.c_str(),timer->eventID,timer->eventID); } //classname = (i++&1)?'a':'b'; return yresult; }