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