def __init__( self, *args, **kwargs ):
     xbmcgui.WindowXMLDialog.__init__( self )
     params = kwargs[ "params" ]
     logMsg( repr(params) )
     if params.get("MOVIEID"):
         item = getJSON('VideoLibrary.GetMovieDetails', '{ "movieid": %s, "properties": [ %s ] }' %(params["MOVIEID"],fields_movies))
         self.content = "movies"
     elif params.get("MUSICVIDEOID"):
         item = getJSON('VideoLibrary.GetMusicVideoDetails', '{ "musicvideoid": %s, "properties": [ %s ] }' %(params["MUSICVIDEOID"],fields_musicvideos))
         self.content = "musicvideos"
     elif params.get("EPISODEID"):
         item = getJSON('VideoLibrary.GetEpisodeDetails', '{ "episodeid": %s, "properties": [ %s ] }' %(params["EPISODEID"],fields_episodes))
         self.content = "episodes"
     elif params.get("TVSHOWID"):
         item = getJSON('VideoLibrary.GetTVShowDetails', '{ "tvshowid": %s, "properties": [ %s ] }' %(params["TVSHOWID"],fields_tvshows))
         self.content = "tvshows"
     elif params.get("ALBUMID"):
         item = getJSON('AudioLibrary.GetAlbumDetails', '{ "albumid": %s, "properties": [ %s ] }' %(params["ALBUMID"],fields_albums))
         self.content = "albums"
     elif params.get("SONGID"):
         item = getJSON('AudioLibrary.GetSongDetails', '{ "songid": %s, "properties": [ %s ] }' %(params["SONGID"],fields_songs))
         self.content = "songs"
     elif params.get("RECORDINGID"):
         item = getJSON('PVR.GetRecordingDetails', '{ "recordingid": %s, "properties": [ %s ]}' %( params["RECORDINGID"], fields_pvrrecordings))
         artwork = artutils.getPVRThumbs(item["title"],item["channel"],"recordings",item["file"])
         item["art"] = artwork
         for key, value in artwork.iteritems():
             if not item.get(key):
                 item[key] = value
         if artwork.get("tmdb_type") == "movies":
             self.content = "movies"
         elif artwork.get("tmdb_type") == "tv":
             self.content = "episodes"
         else:
             self.content = "tvrecordings"
     else:
         item = None
         self.listitem = None
     
     if item:        
         liz = prepareListItem(item)
         liz = createListItem(item)
         self.listitem = liz
         self.lastwidgetcontainer = params.get("lastwidgetcontainer","")
         WINDOW.setProperty("SkinHelper.WidgetContainer","999")
 options.append(ADDON.getLocalizedString(32144)) #Refresh item (auto lookup)
 options.append(ADDON.getLocalizedString(32145)) #Refresh item (manual lookup)
 options.append(ADDON.getLocalizedString(32149)) #Add channel to ignore list
 options.append(ADDON.getLocalizedString(32150)) #Add title to ignore list
 options.append(ADDON.getLocalizedString(32148)) #Open addon settings
 header = ADDON.getLocalizedString(32143) + " - " + ADDON.getLocalizedString(32120)
 title = xbmc.getInfoLabel("ListItem.Title").decode('utf-8')
 if not title: title = xbmc.getInfoLabel("ListItem.Label").decode('utf-8')
 channel = xbmc.getInfoLabel("ListItem.ChannelName").decode('utf-8')
 path = xbmc.getInfoLabel("ListItem.FileNameAndPath").decode('utf-8')
 genre = xbmc.getInfoLabel("ListItem.Genre").decode('utf-8')
 year = xbmc.getInfoLabel("ListItem.Year").decode('utf-8')
 ret = xbmcgui.Dialog().select(header, options)
 if ret == 0:
     #Refresh item (auto lookup)
     artwork = artworkutils.getPVRThumbs(title,channel,type,path,genre,year,ignoreCache=True, manualLookup=False)
 elif ret == 1:
     #Refresh item (manual lookup)
     artwork = artworkutils.getPVRThumbs(title,channel,type,path,genre,year,ignoreCache=True, manualLookup=True)
 elif ret == 2:
     #Add channel to ignore list
     ignorechannels = WINDOW.getProperty("SkinHelper.ignorechannels").decode("utf-8")
     if ignorechannels: ignorechannels += ";"
     ignorechannels += channel
     ADDON.setSetting("ignorechannels",ignorechannels)
     WINDOW.setProperty("SkinHelper.ignorechannels",ignorechannels)
     artwork = artworkutils.getPVRThumbs(title,channel,type,path,genre,year,ignoreCache=True, manualLookup=False)
 elif ret == 3:
     #Add title to ignore list
     ignoretitles = WINDOW.getProperty("SkinHelper.ignoretitles").decode("utf-8")
     if ignoretitles: ignoretitles += ";"
