Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ########################################
- # DO NOT CHANGE ANYTHING BELOW THIS LINE
- ########################################
- import sys
- from boardgamegeek.api import BoardGameGeek
- bgg = BoardGameGeek()
- def compare(users, status):
- master_list = []
- for user in users:
- collection = bgg.collection(user_name=user)
- if status == 'all':
- master_list.append([item.name for item in collection.items])
- else:
- master_list.append([item.name for item in collection.items if getattr(item, status)])
- return [val for val in master_list[0] if val in master_list[1]]
- if __name__ == '__main__':
- options = [
- 'all',
- 'for_trade',
- 'owned',
- 'prev_owned',
- 'want',
- 'wishlist',
- ]
- users = sys.argv[1:3]
- # if there are more than 2 args, and the 3rd arg is valid
- if len(sys.argv[1:4]) > 2 and sys.argv[3] in options:
- status = sys.argv[3]
- # else default to only owned games
- else:
- status = 'owned'
- try:
- print compare(users, status)
- except Exception, e:
- print "An error occurred, please try again."
Add Comment
Please, Sign In to add comment