示例#1
0
 def setContainer150( self ):
     # open db
     con, cur = actorsdb.getConnection()
     try:
         #set cast and role
         listitems = []
         for cast in self.movie[ "cast" ]:
             listitem = xbmcgui.ListItem( cast[ "name" ], cast[ "role" ], "DefaultActor.png" )
             cachedthumb = ( cast.get( "thumbnail" ) or "" )
             if cachedthumb: listitem.setIconImage( cachedthumb )
             try:
                 actor = actorsdb.getActor( cur, ustrActor=cast[ "name" ] )
                 bio   = metautils.clean_bio( actor.get( "biography" ) or "" )
                 listitem.setInfo( "video", { "title": actor.get( "name" ) or cast[ "name" ], "plot": bio } )
                 if actor:
                     actor[ "biography" ] = bio
                     listitem = common.setActorProperties( listitem, actor )
                     if not cachedthumb and actor.get( "thumbs" ):
                         if actor[ "thumbs" ][ 1 ]: listitem.setIconImage( self.profile_path + actor[ "thumbs" ][ 1 ] )
             except:
                 print_exc()
             listitems.append( listitem )
         #
         self.getControl( 150 ).reset()
         self.getControl( 150 ).addItems( listitems )
     except:
         print_exc()
     #close db
     con.close()
示例#2
0
 def setContainer150(self):
     # open db
     con, cur = actorsdb.getConnection()
     try:
         #set cast and role
         listitems = []
         for cast in self.movie["cast"]:
             listitem = xbmcgui.ListItem(cast["name"], cast["role"],
                                         "DefaultActor.png")
             cachedthumb = (cast.get("thumbnail") or "")
             if cachedthumb: listitem.setIconImage(cachedthumb)
             try:
                 actor = actorsdb.getActor(cur, ustrActor=cast["name"])
                 bio = metautils.clean_bio(actor.get("biography") or "")
                 listitem.setInfo("video", {
                     "title": actor.get("name") or cast["name"],
                     "plot": bio
                 })
                 if actor:
                     actor["biography"] = bio
                     listitem = common.setActorProperties(listitem, actor)
                     if not cachedthumb and actor.get("thumbs"):
                         if actor["thumbs"][1]:
                             listitem.setIconImage(self.profile_path +
                                                   actor["thumbs"][1])
             except:
                 print_exc()
             listitems.append(listitem)
         #
         self.getControl(150).reset()
         self.getControl(150).addItems(listitems)
     except:
         print_exc()
     #close db
     con.close()
示例#3
0
    def setContainer( self, refresh=False ):
        try:
            self.videodb = metautils.getActorPaths( self.actor[ "name" ], ACTORS )
            self.getControl( 8 ).setEnabled( bool( self.videodb ) )

            # actor key: ( "idactor", "id", "name", "biography", "biooutline", "birthday", "deathday", "place_of_birth", "also_known_as", "homepage", "adult", "cachedthumb" )
            # actor.thumbs list: [ cachedUrl, strUrl, strThumb=json_string ]
            # actor.castandcrew list: [ strCast=json_string, strCrew=json_string ]

            self.actor[ "castandcrew" ] = map( metautils.load_db_json_string, self.actor[ "castandcrew" ] )
            try: self.images = metautils.load_db_json_string( self.actor[ "thumbs" ][ 2 ] )
            except: self.images = []
            # Shuffle items in place
            if ADDON.getSetting( "randomize" ) == "true": shuffle( self.images )
            self.multiimages = deque( a[ "file_path" ] for a in self.images )
            try: self.timeperimage = int( ADDON.getSetting( "timeperimage" ) )
            except: self.timeperimage = 10

            listitem = xbmcgui.ListItem( self.actor[ "name" ], "", "DefaultActor.png" )
            for fanart in TBN.get_fanarts( self.actor[ "name" ] ):
                if xbmcvfs.exists( fanart ):
                    listitem.setProperty( "Fanart_Image", fanart )
                    break

            cached_actor_thumb = "special://thumbnails/Actors/" + self.actor[ "name" ] + "/"
            for extra in [ "extrafanart", "extrathumb" ]:
                if xbmcvfs.exists( cached_actor_thumb + extra ):
                    listitem.setProperty( extra, cached_actor_thumb + extra )

            self.tbn_added = False
            if self.actor[ "thumbs" ]:
                icon = self.actor[ "thumbs" ][ 1 ]
                if icon:
                    listitem.setIconImage( self.profile_path + icon )
                    self.tbn_added = True
                    self.copyThumb()

                if ADDON.getSetting( "usemultiimage" ) == "true" and len( self.multiimages ) > 1:
                    # active multiimage thread
                    self.multiimage_thread = Timer( self.timeperimage, self.multiimage, () )
                    self.multiimage_thread.start()
                    self.tbn_added = True

            if not self.tbn_added:
                cachedthumb = "".join( TBN.get_thumb( self.actor[ "name" ] ) )
                if xbmcvfs.exists( cachedthumb ): listitem.setIconImage( cachedthumb )

            #
            self.actor[ "biography" ] = metautils.clean_bio( self.actor[ "biography" ] or "" )
            listitem.setInfo( "video", { "title": self.actor[ "name" ], "plot": self.actor[ "biography" ] } )
            listitem = common.setActorProperties( listitem, self.actor )

            self.listitem = listitem
            self.clearList()
            self.addItem( self.listitem )
            self.getControl( 50 ).setVisible( 0 )

            self.setContainer150()
            self.setContainer250()

        except:
            print_exc()
            self._close_dialog()
        xbmc.executebuiltin( "ClearProperty(actorsselect)" )
