本文整理汇总了Python中Item.isSupported方法的典型用法代码示例。如果您正苦于以下问题:Python Item.isSupported方法的具体用法?Python Item.isSupported怎么用?Python Item.isSupported使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Item
的用法示例。
在下文中一共展示了Item.isSupported方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: _createListFromJson
# 需要导入模块: import Item [as 别名]
# 或者: from Item import isSupported [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