当前位置: 首页>>代码示例>>Python>>正文


Python Item.get_thumb方法代码示例

本文整理汇总了Python中Item.get_thumb方法的典型用法代码示例。如果您正苦于以下问题:Python Item.get_thumb方法的具体用法?Python Item.get_thumb怎么用?Python Item.get_thumb使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Item的用法示例。


在下文中一共展示了Item.get_thumb方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: _createRootList

# 需要导入模块: import Item [as 别名]
# 或者: from Item import get_thumb [as 别名]
    def _createRootList(self):
        """
        Create and return the root list (all type available)
        Returns list and name of the list
        """
        list = []
        listTitle = _( 10 )

        # List the main categorie at the root level
        for cat in self.racineDisplayList:   
            item = {}
            #item['id']                = ""
            item['name']              = Item.get_type_title( cat )
            #item['parent']            = self.type
            item['downloadurl']       = None
            item['type']              = 'CAT'
            item['xbmc_type']         = cat
            item['cattype']           = cat
            item['previewpictureurl'] = None
            item['description']       = Item.get_type_title( cat )
            item['language']          = ""
            item['version']           = ""
            item['author']            = ""
            item['date']              = ""
            item['added']             = ""
            item['thumbnail']         = Item.get_thumb( cat )
            item['previewpicture']    = ""#Item.get_thumb( cat )
            item['image2retrieve']    = False # Temporary patch for reseting the flag after download (would be better in the thread in charge of the download)

            list.append(item)
            print item
            
        return listTitle, list
开发者ID:Quihico,项目名称:passion-xbmc,代码行数:35,代码来源:XbmcZoneBrowser.py

示例2: _setDefaultImages

# 需要导入模块: import Item [as 别名]
# 或者: from Item import get_thumb [as 别名]
 def _setDefaultImages(self, item):
     """
     Set the images with default value depending on the type of the item
     """
     print "_setDefaultImages"
     print item['previewpictureurl']
     if  item['previewpictureurl'] == '':
         # No picture available -> use default one
         item['thumbnail']      = Item.get_thumb( item['xbmc_type'] ) # icone
         item['previewpicture'] = ""#Item.THUMB_NOT_AVAILABLE # preview
     else:
         # Check if picture is already downloaded and available
         downloadImage = False
         thumbnail, checkPathPic = set_cache_thumb_name( item['previewpictureurl'] )
         if thumbnail and os.path.isfile( thumbnail ):
             item['thumbnail'] = thumbnail
         else:
             item['thumbnail'] = Item.THUMB_NOT_AVAILABLE
             downloadImage = True
             
         if os.path.exists(checkPathPic):
             item['previewpicture'] = checkPathPic
         else:
             item['previewpicture'] = ""#Item.THUMB_NOT_AVAILABLE
             downloadImage = True
             
         if downloadImage == True:
             # Set flag for download (separate thread)
             item['image2retrieve'] = True
开发者ID:Quihico,项目名称:passion-xbmc,代码行数:31,代码来源:PassionXbmcBrowser.py

示例3: _createScraperList

# 需要导入模块: import Item [as 别名]
# 或者: from Item import get_thumb [as 别名]
    def _createScraperList(self):
        """
        Create and return the list of scraper types
        Returns list and name of the list
        """
        list = []
        listTitle = Item.get_type_title(Item.TYPE_SCRAPER)

        # List all the type of plugins
        for cat in self.scraperDisplayList:
            item = {}
            item["name"] = Item.get_type_title(cat)
            item["downloadurl"] = None
            item["type"] = "CAT"
            item["xbmc_type"] = cat
            item["previewpictureurl"] = None
            item["description"] = Item.get_type_title(cat)
            item["language"] = ""
            item["version"] = ""
            item["author"] = ""
            item["date"] = ""
            item["added"] = ""
            item["thumbnail"] = Item.get_thumb(cat)
            item["previewpicture"] = ""  # Item.get_thumb( cat )
            item[
                "image2retrieve"
            ] = (
                False
            )  # Temporary patch for reseting the flag after download (would be better in the thread in charge of the download)

            list.append(item)
            print item

        return listTitle, list