示例#4
0
    def setContainer(self, refresh=False):
        try:
            self.videodb = metautils.getActorPaths(self.actor["name"], ACTORS)
            self.getControl(8).setEnabled(bool(self.videodb))

            # actor key: ( "idactor", "id", "name", "biography", "biooutline", "birthday", "deathday", "place_of_birth", "also_known_as", "homepage", "adult", "cachedthumb" )
            # actor.thumbs list: [ cachedUrl, strUrl, strThumb=json_string ]
            # actor.castandcrew list: [ strCast=json_string, strCrew=json_string ]

            self.actor["castandcrew"] = map(metautils.load_db_json_string,
                                            self.actor["castandcrew"])
            try:
                self.images = metautils.load_db_json_string(
                    self.actor["thumbs"][2])
            except:
                self.images = []
            # Shuffle items in place
            if ADDON.getSetting("randomize") == "true": shuffle(self.images)
            self.multiimages = deque(a["file_path"] for a in self.images)
            try:
                self.timeperimage = int(ADDON.getSetting("timeperimage"))
            except:
                self.timeperimage = 10

            listitem = xbmcgui.ListItem(self.actor["name"], "",
                                        "DefaultActor.png")
            for fanart in TBN.get_fanarts(self.actor["name"]):
                if xbmcvfs.exists(fanart):
                    listitem.setProperty("Fanart_Image", fanart)
                    break

            cached_actor_thumb = "special://thumbnails/Actors/" + self.actor[
                "name"] + "/"
            for extra in ["extrafanart", "extrathumb"]:
                if xbmcvfs.exists(cached_actor_thumb + extra):
                    listitem.setProperty(extra, cached_actor_thumb + extra)

            self.tbn_added = False
            if self.actor["thumbs"]:
                icon = self.actor["thumbs"][1]
                if icon:
                    listitem.setIconImage(self.profile_path + icon)
                    self.tbn_added = True
                    self.copyThumb()

                if ADDON.getSetting("usemultiimage") == "true" and len(
                        self.multiimages) > 1:
                    # active multiimage thread
                    self.multiimage_thread = Timer(self.timeperimage,
                                                   self.multiimage, ())
                    self.multiimage_thread.start()
                    self.tbn_added = True

            if not self.tbn_added:
                cachedthumb = "".join(TBN.get_thumb(self.actor["name"]))
                if xbmcvfs.exists(cachedthumb):
                    listitem.setIconImage(cachedthumb)

            #
            self.actor["biography"] = metautils.clean_bio(
                self.actor["biography"] or "")
            listitem.setInfo("video", {
                "title": self.actor["name"],
                "plot": self.actor["biography"]
            })
            listitem = common.setActorProperties(listitem, self.actor)

            self.listitem = listitem
            self.clearList()
            self.addItem(self.listitem)
            self.getControl(50).setVisible(0)

            self.setContainer150()
            self.setContainer250()

        except:
            print_exc()
            self._close_dialog()
        xbmc.executebuiltin("ClearProperty(actorsselect)")