Beispiel #3
0
    def send_headers(self):
        image = None
        preferred_type = None
        org_params = urlparse.parse_qs(self.path)
        params = {}

        for key, value in org_params.iteritems():
            if value:
                value = value[0]
                if "%" in value: value = urllib.unquote(value)
                params[key] = value.decode("utf-8")
        action = params.get("action", "")
        title = params.get("title", "")
        fallback = params.get("fallback", "")
        if fallback.startswith("Default"):
            fallback = u"special://skin/media/" + fallback

        if action == "getthumb":
            image = artutils.searchThumb(title)

        elif action == "getanimatedposter":
            imdbid = params.get("imdbid", "")
            if imdbid:
                image = artutils.getAnimatedPosters(imdbid).get(
                    "animated_poster", "")

        elif action == "getvarimage":
            title = title.replace("{", "[").replace("}", "]")
            image_tmp = xbmc.getInfoLabel(title)
            if xbmcvfs.exists(image_tmp):
                if image_tmp.startswith("resource://"):
                    #texture packed resource images are failing: http://trac.kodi.tv/ticket/16366
                    logMsg(
                        "WebService ERROR --> resource images are currently not supported due to a bug in Kodi",
                        0)
                else:
                    image = image_tmp

        elif action == "getpvrthumb":
            channel = params.get("channel", "")
            preferred_type = params.get("type", "")
            if xbmc.getCondVisibility("Window.IsActive(MyPVRRecordings.xml)"):
                type = "recordings"
            else:
                type = "channels"
            artwork = artutils.getPVRThumbs(title, channel, type)
            if preferred_type:
                preferred_types = preferred_type.split(",")
                for preftype in preferred_types:
                    if artwork.get(preftype):
                        image = artwork.get(preftype)
                        break
            else:
                if artwork.get("thumb"): image = artwork.get("thumb")
                if artwork.get("fanart"): image = artwork.get("fanart")
                if artwork.get("landscape"): image = artwork.get("landscape")

        elif action == "getallpvrthumb":
            channel = params.get("channel", "")
            images = artutils.getPVRThumbs(title, channel, "recordings")
            # Ensure no unicode in images...
            for key, value in images.iteritems():
                images[key] = unicode(value).encode('utf-8')
            images = urllib.urlencode(images)
            self.send_response(200)
            self.send_header('Content-type', 'text/plaintext')
            self.send_header('Content-Length', len(images))
            self.end_headers()
            return images, True

        elif action == "getartwork":
            year = params.get("year", "")
            arttype = params.get("type", "")
            artwork = artutils.getAddonArtwork(title, year, arttype)
            jsonstr = json.dumps(artwork)
            self.send_response(200)
            self.send_header('Content-type', 'application/json')
            self.send_header('Content-Length', len(jsonstr))
            self.end_headers()
            return jsonstr, True

        elif action == "getmusicart":
            preferred_type = params.get("type", "")
            artist = params.get("artist", "")
            album = params.get("album", "")
            track = params.get("track", "")
            artwork = artutils.getMusicArtwork(artist, album, track)
            if preferred_type:
                preferred_types = preferred_type.split(",")
                for preftype in preferred_types:
                    if artwork.get(preftype):
                        image = artwork.get(preftype)
                        break
            else:
                if artwork.get("thumb"): image = artwork.get("thumb")
                if artwork.get("fanart"): image = artwork.get("fanart")

        elif "getmoviegenreimages" in action or "gettvshowgenreimages" in action:
            artwork = {}
            cachestr = ("%s-%s" % (action, title)).encode("utf-8")
            cache = WINDOW.getProperty(cachestr).decode("utf-8")
            if cache:
                artwork = eval(cache)
            else:
                sort = '"order": "ascending", "method": "sorttitle", "ignorearticle": true'
                if "random" in action:
                    sort = '"order": "descending", "method": "random"'
                    action = action.replace("random", "")
                if action == "gettvshowgenreimages":
                    json_result = getJSON(
                        'VideoLibrary.GetTvshows',
                        '{ "sort": { %s }, "filter": {"operator":"is", "field":"genre", "value":"%s"}, "properties": [ %s ],"limits":{"end":%d} }'
                        % (sort, title, fields_tvshows, 5))
                else:
                    json_result = getJSON(
                        'VideoLibrary.GetMovies',
                        '{ "sort": { %s }, "filter": {"operator":"is", "field":"genre", "value":"%s"}, "properties": [ %s ],"limits":{"end":%d} }'
                        % (sort, title, fields_movies, 5))
                for count, item in enumerate(json_result):
                    artwork["poster.%s" % count] = item["art"].get(
                        "poster", "")
                    artwork["fanart.%s" % count] = item["art"].get(
                        "fanart", "")
                WINDOW.setProperty(cachestr, repr(artwork).encode("utf-8"))
            if artwork:
                preferred_type = params.get("type", "")
                if preferred_type:
                    image = artwork.get(preferred_type, "")
                else:
                    image = artwork.get("poster", "")

        #set fallback image if nothing else worked
        if not image and fallback: image = fallback

        if image:
            self.send_response(200)
            if ".jpg" in image: self.send_header('Content-type', 'image/jpg')
            elif image.lower().endswith(".gif"):
                self.send_header('Content-type', 'image/gif')
            else:
                self.send_header('Content-type', 'image/png')
            logMsg("found image for request %s  --> %s" %
                   (try_encode(self.path), try_encode(image)))
            st = xbmcvfs.Stat(image)
            modified = st.st_mtime()
            self.send_header('Last-Modified', "%s" % modified)
            image = xbmcvfs.File(image)
            size = image.size()
            self.send_header('Content-Length', str(size))
            self.end_headers()
        else:
            self.send_error(404)
        return image, None
