   'Unhinged'
   'Unglued'
   'Magic: The Gathering-Commander'
+  'Planechase 2012 Edition' # baleful strix
+  'Masters Edition II' # mana crypt. also in set 'Promo set for Gatherer'
 ]
 
 Sets = {}

process = ->
  if set = sets.pop()
    scrape set
  else
    # WTF
    od = sets.Odyssey.Rare
    bad = 'XXCall of the Herd (Call of the Herd)'
    good = 'Call of the Herd'
    i = od.indexOf(bad)
    if ~i
      od[i] = good
      Cards[good] = Cards[bad]
      Cards[good].name = good
      delete Cards[bad]

    fs.write 'cards/sets.json' , JSON.stringify(Sets) , 'w'
    fs.write 'cards/cards.json', JSON.stringify(Cards), 'w'
    phantom.exit()

scrape = (SET) ->
  url = "http://gatherer.wizards.com/Pages/Search/Default.aspx?output=spoiler&method=text&action=advanced&set=%5b%22#{SET}%22%5d"

  'The Dark'
  'Legends'
  'Revised Edition'
  'Antiquities'
  'Arabian Nights'
  'Unlimited Edition'
  'Limited Edition Beta'