开发者ID:Quihico,项目名称:passion-xbmc,代码行数:36,代码来源:PassionFtpBrowser.py

示例4: _createNEWListItem

# 需要导入模块: import Item [as 别名]
# 或者: from Item import get_thumb [as 别名]
 def _createNEWListItem ( self ):
     # Create ALL category
     item = {}
     item['name']              = _( 22 )
     item['parent']            = 0
     item['type']              = Item.TYPE_NEW
     item['description']       = ""
     item['xbmc_type']         = Item.TYPE_NEW
     item['thumbnail']         = Item.get_thumb( Item.TYPE_NEW )
     item['previewpictureurl'] = ""
     item['previewpicture']    = ""#Item.get_thumb( entry )
     item['image2retrieve']    = False # Temporary patch for reseting the flag after downlaad (would be better in the thread in charge of the download)
     item['language']          = ""
     item['version']           = ""
     item['author']            = ""
     item['added']             = ""
     item['date']              = ""
     self._setDefaultImages( item )
     print item
     return item
开发者ID:Quihico,项目名称:passion-xbmc,代码行数:22,代码来源:PassionXbmcBrowser.py

示例5: _createRootList

# 需要导入模块: import Item [as 别名]
# 或者: from Item import get_thumb [as 别名]
    def _createRootList(self):
        """
        Create and return the root list (all type available)
        Returns list and name of the list
        """
        list = []
        listTitle = _(10)

        # List the main categorie at the root level
        for cat in self.racineDisplayList:
            item = {}
            # item['id']                = ""
            item["name"] = Item.get_type_title(cat)
            # item['parent']            = self.type
            item["downloadurl"] = None
            item["type"] = "CAT"
            item["xbmc_type"] = cat
            item["previewpictureurl"] = None
            item["description"] = Item.get_type_title(cat)
            item["language"] = ""
            item["version"] = ""
            item["author"] = ""
            item["date"] = ""
            item["added"] = ""
            item["thumbnail"] = Item.get_thumb(cat)
            item["previewpicture"] = ""  # Item.get_thumb( cat )
            item[
                "image2retrieve"
            ] = (
                False
            )  # Temporary patch for reseting the flag after download (would be better in the thread in charge of the download)

            list.append(item)
            print item

        return listTitle, list
开发者ID:Quihico,项目名称:passion-xbmc,代码行数:38,代码来源:PassionFtpBrowser.py

示例6: _createListFromJson