Beispiel #4
0
    def __init__(self, *args, **kwargs):
        xbmcgui.WindowXMLDialog.__init__(self)
        params = kwargs["params"]
        logMsg(repr(params))
        if params.get("MOVIEID"):
            item = getJSON(
                'VideoLibrary.GetMovieDetails',
                '{ "movieid": %s, "properties": [ %s ] }' %
                (params["MOVIEID"], fields_movies))
            self.content = "movies"
        elif params.get("MUSICVIDEOID"):
            item = getJSON(
                'VideoLibrary.GetMusicVideoDetails',
                '{ "musicvideoid": %s, "properties": [ %s ] }' %
                (params["MUSICVIDEOID"], fields_musicvideos))
            self.content = "musicvideos"
        elif params.get("EPISODEID"):
            item = getJSON(
                'VideoLibrary.GetEpisodeDetails',
                '{ "episodeid": %s, "properties": [ %s ] }' %
                (params["EPISODEID"], fields_episodes))
            self.content = "episodes"
        elif params.get("TVSHOWID"):
            item = getJSON(
                'VideoLibrary.GetTVShowDetails',
                '{ "tvshowid": %s, "properties": [ %s ] }' %
                (params["TVSHOWID"], fields_tvshows))
            self.content = "tvshows"
        elif params.get("ALBUMID"):
            item = getJSON(
                'AudioLibrary.GetAlbumDetails',
                '{ "albumid": %s, "properties": [ %s ] }' %
                (params["ALBUMID"], fields_albums))
            self.content = "albums"
        elif params.get("SONGID"):
            item = getJSON(
                'AudioLibrary.GetSongDetails',
                '{ "songid": %s, "properties": [ %s ] }' %
                (params["SONGID"], fields_songs))
            self.content = "songs"
        elif params.get("RECORDINGID"):
            item = getJSON(
                'PVR.GetRecordingDetails',
                '{ "recordingid": %s, "properties": [ %s ]}' %
                (params["RECORDINGID"], fields_pvrrecordings))
            artwork = artutils.getPVRThumbs(item["title"], item["channel"],
                                            "recordings", item["file"])
            item["art"] = artwork
            for key, value in artwork.iteritems():
                if not item.get(key):
                    item[key] = value
            if artwork.get("tmdb_type") == "movies":
                self.content = "movies"
            elif artwork.get("tmdb_type") == "tv":
                self.content = "episodes"
            else:
                self.content = "tvrecordings"
        else:
            item = None
            self.listitem = None

        if item:
            liz = prepareListItem(item)
            liz = createListItem(item)
            self.listitem = liz
            self.lastwidgetcontainer = params.get("lastwidgetcontainer", "")
            WINDOW.setProperty("SkinHelper.WidgetContainer", "999")
    def send_headers(self):
        image = None
        images = None
        preferred_type = None
        params = urlparse.parse_qs(self.path)
        action = params.get("action","")[0]
        title = params.get("title","")
        if title: title = title[0].decode("utf-8")
        fallback = params.get("fallback","")
        if fallback: 
            fallback = fallback[0].decode("utf-8")
            if fallback.startswith("Default"): fallback = "special://skin/media/" + fallback

        if action == "getthumb":
            image = artutils.searchThumb(title)
        
        elif action == "getvarimage":
            title = title.replace("{","[").replace("}","]")
            image_tmp = xbmc.getInfoLabel(title)
            if xbmcvfs.exists(image_tmp):
                if image_tmp.startswith("resource://"):
                    #texture packed resource images are failing: http://trac.kodi.tv/ticket/16366
                    logMsg("WebService ERROR --> resource images are currently not supported due to a bug in Kodi" ,0)
                else:
                    image = image_tmp
        
        elif action == "getpvrthumb":
            channel = params.get("channel","")
            preferred_type = params.get("type","")
            if channel: channel = channel[0].decode("utf-8")
            if preferred_type: preferred_type = preferred_type[0]
            if xbmc.getCondVisibility("Window.IsActive(MyPVRRecordings.xml)"): type = "recordings"
            else: type = "channels"
            artwork = artutils.getPVRThumbs(title, channel, type)
            if preferred_type:
                preferred_types = preferred_type.split(",")
                for preftype in preferred_types:
                    if artwork.get(preftype):
                        image = artwork.get(preftype)
                        break
            else:
                if artwork.get("thumb"): image = artwork.get("thumb")
                if artwork.get("fanart"): image = artwork.get("fanart")
                if artwork.get("landscape"): image = artwork.get("landscape")

        elif action == "getallpvrthumb":
            channel = params.get("channel","")
            if channel: channel = channel[0].decode("utf-8")
            images = artutils.getPVRThumbs(title, channel, "recordings")
            # Ensure no unicode in images...
            for key, value in images.iteritems():
                images[key] = unicode(value).encode('utf-8')
            images = urllib.urlencode(images)
        
        elif action == "getmusicart":
            preferred_type = params.get("type","")
            if preferred_type: preferred_type = preferred_type[0]
            artist = params.get("artist","")
            if artist: artist = artist[0]
            album = params.get("album","")
            if album: album = album[0]
            track = params.get("track","")
            if track: track = track[0]
            artwork = artutils.getMusicArtwork(artist, album, track)
            if preferred_type:
                preferred_types = preferred_type.split(",")
                for preftype in preferred_types:
                    if artwork.get(preftype):
                        image = artwork.get(preftype)
                        break
            else:
                if artwork.get("thumb"): image = artwork.get("thumb")
                if artwork.get("fanart"): image = artwork.get("fanart")
        
        #set fallback image if nothing else worked
        if not image and fallback: image = fallback
        
        if images:
            self.send_response(200)
            self.send_header('Content-type','text/plaintext')
            self.send_header('Content-Length',len(images))
            self.end_headers()
            return images, True
        elif image:
            self.send_response(200)
            if ".jpg" in image: self.send_header('Content-type','image/jpeg')
            else: self.send_header('Content-type','image/png')
            logMsg("found image for request %s  --> %s" %(try_encode(self.path),try_encode(image)))
            st = xbmcvfs.Stat(image)
            modified = st.st_mtime()
            self.send_header('Last-Modified',"%s" %modified)
            image = xbmcvfs.File(image)
            size = image.size()
            self.send_header('Content-Length',str(size))
            self.end_headers() 
        else:
            self.send_error(404)
        return image, None
