Kodi Community Forum
[RELEASE] XBMC Flicks - Netflix Movies / TV Shows (Video) experimental Addon for XBMC - Printable Version

+- Kodi Community Forum (https://forum.kodi.tv)
+-- Forum: Support (https://forum.kodi.tv/forumdisplay.php?fid=33)
+--- Forum: Add-on Support (https://forum.kodi.tv/forumdisplay.php?fid=27)
+---- Forum: Video Add-ons (https://forum.kodi.tv/forumdisplay.php?fid=154)
+---- Thread: [RELEASE] XBMC Flicks - Netflix Movies / TV Shows (Video) experimental Addon for XBMC (/showthread.php?tid=87552)



RE: [RELEASE] XBMC Flicks - Netflix Movies / TV Shows (Video) experimental Addon for XBMC - dordar - 2012-09-24

Ok. I got a bit confused., but now we are on the same Page. Is anyone looking into this?


RE: [RELEASE] XBMC Flicks - Netflix Movies / TV Shows (Video) experimental Addon for XBMC - patdavid - 2012-09-24

I am still looking into this, and tracing through fekkers code. I'll update when I've made some progress.


RE: [RELEASE] XBMC Flicks - Netflix Movies / TV Shows (Video) experimental Addon for XBMC - dmccoy - 2012-09-24

Thats great!. Thanks for your help.


RE: [RELEASE] XBMC Flicks - Netflix Movies / TV Shows (Video) experimental Addon for XBMC - patdavid - 2012-09-24

Okay, I've got it solved, but it cost me a bit of time searching and tracing...

Disclaimer: This is a hackish solution to getting TV listings working again. Don't blame me if your TV explodes and you melt things down.

There are two places where you need to modify iqueue.py:

  1. First you need to hack a check for the instant availability of your tv show. Find the function that checks for instant availability (this IF statement begins around line 802 in a stock install of xbmc-flicks):
    Code:
    #see if we are filtering for Instant Only Items
        if (instantAvail):
            ......
            else:
                #api data will return a string the following regex will parse
                matchIA = re.search(r"delivery_formats': {(.*?instant.*?)}", curQueueItem, re.DOTALL | re.MULTILINE)
                if matchIA:
                    matched = re.search(r"instant", matchIA.group(1))
                    if(not matched):
                        print "Item Filtered Out, it's not viewable instantly: " + curX.Title
                        return curX
                    else:
                        curX.IsInstantAvailable = True
                else:
                    return curX
    See that last "else" statement? We have to suppress the return, and force the addon to say that the show is available for instant streaming...

    So replace the very last "return curX" with:
    Code:
    curX.IsInstantAvailable = True
    #return curX

    The last else statement will now look like this:
    Code:
    else:
        curX.IsInstantAvailable = True
        #return curX

    I have only tested this in a limited sense, so YMMV.


  2. And second we need to fix a URL in a regex later on. Around line 914 you'll find this:
    Code:
    matchAllEpisodesRealID = re.search(r"http://api.netflix.com/catalog/titles/programs/\d{1,15}/(?P<id>\d{1,15})", curXe.TvEpisodeNetflixID, re.DOTALL | re.MULTILINE)

    Just change the "api" portion of the URL in the regex so it should look like this:

    Code:
    matchAllEpisodesRealID = re.search(r"http://api-public.netflix.com/catalog/titles/programs/\d{1,15}/(?P<id>\d{1,15})", curXe.TvEpisodeNetflixID, re.DOTALL | re.MULTILINE)

A caveat - your episode list for a show will autoexpand to show all the episodes (as opposed to season folders) - still working on that.

Having never programmed in Python before, or written an add-on for XBMC, this was a royal PITA to track down what was happening.

On the other hand, there are a ton of regex's that fekker used (for legacy reasons maybe?) to scrape the data from the API calls to Netflix. Given that most of what is needed to update this addon to something more modern is now available (mainly JSON return objects from netflix calls that should remove the need for any nasty regex building), I think I will just start from scratch (sort of) and rebuild this thing.

Hopefully this hack will hold other users over until I can put something worth using out.

Oh, and let me know if anyone tries this. Hopefully it should work, but if there's problems just get back to me here.


RE: [RELEASE] XBMC Flicks - Netflix Movies / TV Shows (Video) experimental Addon for XBMC - nedley - 2012-09-24

I registered just to update you about this. I applied your previous fix to the Netflix.py file and now applied this new fix and the Instant Movies and Instant TV shows populate and work. Also the Top 25 New Arrivals, All New Arrivals and Recommended all work as they use to. The only thing is the Search and the All Genre listings don't populate, but from what you said previously, I don't think you intended to fix that portion of it. So, it seems you've got it working well enough now. Nice work.


RE: [RELEASE] XBMC Flicks - Netflix Movies / TV Shows (Video) experimental Addon for XBMC - Svaerke - 2012-09-24

Just chiming in to say a big thank you; just as Nedley, I applied your two fixes, and both Instant Movies and Instant TV Shows now work.

The TV shows appeared after the first fix, but did not populate until I applied the second fix. So it seems I experienced the exact same problems other users did, and that your fixes helped me. I have not yet experienced any errors after applying the second fix. I even think the shows populate a lot faster now - but that might be my imagination.

Also, please update this thread if you should manage to (re)build a working add-on - I'd love to try it out! If you need any beta testers, I'd be happy to do so.

Thanks again for your work.


RE: [RELEASE] XBMC Flicks - Netflix Movies / TV Shows (Video) experimental Addon for XBMC - mooncaptain - 2012-09-24

(2012-09-24, 20:49)patdavid Wrote: Okay, I've got it solved, but it cost me a bit of time searching and tracing...

Yes it is solved - thanks very much for the patch.

There are a bunch of features that could be better - you are probably aware of at least some of them - you mentioned the full expansion to all the episodes as opposed to showing the seasons folders and then expanding (that has never worked as far as I know) Anyway thanks again. If you take on the maintenance of this little hummer for a while will you use the Add-On zip file releases to post the updates? That way new users won't have to dig out all the answers from this thread.




RE: [RELEASE] XBMC Flicks - Netflix Movies / TV Shows (Video) experimental Addon for XBMC - dmccoy - 2012-09-25

Patdavid, Thank you so much for your work. I know it will make a lot of us very happy. I will give your fix a try and let you know my results.


RE: [RELEASE] XBMC Flicks - Netflix Movies / TV Shows (Video) experimental Addon for XBMC - dmccoy - 2012-09-25

Awesome! This is working just like you said. I really appreciate all you work.


RE: [RELEASE] XBMC Flicks - Netflix Movies / TV Shows (Video) experimental Addon for XBMC - patdavid - 2012-09-25

(2012-09-24, 22:53)mooncaptain Wrote: There are a bunch of features that could be better - you are probably aware of at least some of them - you mentioned the full expansion to all the episodes as opposed to showing the seasons folders and then expanding (that has never worked as far as I know) Anyway thanks again. If you take on the maintenance of this little hummer for a while will you use the Add-On zip file releases to post the updates? That way new users won't have to dig out all the answers from this thread.

Yes, there are a few things that could be better for sure - I just didn't want to invest too much time into maintaining fekkers codebase, as I think there may be a more elegant solution going forward. The problem is that implementing it is a sort of "rebuild from scratch" sort of thing, which will take a little while.

If I start rebuilding it, I will probably start a new thread and try to package it up as an addon (no promises, of course). Smile


RE: [RELEASE] XBMC Flicks - Netflix Movies / TV Shows (Video) experimental Addon for XBMC - kerpal2020 - 2012-09-25

I applied both fixes, but it only works if my Instant Queue Max Items to Retrieve is set no greater than 100. Do you guys have the same issue? If I set it to 200 or more, it won't retrieve any Movies or TV.


RE: [RELEASE] XBMC Flicks - Netflix Movies / TV Shows (Video) experimental Addon for XBMC - patdavid - 2012-09-25

(2012-09-25, 11:15)kerpal2020 Wrote: I applied both fixes, but it only works if my Instant Queue Max Items to Retrieve is set no greater than 100. Do you guys have the same issue? If I set it to 200 or more, it won't retrieve any Movies or TV.

I do have the same issue, and may look into it a little later. If it's something simple I'll try to report back what the fix might be.

Ok, a fairly straightforward fix that I can't really burn test all the way because my entire queue only has 150 items in it.

But, you just need to set the timeout higher on the request to Netflix. It's in Netflix.py:

find the class definition for NetflixClient, and add a timeout parameter to __init__: (Around line 725 in Netflix.py)

Code:
class NetflixClient:

    def __init__(self, name, key, secret, callback='',verbose=False):
        self.connection = httplib.HTTPConnection("%s:%s" % (HOST, PORT))
        self.server = HOST
        self.verbose = verbose
        self.user = None
        self.catalog = NetflixCatalog(self)

You want to add a timeout parameter to the self.connection. So,
self.connection = httplib.HTTPConnection("%s:%s" % (HOST, PORT) )

becomes
self.connection = httplib.HTTPConnection("%s:%s" % (HOST, PORT), timeout=30 )

(I used 30 seconds, but you may have to tweak this to give the server enough time to compile your response and send it back to you - larger if you have a large queue (or are willing to wait), you can try 40, 50, 60 seconds or more if you want)

Code:
class NetflixClient:

    def __init__(self, name, key, secret, callback='',verbose=False):
        self.connection = httplib.HTTPConnection("%s:%s" % (HOST, PORT), timeout=30 )
        self.server = HOST
        self.verbose = verbose
        self.user = None
        self.catalog = NetflixCatalog(self)



RE: [RELEASE] XBMC Flicks - Netflix Movies / TV Shows (Video) experimental Addon for XBMC - fr0sty - 2012-09-25

running xbmcbuntu, downloaded the zip https://github.com/spudsdude/XBMC-Flicks/zipball/master
then i did install from zip, and got the following error:
"add-on does not have the correct structure"

line in my xbmc.log says:
19:41:01 T:2906594160 WARNING: Create - Unsupported protocol(script) in script://


RE: [RELEASE] XBMC Flicks - Netflix Movies / TV Shows (Video) experimental Addon for XBMC - patdavid - 2012-09-25

(2012-09-25, 19:42)fr0sty Wrote: running xbmcbuntu, downloaded the zip https://github.com/spudsdude/XBMC-Flicks/zipball/master
then i did install from zip, and got the following error:
"add-on does not have the correct structure"

line in my xbmc.log says:
19:41:01 T:2906594160 WARNING: Create - Unsupported protocol(script) in script://

I am not sure here, but I think that you cannot add it on from the .zip file?

I personally just unzipped it directly into my "addons" folder, and went from there (per the instructions)


RE: [RELEASE] XBMC Flicks - Netflix Movies / TV Shows (Video) experimental Addon for XBMC - kerpal2020 - 2012-09-25

I tried the following fix, but unfortunately it did not work. I also tried 45 and 60 but the amount of time that the add-on waits does not change while opening flicks in XBMC. So for some reason I don't think it is waiting any longer to populate the queries.

Code:
class NetflixClient:

    def __init__(self, name, key, secret, callback='',verbose=False):
        self.connection = httplib.HTTPConnection("%s:%s" % (HOST, PORT), timeout=30 )
        self.server = HOST
        self.verbose = verbose
        self.user = None
        self.catalog = NetflixCatalog(self)