def getCidForName(name, store): links = searchForItemsByName(name, store) cids = [] for link in links: try: logging.debug("Parsing:\n" + utils.prettyPrintJson(link)) name = link['name'] itemType = link['default_sku']['name'] cid = link['id'] platform = ", ".join(link['playable_platform']) logging.info ("Found: " + name + " - " + cid + " - Platform: " + platform + " - Type: " + itemType) cids.append(cid) except Exception as e: logging.warn("Got error '"+str(e)+"'' while parsing\n" + utils.prettyPrintJson(link)) return cids
def formatItems(items): cids = [] foundItems = [] for item in items: try: logging.debug("Parsing:\n" + utils.prettyPrintJson(item)) name = item['name'] itemType = item['game_contentType'] cid = item['id'] price = str(psn.getPrice(item)) platform = ", ".join(item['playable_platform']) foundItems.append((cid + "\t" + name + "\t" + platform + "\t" + price + "\t" + itemType)) cids.append(cid) except Exception as e: logging.warn("Got error "+str(e)+" while parsing\n" + utils.prettyPrintJson(item)) return foundItems