Beispiel #6
0
    def send_headers(self):
        image = None
        images = None
        preferred_type = None
        params = urlparse.parse_qs(self.path)
        action = params.get("action", "")[0]
        title = params.get("title", "")
        if title: title = title[0].decode("utf-8")
        fallback = params.get("fallback", "")
        if fallback:
            fallback = fallback[0].decode("utf-8")
            if fallback.startswith("Default"):
                fallback = "special://skin/media/" + fallback

        if action == "getthumb":
            image = artutils.searchThumb(title)

        elif action == "getvarimage":
            title = title.replace("{", "[").replace("}", "]")
            image_tmp = xbmc.getInfoLabel(title)
            if xbmcvfs.exists(image_tmp):
                if image_tmp.startswith("resource://"):
                    #texture packed resource images are failing: http://trac.kodi.tv/ticket/16366
                    logMsg(
                        "WebService ERROR --> resource images are currently not supported due to a bug in Kodi",
                        0)
                else:
                    image = image_tmp

        elif action == "getpvrthumb":
            channel = params.get("channel", "")
            preferred_type = params.get("type", "")
            if channel: channel = channel[0].decode("utf-8")
            if preferred_type: preferred_type = preferred_type[0]
            if xbmc.getCondVisibility("Window.IsActive(MyPVRRecordings.xml)"):
                type = "recordings"
            else:
                type = "channels"
            artwork = artutils.getPVRThumbs(title, channel, type)
            if preferred_type:
                preferred_types = preferred_type.split(",")
                for preftype in preferred_types:
                    if artwork.get(preftype):
                        image = artwork.get(preftype)
                        break
            else:
                if artwork.get("thumb"): image = artwork.get("thumb")
                if artwork.get("fanart"): image = artwork.get("fanart")
                if artwork.get("landscape"): image = artwork.get("landscape")

        elif action == "getallpvrthumb":
            channel = params.get("channel", "")
            if channel: channel = channel[0].decode("utf-8")
            images = artutils.getPVRThumbs(title, channel, "recordings")
            # Ensure no unicode in images...
            for key, value in images.iteritems():
                images[key] = unicode(value).encode('utf-8')
            images = urllib.urlencode(images)

        elif action == "getmusicart":
            preferred_type = params.get("type", "")
            if preferred_type: preferred_type = preferred_type[0]
            artist = params.get("artist", "")
            if artist: artist = artist[0]
            album = params.get("album", "")
            if album: album = album[0]
            track = params.get("track", "")
            if track: track = track[0]
            artwork = artutils.getMusicArtwork(artist, album, track)
            if preferred_type:
                preferred_types = preferred_type.split(",")
                for preftype in preferred_types:
                    if artwork.get(preftype):
                        image = artwork.get(preftype)
                        break
            else:
                if artwork.get("thumb"): image = artwork.get("thumb")
                if artwork.get("fanart"): image = artwork.get("fanart")

        #set fallback image if nothing else worked
        if not image and fallback: image = fallback

        if images:
            self.send_response(200)
            self.send_header('Content-type', 'text/plaintext')
            self.send_header('Content-Length', len(images))
            self.end_headers()
            return images, True
        elif image:
            self.send_response(200)
            if ".jpg" in image: self.send_header('Content-type', 'image/jpeg')
            else: self.send_header('Content-type', 'image/png')
            logMsg("found image for request %s  --> %s" %
                   (try_encode(self.path), try_encode(image)))
            st = xbmcvfs.Stat(image)
            modified = st.st_mtime()
            self.send_header('Last-Modified', "%s" % modified)
            image = xbmcvfs.File(image)
            size = image.size()
            self.send_header('Content-Length', str(size))
            self.end_headers()
        else:
            self.send_error(404)
        return image, None
    def send_headers(self):
        image = None
        preferred_type = None
        org_params = urlparse.parse_qs(self.path)
        params = {}

        for key, value in org_params.iteritems():
            if value:
                value = value[0]
                if "%" in value:
                    value = urllib.unquote(value)
                params[key] = value.decode("utf-8")
        action = params.get("action", "")
        title = params.get("title", "")
        fallback = params.get("fallback", "")
        if fallback.startswith("Default"):
            fallback = u"special://skin/media/" + fallback

        if action == "getthumb":
            image = artutils.searchThumb(title)

        elif action == "getanimatedposter":
            imdbid = params.get("imdbid", "")
            if imdbid:
                image = artutils.getAnimatedPosters(imdbid).get("animated_poster", "")

        elif action == "getvarimage":
            title = title.replace("{", "[").replace("}", "]")
            image_tmp = xbmc.getInfoLabel(title)
            if xbmcvfs.exists(image_tmp):
                if image_tmp.startswith("resource://"):
                    # texture packed resource images are failing: http://trac.kodi.tv/ticket/16366
                    logMsg("WebService ERROR --> resource images are currently not supported due to a bug in Kodi", 0)
                else:
                    image = image_tmp

        elif action == "getpvrthumb":
            channel = params.get("channel", "")
            preferred_type = params.get("type", "")
            if xbmc.getCondVisibility("Window.IsActive(MyPVRRecordings.xml)"):
                type = "recordings"
            else:
                type = "channels"
            artwork = artutils.getPVRThumbs(title, channel, type)
            if preferred_type:
                preferred_types = preferred_type.split(",")
                for preftype in preferred_types:
                    if artwork.get(preftype):
                        image = artwork.get(preftype)
                        break
            else:
                if artwork.get("thumb"):
                    image = artwork.get("thumb")
                if artwork.get("fanart"):
                    image = artwork.get("fanart")
                if artwork.get("landscape"):
                    image = artwork.get("landscape")

        elif action == "getallpvrthumb":
            channel = params.get("channel", "")
            images = artutils.getPVRThumbs(title, channel, "recordings")
            # Ensure no unicode in images...
            for key, value in images.iteritems():
                images[key] = unicode(value).encode("utf-8")
            images = urllib.urlencode(images)
            self.send_response(200)
            self.send_header("Content-type", "text/plaintext")
            self.send_header("Content-Length", len(images))
            self.end_headers()
            return images, True

        elif action == "getartwork":
            year = params.get("year", "")
            arttype = params.get("type", "")
            artwork = artutils.getAddonArtwork(title, year, arttype)
            jsonstr = json.dumps(artwork)
            self.send_response(200)
            self.send_header("Content-type", "application/json")
            self.send_header("Content-Length", len(jsonstr))
            self.end_headers()
            return jsonstr, True

        elif action == "getmusicart":
            preferred_type = params.get("type", "")
            artist = params.get("artist", "")
            album = params.get("album", "")
            track = params.get("track", "")
            artwork = artutils.getMusicArtwork(artist, album, track)
            if preferred_type:
                preferred_types = preferred_type.split(",")
                for preftype in preferred_types:
                    if artwork.get(preftype):
                        image = artwork.get(preftype)
                        break
            else:
                if artwork.get("thumb"):
                    image = artwork.get("thumb")
                if artwork.get("fanart"):
                    image = artwork.get("fanart")

        elif "getmoviegenreimages" in action or "gettvshowgenreimages" in action:
            artwork = {}
            cachestr = ("%s-%s" % (action, title)).encode("utf-8")
            cache = WINDOW.getProperty(cachestr).decode("utf-8")
            if cache:
                artwork = eval(cache)
            else:
                sort = '"order": "ascending", "method": "sorttitle", "ignorearticle": true'
                if "random" in action:
                    sort = '"order": "descending", "method": "random"'
                    action = action.replace("random", "")
                if action == "gettvshowgenreimages":
                    json_result = getJSON(
                        "VideoLibrary.GetTvshows",
                        '{ "sort": { %s }, "filter": {"operator":"is", "field":"genre", "value":"%s"}, "properties": [ %s ],"limits":{"end":%d} }'
                        % (sort, title, fields_tvshows, 5),
                    )
                else:
                    json_result = getJSON(
                        "VideoLibrary.GetMovies",
                        '{ "sort": { %s }, "filter": {"operator":"is", "field":"genre", "value":"%s"}, "properties": [ %s ],"limits":{"end":%d} }'
                        % (sort, title, fields_movies, 5),
                    )
                for count, item in enumerate(json_result):
                    artwork["poster.%s" % count] = item["art"].get("poster", "")
                    artwork["fanart.%s" % count] = item["art"].get("fanart", "")
                WINDOW.setProperty(cachestr, repr(artwork).encode("utf-8"))
            if artwork:
                preferred_type = params.get("type", "")
                if preferred_type:
                    image = artwork.get(preferred_type, "")
                else:
                    image = artwork.get("poster", "")

        # set fallback image if nothing else worked
        if not image and fallback:
            image = fallback

        if image:
            self.send_response(200)
            if ".jpg" in image:
                self.send_header("Content-type", "image/jpg")
            elif image.lower().endswith(".gif"):
                self.send_header("Content-type", "image/gif")
            else:
                self.send_header("Content-type", "image/png")
            logMsg("found image for request %s  --> %s" % (try_encode(self.path), try_encode(image)))
            st = xbmcvfs.Stat(image)
            modified = st.st_mtime()
            self.send_header("Last-Modified", "%s" % modified)
            image = xbmcvfs.File(image)
            size = image.size()
            self.send_header("Content-Length", str(size))
            self.end_headers()
        else:
            self.send_error(404)
        return image, None