# 需要导入模块: import Item [as 别名]
# 或者: from Item import get_thumb [as 别名]
    def _createListFromJson( self, requestURL, skipdescript=False ):
        """
        Create and return the list from json data
        Returns list and name of the list
        
        Json data:
            u'rating'
            u'script_language'
            u'image'
            u'totalitems'
            u'id'
            u'title'
            u'version'
            u'filesize'
            u'totaldownloads'
            u'type'
            u'filetype'
            u'description'
            u'views'
            u'createdate'
            u'orginalfilename'
            u'description_en'
            u'xbmc_type'
            u'commenttotal'
            u'date'
            u'fileurl'
            u'ID_TOPIC'
            u'author'
            u'idparent'        
        """
        list = []

        # Retrieve json data
        jsondata = self._retrieve_json( requestURL, skipdescript )
        
        dicdata = json.loads( jsondata )
        
        # List the main categories at the root level
        for entry in dicdata:
            if Item.isSupported( categories[ entry['xbmc_type'] ] ):
                item = {}
                item['id']                = int( entry['id'] )
                item['name']              = entry['title']#.encode( "utf8" )
                item['parent']            = int( entry['idparent'] )
                item['downloadurl']       = entry['fileurl']
                item['type']              = entry['type']#'CAT'
                item['totaldownloads']    = entry['totaldownloads']
                item['xbmc_type']         = categories[ entry['xbmc_type'] ]
                #item['cattype']           = entry
                if LANGUAGE_IS_FRENCH:
                    item['description']       = self.strip_off_passionCDT( unescape( urllib.unquote( entry['description'] ) ) )#.encode("cp1252").
                else:
                    item['description']       = self.strip_off_passionCDT( unescape( urllib.unquote( entry['description_en'] ) ) )#.encode("cp1252").decode('string_escape')
                if item['description'] == 'None':
                    item['description'] = _( 604 ) 
                item['language']          = entry['script_language']
                item['version']           = entry['version']
                item['author']            = entry['author']
                item['date']              = entry['createdate']
                if entry['date'] != '':
                    item['added'] = strftime( '%d-%m-%Y', localtime( int (entry['date'] ) ) )
                else:
                    item['added'] = entry['date']
                if entry['filesize'] != '':
                    item['filesize'] = int( entry['filesize'] )
                else:
                    item['filesize'] = 0 # ''
                item['thumbnail']         = Item.get_thumb( item['xbmc_type'] )
                item['previewpictureurl'] = entry['image']
                item['previewpicture']    = ""#Item.get_thumb( entry )
                item['image2retrieve']    = False # Temporary patch for reseting the flag after downlaad (would be better in the thread in charge of the download)
                
                item['orginalfilename']     = entry['orginalfilename']
                #TODO: deprecated??? Check server side
                item['fileexternurl']     = "None"
                self._setDefaultImages( item )
                list.append(item)
                print item
            else:
                print "Type not supported by the installer:"
                print entry
            
        return list
开发者ID:Quihico,项目名称:passion-xbmc,代码行数:85,代码来源:PassionXbmcBrowser.py

示例7: _createItemList

# 需要导入模块: import Item [as 别名]
# 或者: from Item import get_thumb [as 别名]
    def _createItemList( self, dom ) :
        """
        Parse XML and create the list of item defined in the XML file
        """
        list = []
        # Parse XML...
        for category_node in dom.getElementsByTagName('Addon') :
            item = {}
            for child in category_node.childNodes:
                # Type
                if child.localName == "Type" :
                    type = child.firstChild.data
                    #item['xbmc_type'] = self._mapType_Server2Local( child.firstChild.data.decode("utf8") )
                    #TODO: find cleaner solution for defining xbmc_type
                    if type == "Script":
                        item['xbmc_type'] = self._mapType_Server2Local( type )
                # Category
                elif child.localName == "Category" :
                    try:
                        category = child.firstChild.data
                    except:
                        category = None
                    item['cattype'] = category
                    #TODO: find cleaner solution for defining xbmc_type
                    if "Plugin" in category:
                        item['xbmc_type'] = self._mapType_Server2Local( category )
                # ID
                elif child.localName == "ID" :
                    try:
                        id = child.firstChild.data
                    except:
                        id = 0
                    item['downloadurl'] = "http://xbmczone.com/download.asp?id=%s" % ( id )
                # Name
                elif child.localName == "Name" :
                    try:
                        item['name'] = child.firstChild.data
                    except:
                        item['name'] = ""
                # File Name
                elif child.localName == "FileName" :
                    try:
                        item['filename'] = child.firstChild.data
                    except:
                        item['filename'] = ""
                # Version
                elif child.localName == "Version" :
                    #version = child.firstChild.data
                    try:
                        item['version'] = child.firstChild.data
                    except:
                        item['version'] = ""
                # Author
                elif child.localName == "Author" :
                    try:
                        item['author'] = child.firstChild.data
                    except:
                        item['author'] = ""
                # Date
                elif child.localName == "Date" :
                    try:
                        date          = child.firstChild.data
                        date_elements = date.split("/")
                        #item_date     = "%s-%s-%s" % ( date_elements[1].zfill(2), date_elements[0].zfill(2), date_elements[2] )                    
                        item['date']  = "%s-%s-%s" % ( date_elements[1].zfill(2), date_elements[0].zfill(2), date_elements[2] )                    
                    except:
                        item['date']  = ""
                # Description
                elif child.localName == "Description" :
                    try:
                        item['description'] = child.firstChild.data
                    except:
                        item['description'] = ""
                # Instructions
