def updateAll(self): prices = get_db('prices') for key in newitems: newitem = newitems[key] prices[str(key)] = repr((newitem.itemId, newitem.lowPrice, newitem.highPrice, newitem.active, newitem.title)) prices.sync() prices.close()
def updateAll(self,items): pricecheck = get_db('pricecheck') pricecheck.clear() for key in items: pc = items[key] pricecheck[str(key)] = repr(pc.content) pricecheck.sync() pricecheck.close()
def getAll(self): prices=get_db('prices') items={} for key in prices: (itemId,lowPrice, highPrice, active, title) = eval(prices[key]) newitem = PricedItem(itemId, lowPrice, highPrice, active, title) items[key] = newitem prices.close() return items
def getAll(self): items={} pricecheck = get_db('pricecheck') for key in pricecheck: content = eval(pricecheck[key]) pc = PriceCheck(int(key), content) items[key] = pc pricecheck.close() return items
def getAll(self): venddb = get_db('vendlog') logitems=eval(venddb['log']) vendlog=[] for item in logitems: (type, actionTime, itemId, quantity, price) = item entry = VendLog(itemId, type, actionTime, quantity, price) vendlog.append(entry) itemdb.close() venddb.close() return vendlog
def start(self): self.allKeys=get_db("items").keys() print self.allKeys self.currentIndex = len(self.allKeys) - 10 self.items={} self.client.addEvent(lambda: self.nextPriceCheck(), 0.25)
def deleteItem(self, itemId): prices = get_db('prices') if str(itemId) in prices: del prices[str(itemId)] prices.sync() prices.close()
def addItem(self, itemId, lowPrice, highPrice, active=True, title='' ): prices = get_db('prices') prices[str(itemId)] = repr((itemId, lowPrice, highPrice, active, title)) prices.sync() prices.close()
def __init__(self, itemId): itemdb=get_db('items') self.itemId = itemId self.name = itemdb[str(itemId)][2] itemdb.close()
def start(self): self.allKeys = get_db("items").keys() print self.allKeys self.currentIndex = len(self.allKeys) - 10 self.items = {} self.client.addEvent(lambda: self.nextPriceCheck(), 0.25)