[RELEASE] NetfliXBMC - Unofficial Netflix Add-on (Win/OSX/Linux) - Thread 2
Wink 
Hey JasonPell,

I've had a spare hour or two and have made progress with the cover art image resolution problem.
I gave up on using images from Netflix, they only serve up the URL of the low res covers and the higher resolution images used on their webpage don't have a consistent numbering system to allow me to fetch the HD images.

SO.... I've been working on getting cover images from TMDb through download.py.
There were a few issues, however, it now works providing good covers and you also get background fan art.
Looks much better than the standard art.

Here is the code for download.py
PHP Code:
#!/usr/bin/python
# -*- coding: utf-8 -*-
import os
import re
import base64
import xbmc
import xbmcaddon
import urllib
import urllib2
import shutil

def download
(videoIDtitleyear):
    
filename = (''.join(for c in unicode(videoID'utf-8') if c not in '/\\:?"*|<>')).strip()+".jpg"
    
filenameNone = (''.join(for c in unicode(videoID'utf-8') if c not in '/\\:?"*|<>')).strip()+".none"
    
coverFile os.path.join(cacheFolderCoversTMDBfilename)
    
coverFileNone os.path.join(cacheFolderCoversTMDBfilenameNone)
    
fanartFile os.path.join(cacheFolderFanartTMDBfilename)
    
content opener.open("http://api.themoviedb.org/3/search/"+videoType+"?api_key="+apiKey+"&query="+urllib.quote_plus(title.strip())+"&year="+urllib.quote_plus(year)+"&language=en").read()
    
match re.compile('"poster_path":"(.+?)"'re.DOTALL).findall(content)

    
# maybe its a mini-series (TMDb calls them movies)
    
if not match and videoType == "tv":
        
content opener.open("http://api.themoviedb.org/3/search/movie?api_key="+apiKey+"&query="+urllib.quote_plus(title.strip())+"&year="+urllib.quote_plus(year)+"&language=en").read()
        
match re.compile('"poster_path":"(.+?)"'re.DOTALL).findall(content)

    if 
match:
        
coverUrl "http://image.tmdb.org/t/p/original"+match[0]
        
contentJPG opener.open(coverUrl).read()
        
fh open(coverFile'wb')
        
fh.write(contentJPG)
        
fh.close()
    else:
        
fh open(coverFileNone'w')
        
fh.write("")
        
fh.close()
    
match re.compile('"backdrop_path":"(.+?)"'re.DOTALL).findall(content)
    if 
match:
        
fanartUrl "http://image.tmdb.org/t/p/original"+match[0]
        
contentJPG opener.open(fanartUrl).read()
        
fh open(fanartFile'wb')
        
fh.write(contentJPG)
        
fh.close()

addonID 'plugin.video.netflixbmc'
addon xbmcaddon.Addon(id=addonID)
apiKey base64.b64decode("NDc2N2I0YjJiYjk0YjEwNGZhNTUxNWM1ZmY0ZTFmZWM=")
addonUserDataFolder xbmc.translatePath("special://profile/addon_data/"+addonID)
cacheFolder os.path.join(addonUserDataFolder"cache")
cacheFolderCoversTMDB os.path.join(cacheFolder"covers")
cacheFolderFanartTMDB os.path.join(cacheFolder"fanart")
opener urllib2.build_opener()
userAgent "Mozilla/5.0 (Windows NT 5.1; rv:25.0) Gecko/20100101 Firefox/25.0"
opener.addheaders = [('User-agent'userAgent)]

videoType urllib.unquote_plus(sys.argv[1])
videoID urllib.unquote_plus(sys.argv[2])
title urllib.unquote_plus(sys.argv[3])
year urllib.unquote_plus(sys.argv[4])

try:
    
download(videoIDtitleyear)
except:
    
pass 

Make sure "Get covers and fanart images from TMDb" is turned on

Some TV series do not have cover art available through TMDb, so in that case the standard low def Netflix cover is displayed.
If you want more covers, you can register a TMDb and provide your own artwork for the missing TV series and movies.Big Grin

After you open a list, all the covers for the list will begin loading but will take time (depends on you connection speed). Leave the list and return to see the updated cover. Once downloaded the covers and fanart are stored in the cache and always available.
Reply


Messages In This Thread
Who's Watching is empty? - by RiverBend - 2015-01-08, 18:55
Full-screen mode - by oakertood - 2015-03-29, 01:08
RE: [RELEASE] NetfliXBMC - Unofficial Netflix Add-on (Win/OSX/Linux) - Thread 2 - by insertnamehere - 2015-04-02, 09:45
25% - by Mattlock - 2015-07-06, 03:56
Additional/Original Browser Option? - by durv - 2015-09-07, 05:07
[RELEASE] NetfliXBMC - EMPTY LISTS - by Nibar - 2015-12-08, 03:38
Logout Mark Read Team Forum Stats Members Help
[RELEASE] NetfliXBMC - Unofficial Netflix Add-on (Win/OSX/Linux) - Thread 217