Guest User

Untitled

a guest
Aug 17th, 2013
112
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 1.90 KB | None | 0 0
  1.  
  2.  
  3. EVEROOT = r"C:/Program Files (x86)/CCP/EVE"
  4. OUTPATH = r"C:/orderdump"
  5.  
  6. import time
  7. import os
  8. from reverence import blue
  9.  
  10.  
  11. eve = blue.EVE(EVEROOT)
  12. cfg = eve.getconfigmgr()
  13. cachemgr = eve.getcachemgr()
  14. cmc = cachemgr.LoadCacheFolder("CachedMethodCalls")
  15.  
  16. print "Deleting old records... \n"
  17. for root, dirs, files in os.walk(OUTPATH, topdown=False):
  18.     for name in files:
  19.         os.remove(os.path.join(root, name))
  20. for key, obj in cmc.iteritems():
  21.         if key[1]=="GetOrders":
  22.                 item = cfg.invtypes.Get(key[3])
  23.                 region = cfg.evelocations.Get(key[2])
  24.                 print "Processing " + item.name + " [" + region.locationName +"]... \n"
  25.                 txtfile = open(os.path.join(OUTPATH, item.name+"-"+region.locationName+".csv"), 'w')
  26.                 txtfile.write("orderID,typeID,volumeEntered,volumeRemaining,price,minVolume,bid,duration,stationID,range,jumps,\n")
  27.                 for history_item in obj['lret']:
  28.                     for entry in history_item:
  29.                         line = "%(OrderID)i, %(TypeID)i, %(VolEnt)i, %(VolRem)i, %(Price).2f, %(MinVolume)i, \
  30.                                %(Duration)i, %(StationID)i, %(Range)i, %(Jumps)i," % \
  31.                               {'OrderID': entry['orderID'], \
  32.                                'TypeID': entry['typeID'], \
  33.                                'VolEnt': entry['volEntered'], \
  34.                                'VolRem': entry['volRemaining'], \
  35.                                'Price': entry['price'], \
  36.                                'MinVolume': entry['minVolume'], \
  37.                                'Duration': entry['duration'], \
  38.                                'StationID': entry['stationID'], \
  39.                                'Range': entry['range'], \
  40.                                'Jumps': entry['jumps']}
  41.                         txtfile.write(line+"\n")
  42.                 txtfile.close()
Advertisement
Add Comment
Please, Sign In to add comment