[dev] CetonTV+HDHomeRun - Watch TV on XBMC (WIN/OSX)

  Thread Rating:
  • 5 Votes - 5 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Post Reply
europorsche914 Offline
Member
Posts: 88
Joined: Jan 2012
Reputation: 0
Post: #481
(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 Wink

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..
(This post was last modified: 2012-03-16 04:02 by europorsche914.)
find quote
mcheng89 Offline
Fan
Posts: 373
Joined: Jan 2012
Reputation: 2
Post: #482
(2012-03-16 04:00)europorsche914 Wrote:  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)

Will fix right now... give me about 5 minutes

logomapper v3:
http://www.mediafire.com/?ya3hnalc1xaylkv

XBMC pvr is completely functional now Smile... Need to read in the settings values now.
(This post was last modified: 2012-03-16 04:26 by mcheng89.)
find quote
europorsche914 Offline
Member
Posts: 88
Joined: Jan 2012
Reputation: 0
Post: #483
(2012-03-16 04:02)mcheng89 Wrote:  
(2012-03-16 04:00)europorsche914 Wrote:  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)

Will fix right now... give me about 5 minutes

logomapper v3:
http://www.mediafire.com/?ya3hnalc1xaylkv

Ok were getting closer, that got me a couple more logos that werent mapped now the last issue im seeing is that the affiliates.xml map, (probably affects the logos.xml map as well) has some logos that claim to be available in color which are not (for the fox affiliate, affiliates.xml states the color logo is fox.png when in fact no fox.png exists in the Logos/color folder) when this occurs the logo mapper should fall back to the bw filename in the Logos/BW folder. I think with this correction we will have it working perfectly Smile
(This post was last modified: 2012-03-16 04:28 by europorsche914.)
find quote
mcheng89 Offline
Fan
Posts: 373
Joined: Jan 2012
Reputation: 2
Post: #484
(2012-03-16 04:26)europorsche914 Wrote:  Ok were getting closer, that got me a couple more logos that werent mapped now the last issue im seeing is that the affiliates.xml map, (probably affects the logos.xml map as well) has some logos that claim to be available in color which are not (for the fox affiliate, affiliates.xml states the color logo is fox.png when in fact no fox.png exists in the Logos/color folder) when this occurs the logo mapper should fall back to the bw filename in the Logos/BW folder. I think with this correction we will have it working perfectly Smile

Ok. I changed it to check if the color logo exists first and if it doesnt exists check for the BW logo.
Will put up another version soon...

http://www.mediafire.com/?5oqsfdsvmrowa6n
(This post was last modified: 2012-03-16 04:43 by mcheng89.)
find quote
europorsche914 Offline
Member
Posts: 88
Joined: Jan 2012
Reputation: 0
Post: #485
(2012-03-16 04:34)mcheng89 Wrote:  
(2012-03-16 04:26)europorsche914 Wrote:  Ok were getting closer, that got me a couple more logos that werent mapped now the last issue im seeing is that the affiliates.xml map, (probably affects the logos.xml map as well) has some logos that claim to be available in color which are not (for the fox affiliate, affiliates.xml states the color logo is fox.png when in fact no fox.png exists in the Logos/color folder) when this occurs the logo mapper should fall back to the bw filename in the Logos/BW folder. I think with this correction we will have it working perfectly Smile

Ok. I changed it to check if the color logo exists first and if it doesnt exists check for the BW logo.
Will put up another version soon...

http://www.mediafire.com/?5oqsfdsvmrowa6n

almost there now I have all logos but every logo is in black and white now lol

BTW does the api now deinterlace? just want to confirm so I can remove the deinterlace command from the web gui
(This post was last modified: 2012-03-16 04:55 by europorsche914.)
find quote
mcheng89 Offline
Fan
Posts: 373
Joined: Jan 2012
Reputation: 2
Post: #486
(2012-03-16 04:52)europorsche914 Wrote:  almost there now I have all logos but every logo is in black and white now lol

BTW does the api now deinterlace? just want to confirm so I can remove the deinterlace command from the web gui

my bad... i didnt test it Tongue
http://www.mediafire.com/?h91g5s6en1yftgz

Deinterlace isnt on for direct stream
I think its on for any of the transcoded streams
(This post was last modified: 2012-03-16 05:02 by mcheng89.)
find quote
europorsche914 Offline
Member
Posts: 88
Joined: Jan 2012
Reputation: 0
Post: #487
(2012-03-16 05:00)mcheng89 Wrote:  
(2012-03-16 04:52)europorsche914 Wrote:  almost there now I have all logos but every logo is in black and white now lol

BTW does the api now deinterlace? just want to confirm so I can remove the deinterlace command from the web gui

my bad... i didnt test it Tongue
http://www.mediafire.com/?h91g5s6en1yftgz

Deinterlace isnt on for direct stream
I think its on for any of the transcoded streams

All good now Smile only other thing I can think of is storing the logos in the webfiles/resources directory instead of having the user manually copy them but thats minor..

Do you have plans to activate deinterlacing for the direct stream in the future? If not i can do a check to see if the stream is original quality and then deinterlace if needed.
find quote
mcheng89 Offline
Fan
Posts: 373
Joined: Jan 2012
Reputation: 2
Post: #488
(2012-03-16 05:09)europorsche914 Wrote:  All good now Smile only other thing I can think of is storing the logos in the webfiles/resources directory instead of having the user manually copy them but thats minor..

Do you have plans to activate deinterlacing for the direct stream in the future? If not i can do a check to see if the stream is original quality and then deinterlace if needed.

If you want I can make a getChannelLogo?channel=<channel_number> api to get the logo? (or something like that)
I dont think that deinterlace works without transcoding... or at least VLC doesnt deinterlace the stream
(This post was last modified: 2012-03-16 05:15 by mcheng89.)
find quote
europorsche914 Offline
Member
Posts: 88
Joined: Jan 2012
Reputation: 0
Post: #489
(2012-03-16 05:14)mcheng89 Wrote:  
(2012-03-16 05:09)europorsche914 Wrote:  All good now Smile only other thing I can think of is storing the logos in the webfiles/resources directory instead of having the user manually copy them but thats minor..

Do you have plans to activate deinterlacing for the direct stream in the future? If not i can do a check to see if the stream is original quality and then deinterlace if needed.

If you want I can make a getChannelLogo?channel=<channel_number> api to get the logo? (or something like that)
I dont think that deinterlace works without transcoding... or at least VLC doesnt deinterlace the stream

Its fine with me if the api serves the logo, especially if you have plans for adding the logos to the guide in xbmc pvr Wink , just let me know the call and ill implement it.
Ok Ill write something up quick to deinterlace for direct stream only.
(This post was last modified: 2012-03-16 05:17 by europorsche914.)
find quote
mcheng89 Offline
Fan
Posts: 373
Joined: Jan 2012
Reputation: 2
Post: #490
(2012-03-16 05:17)europorsche914 Wrote:  Its fine with me if the api serves the logo, especially if you have plans for adding the logos to the guide in xbmc pvr Wink , just let me know the call and ill implement it.
Ok Ill write something up quick to deinterlace for direct stream only.

Just use that one. I'll put it in soon... just putting some last touches on the pvr build
find quote
Post Reply