Beispiel #8
0
 options.append(ADDON.getLocalizedString(32148))  #Open addon settings
 header = ADDON.getLocalizedString(
     32143) + " - " + ADDON.getLocalizedString(32120)
 title = xbmc.getInfoLabel("ListItem.Title").decode('utf-8')
 if not title: title = xbmc.getInfoLabel("ListItem.Label").decode('utf-8')
 channel = xbmc.getInfoLabel("ListItem.ChannelName").decode('utf-8')
 path = xbmc.getInfoLabel("ListItem.FileNameAndPath").decode('utf-8')
 genre = xbmc.getInfoLabel("ListItem.Genre").decode('utf-8')
 year = xbmc.getInfoLabel("ListItem.Year").decode('utf-8')
 ret = xbmcgui.Dialog().select(header, options)
 if ret == 0:
     #Refresh item (auto lookup)
     artwork = artworkutils.getPVRThumbs(title,
                                         channel,
                                         type,
                                         path,
                                         genre,
                                         year,
                                         ignoreCache=True,
                                         manualLookup=False)
 elif ret == 1:
     #Refresh item (manual lookup)
     artwork = artworkutils.getPVRThumbs(title,
                                         channel,
                                         type,
                                         path,
                                         genre,
                                         year,
                                         ignoreCache=True,
                                         manualLookup=True)
 elif ret == 2:
     #Choose art