#                elif child.localName == "Instructions" :
#                    if child.firstChild != None :
#                        instructions = child.firstChild.data
#                    else :
#                        instructions = ""
                
            # Add entry...
            item['type']              = 'FIC'
            item['previewpictureurl'] = None
            item['language']          = ""
            item['added']             = ""
            item['thumbnail']         = Item.get_thumb( item['xbmc_type'] )
            item['previewpicture']    = ""#Item.get_thumb( item['xbmc_type'] )
            item['image2retrieve']    = False # Temporary patch for reseting the flag after download (would be better in the thread in charge of the download)
            
#            # Set image
#            self._setDefaultImages( item )
            
            list.append(item)
            print item
            
        return list
开发者ID:Quihico,项目名称:passion-xbmc,代码行数:98,代码来源:XbmcZoneBrowser.py

示例8: _createCatList

# 需要导入模块: import Item [as 别名]
# 或者: from Item import get_thumb [as 别名]
    def _createCatList( self, typeList):
        """
        Create and return the list of plugin categories
        Returns list and name of the list
        """
        categoryURL = {Item.TYPE_PLUGIN     : "http://www.xbmczone.com/installer/addon_categories.asp?type=Plugin",
                       Item.TYPE_SCRIPT_CAT : "http://www.xbmczone.com/installer/addon_categories.asp?type=Script"}
        list = []
        listTitle = Item.get_type_title( typeList )
        
        # Get page (XML)...
        usock = urllib.urlopen( categoryURL[ typeList ] )
        dom   = minidom.parse( usock )
        usock.close()
        

        # Add 'All' category
        item = {}
        item['cattype']   = self._mapType_Local2Server( typeList )
        item['name']      = _(2201)
        item['catname']      = "All"
        if self._mapType_Local2Server( typeList ) == "Script":
            item['xbmc_type'] = Item.TYPE_SCRIPT
        else: # Plugins
            item['xbmc_type'] = Item.TYPE_PLUGIN_VIDEO # Temporary patch ALL is not video plugin
        item['description']       = ""
        item['downloadurl']       = None
        item['type']              = 'CAT'
        item['previewpictureurl'] = None
        item['language']          = ""
        item['version']           = ""
        item['author']            = ""
        item['date']              = ""
        item['added']             = ""
        item['thumbnail']         = Item.get_thumb( item['xbmc_type'] )
        item['previewpicture']    = ""#Item.get_thumb( item['xbmc_type'] )
        item['image2retrieve']    = False # Temporary patch for reseting the flag after download (would be better in the thread in charge of the download)
        list.append(item)
        
        # Parse XML...
        for category in dom.getElementsByTagName('Category') :
            item = {}
            for child in category.childNodes:
                if child.localName == "Type" :
                    #type = child.childNodes[0].data
                    item['cattype'] = child.childNodes[0].data
                    #TODO: find cleaner solution for defining xbmc_type
                    if item['cattype'] == "Script":
                        #item['xbmc_type'] = self._mapType_Server2Local( child.childNodes[0].data )
                        item['xbmc_type'] = Item.TYPE_SCRIPT
                    
                elif child.localName == "Name" :
                    try:
                        item['name']    = child.childNodes[0].data
                        item['catname'] = child.childNodes[0].data
                        #item['xbmc_type'] = self._mapType_Server2Local( child.childNodes[0].data.decode("utf8") )
                        #TODO: find cleaner solution for defining xbmc_type
                        if "Plugin" in item['name']:
                            item['xbmc_type'] = self._mapType_Server2Local( child.childNodes[0].data )
                    except:
                        item['name']    = ""
                        item['catname'] = ""
                elif child.localName == "Description" :
                    try:
                        item['description'] = child.childNodes[0].data
                    except:
                        item['description'] = ""
            # Add entry...
