Skip to content

Instantly share code, notes, and snippets.

@ssokolow
Created June 8, 2015 06:05
Show Gist options
  • Save ssokolow/af297c061b84efdad59c to your computer and use it in GitHub Desktop.
Save ssokolow/af297c061b84efdad59c to your computer and use it in GitHub Desktop.
Quick script to filter an IsThereAnyDeal.com JSON collection dump for Desura-only entries
#!/usr/bin/env python2
# To use: Place in same folder as collection.json and run in terminal
import json
SAFE_STORES = ['GOG', 'Humble Store', 'IndieGameStand', 'ShinyLoot']
data = json.load(file('collection.json'))
desura_only, desura_other = [], []
for row in data.values():
stores = [x['shop'] for x in row['details']]
stores.sort()
if 'Desura' not in stores:
continue # Not Desura
skip = False
for store in SAFE_STORES:
if store in stores:
skip = True
if skip:
continue
if stores == ['Desura']:
desura_only.append(row['title'])
elif stores == ['Desura', 'other']:
desura_other.append(row['title'])
desura_only.sort()
desura_other.sort()
def print_list(heading, names):
print "%s:\n\t%s" % (heading, '\n\t'.join(names))
print_list('Desura only', desura_only)
print "\n"
print_list('Desura or Groupees', desura_other)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment