2012-03-16, 04:00
(2012-03-15, 00:20)mcheng89 Wrote:(2012-03-14, 19:38)jdembski Wrote: @mcheng89:
Could you share your bit of code where you transfer the EPG entries to XBMC? I think you know why this is interesting for me
Heres the epg part:
Let me know if you need more, or if you want I can send you the whole program.
I'm still working on it...
Code:int GetEPGDataForChannel(PVR_HANDLE handle, int channel, time_t iStart, time_t iEnd) {
static int unique_id = 1;
XBMC->Log(ADDON::LOG_NOTICE, "PVRCLIENT: GetEPGDataForChannel()" );
if (iEnd-iStart>32400)
iEnd = iStart+32400;
for (int start=iStart; start<iEnd;) {
char strBuffer[11], strChannel[11];
snprintf(strChannel, 11, "%i", channel);
snprintf(strBuffer, 11, "%i", start);
std::string request = std::string("{\"start_time\":")+strBuffer+",";
snprintf(strBuffer, 11, "%i", (start+10800>iEnd?iEnd:start+10800));
request = request + "\"end_time\":"+strBuffer+",\"channels\":["+strChannel+"]}";
start = start+10800;
//XBMC->Log(ADDON::LOG_NOTICE, ("PVRCLIENT: "+request).c_str() );
std::string path = "/getEPGData";
std::string data = httpRequest("192.168.1.4",8555,path,httpDigestHeaders("username","password","POST",path),request);
//XBMC->Log(ADDON::LOG_NOTICE, ("PVRCLIENT: "+data).c_str() );
json_object *json_data = json_tokener_parse(data.c_str());
if (json_data != 0) {
json_object *channel_epg = json_object_object_get(json_data, strChannel);
if (channel_epg) {
int channel_len = json_object_array_length(channel_epg);
for (int i=0; i<channel_len; i++) {
json_object *channel_obj = json_object_array_get_idx(channel_epg, i);
json_object *program_title_obj = json_object_object_get(channel_obj, "program_title");
json_object *program_subtitle_obj = json_object_object_get(channel_obj, "program_subtitle");
json_object *program_descript_obj = json_object_object_get(channel_obj, "program_descript");
json_object *start_time_obj = json_object_object_get(channel_obj, "start_time");
json_object *end_time_obj = json_object_object_get(channel_obj, "end_time");
EPG_TAG tag;
memset(&tag, 0, sizeof(EPG_TAG));
tag.iUniqueBroadcastId = unique_id++;
tag.strTitle = json_object_get_string(program_title_obj);
tag.iChannelNumber = channel;
tag.startTime = json_object_get_int(start_time_obj);
tag.endTime = json_object_get_int(end_time_obj);
tag.strEpisodeName = json_object_get_string(program_subtitle_obj);
tag.strPlot = json_object_get_string(program_descript_obj);
PVR->TransferEpgEntry(handle, &tag);
if (start < tag.endTime)
start = tag.endTime;
}
}
json_object_put(json_data);
return 0;
}
}
return -1;
}
EDIT: logomapper v2
http://www.mediafire.com/?v2pewj4yhcfc51b
Will finish up XBMC pvr tomorrow...
Ok the logomapper is working better now, except that I noticed that the affiliate name is case sensitive. When I corrected this in javascript for my logomapper I used toUpperCase() on both strings when doing my comparison to eliminate the case sensitivity, perhaps you can find something similar in c# (or whatever language your using i forget lol)
EDIT: I post the new webgui tonight, have not looked into solving the security issue yet..