import os
import urllib
import logging
+import time
class CardDb:
- set_ids = {
+ set_ids = { # NOTE: if there is ever an 'f' in here, update the ponyhead link generation
'Premiere': 'pr',
'Canterlot Nights': 'cn',
'Rock \'n Rave': 'rr',
set_names = {} # generated
- def __init__(self, json_path='cards.json', extra_path='cards_extra.json'):
+ def __init__(self, json_path='data/cards.json', extra_path='data/cards_extra.json'):
logging.debug('init card database')
for name, id in CardDb.set_ids.iteritems():
except IOError:
logging.exception('failed')
- def download_cards_json(self, json_path='cards.json', url='https://dl.dropboxusercontent.com/u/32733446/cards.json'):
+ def download_cards_json(self, json_path='data/cards.json', url='https://dl.dropboxusercontent.com/u/32733446/cards.json'):
logging.debug('downloading %s from %s', json_path, url)
try:
urllib.urlretrieve(url, json_path)