#            listitem = xbmcgui.ListItem( category.replace("Plugin", ""), iconImage="DefaultFolder.png" )
#            xbmcplugin.addDirectoryItem( handle = int(sys.argv[ 1 ]), url = sys.argv[ 0 ] + '?action=plugin-list&category=%s' % urllib.quote( category ), listitem=listitem, isFolder=True)

            #item['parent']            = Item.TYPE_PLUGIN
            item['downloadurl']       = None
            item['type']              = 'CAT'
            item['previewpictureurl'] = None
            item['language']          = ""
            item['version']           = ""
            item['author']            = ""
            item['date']              = ""
            item['added']             = ""
            item['thumbnail']         = Item.get_thumb( item['xbmc_type'] )
            item['previewpicture']    = ""#Item.get_thumb( item['xbmc_type'] )
            item['image2retrieve']    = False # Temporary patch for reseting the flag after download (would be better in the thread in charge of the download)

            list.append(item)
            print item
            
        return listTitle, list
开发者ID:Quihico,项目名称:passion-xbmc,代码行数:90,代码来源:XbmcZoneBrowser.py

示例9: getNextList

# 需要导入模块: import Item [as 别名]
# 或者: from Item import get_thumb [as 别名]
    def getNextList(self, index=0):
        """
        Returns the list of item (dictionary) on the server depending on the location we are on the server
        Retrieves list of the items and information about each item
        Other possible name: down
        """
        # Check type of selected item
        list = []
        # TODO: manage exception
        try:
            if len(self.curList) > 0:
                if self.curList[index]["type"] == "CAT":
                    if self.curList[index]["xbmc_type"] == Item.TYPE_PLUGIN:
                        # root plugin case
                        self.type = Item.TYPE_PLUGIN
                        self.curCategory, list = self._createPluginList()

                    elif self.curList[index]["xbmc_type"] == Item.TYPE_SCRAPER:
                        # root scraper case
                        self.type = Item.TYPE_SCRAPER
                        self.curCategory, list = self._createScraperList()

                    else:
                        # List of item to download
                        self.type = self.curList[index]["xbmc_type"]
                        self.curCategory = Item.get_type_title(self.type)
                        listOfItem = self.passionFTPCtrl.getDirList(self.remotedirList[Item.get_type_index(self.type)])
                        print "listOfItem in a cat"
                        print listOfItem
                        for elt in listOfItem:
                            item = {}
                            item["name"] = os.path.basename(elt).replace("_", " ")
                            item["downloadurl"] = elt
                            item["type"] = "FIC"
                            item["xbmc_type"] = self.type
                            item["previewpictureurl"] = None
                            item["description"] = _(604)
                            item["language"] = ""
                            item["version"] = ""
                            item["author"] = ""
                            item["date"] = ""
                            item["added"] = ""
                            # TODO: have different icon between cat and item without thumb
                            # item['thumbnail']         = Item.THUMB_NOT_AVAILABLE
                            item["thumbnail"] = Item.get_thumb(item["xbmc_type"])
                            item["previewpicture"] = ""  # Item.THUMB_NOT_AVAILABLE
                            item[
                                "image2retrieve"
                            ] = (
                                False
                            )  # Temporary patch for reseting the flag after download (would be better in the thread in charge of the download)

                            self._set_item_infos(item)  # Update infos
                            list.append(item)
                            print item

                    # Save the current item name as category
                    self.curCategory = self.curList[index]["name"]
                else:
                    # Return the current list
                    # TODO: start download here?
                    print "This is not a category but an item (download)"
                    list = self.curList

            else:  # len(self.curList)<= 0
                # 1st time (init), we display root list
                self.type = Item.TYPE_ROOT
                # List the main categorie at the root level
                self.curCategory, list = self._createRootList()
        except Exception, e:
            print "Exception during getNextList"
            print_exc()
开发者ID:Quihico,项目名称:passion-xbmc,代码行数:74,代码来源:PassionFtpBrowser.py


注:本文中的Item.get_thumb方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。