Advertisement
Guest User

Untitled

a guest
Jul 5th, 2015
188
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.90 KB | None | 0 0
  1. #!/usr/bin/env python2
  2. # To use: Place in same folder as collection.json and run in terminal
  3.  
  4. import json
  5. SAFE_STORES = ['GOG', 'Humble Store', 'IndieGameStand', 'ShinyLoot']
  6.  
  7. data = json.load(file('collection.json'))
  8. desura_only, desura_other = [], []
  9. for row in data.values():
  10. stores = [x['shop'] for x in row['details']]
  11. stores.sort()
  12.  
  13. if 'Desura' not in stores:
  14. continue # Not Desura
  15.  
  16. skip = False
  17. for store in SAFE_STORES:
  18. if store in stores:
  19. skip = True
  20. if skip:
  21. continue
  22.  
  23. if stores == ['Desura']:
  24. desura_only.append(row['title'])
  25. elif stores == ['Desura', 'other']:
  26. desura_other.append(row['title'])
  27.  
  28. desura_only.sort()
  29. desura_other.sort()
  30.  
  31. def print_list(heading, names):
  32. print "%s:\n\t%s" % (heading, '\n\t'.join(names))
  33.  
  34. print_list('Desura only', desura_only)
  35. print "\n"
  36. print_list('Desura or Groupees', desura_other)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement