本文整理汇总了Python中cart.Cart.download方法的典型用法代码示例。如果您正苦于以下问题:Python Cart.download方法的具体用法?Python Cart.download怎么用?Python Cart.download使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类cart.Cart
的用法示例。
在下文中一共展示了Cart.download方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: open
# 需要导入模块: from cart import Cart [as 别名]
# 或者: from cart.Cart import download [as 别名]
with open(util.INDEX_FILE, 'r') as index_file:
index = json.load(index_file)
installed_tids = index['installed-carts']
# Index all PICO-8 carts
indexer = CartIndexer()
tids = indexer.all_cart_tids()
# Process each cart that is not yet installed
for tid in tids:
if tid in installed_tids:
continue
# Parse the cart
cart = Cart(tid)
print('Processing cart: ' + cart.title)
# If the cart is not yet downloaded
if not cart.is_downloaded() and cart.valid:
print('Downloading cart: ' + cart.title)
# Download the cart
cart.download()
# Remember the cart in the index
installed_tids.append(tid)
index['installed-carts'] = installed_tids
with open(util.INDEX_FILE, 'w') as index_file:
json.dump(index, index_file)