FailSpy / humble-steam-key-redeemer

Python script to extract all Humble Bundle keys and redeem them on Steam automagically.
132 stars 27 forks source link

Monthly Choices #5

Closed OpenSauce closed 3 years ago

OpenSauce commented 3 years ago

I know you had spoken about this on the Reddit thread, what's your thoughts for handling it? Maybe can do something simple for now and just print out how many choices you have left in the past?

FailSpy commented 3 years ago

Won't be able to implement anything until the Humble Choice games are released for this month (when I can see what's involved)

But I intend to be clear that the default keys extraction will NOT include "un-chosen" games from Humble Choice.

My thought is there can be a separate "Humble Choice" mode that will go through each month. If the number of choices matches the amount of choices available (i.e. the user can pick up ALL of the games,) then just choose all of them.

If not then go month by month (from oldest to newest) listing the games and asking the user to list games they want to choose via an index. e.g.

Humble Choice March 2021
2 choices available
Choices:
1. Game A
2. Game B
3. Game D
4. Game E

Enter each game's index you want, separated by comma: 1,3
OpenSauce commented 3 years ago

@FailSpy it's your lucky day, I believe they've changed it over to Tuesday now so the new choice is available. At least for me. 😄 What would be really cool, in my opinion, if we got the Metacritic rating of the games to help you choose.

FailSpy commented 3 years ago

Ooo, I like the Metacritic idea.

I'm going to implement #7 really quick as someone on reddit asked for it, and then we'll have modes implemented and I'll start investigating the Humble Choice related APIs.

Might be able to pull Steam reviews as well? Not sure.

FailSpy commented 3 years ago

Started branch 'humble_choice' which has a couple functions and APIs defined to pull the Humble Choice data.

FailSpy commented 3 years ago

Added. If you still have Humble Choice games available, feel free to try it out @OpenSauce and let me know how it goes!

EDIT: Tested quite a bit, looks good so far.

FailSpy commented 3 years ago

Also to the Metacritic idea, it doesn't seem like the Metacritic rating is available via any APIs, and scraping not only is seemingly against a well-enforced rule in Metacritic ToS, it's really just too much for this functionality, I think. I've included Steam ratings (ones provided by Humble directly!) where possible.

OpenSauce commented 3 years ago

I will also give it a go a bit later on :)

OpenSauce commented 3 years ago

@FailSpy Looks really good! I'll open another ticket with some suggestions if you like :)

FailSpy commented 3 years ago

Absolutely @OpenSauce! Also if you're particularly excited about one, feel free to implement it!

OpenSauce commented 3 years ago

@FailSpy I did try, I wanted to be able to sort the choices by rating... Unfortunately I'm not actually too familiar with Python so it got a bit messy :P

FailSpy commented 3 years ago

@OpenSauce

def get_rating(choice):
    if "steam_percent|decimal" in choice["user_rating"]:
        return choice["user_rating"]["steam_percent|decimal"]
    else:
        return 0

then whenever you want to sort: choices = sorted(choices,key=get_rating,reverse=True)

OpenSauce commented 3 years ago

@FailSpy Dumb question: Is this a "dictionary"? or what data type is this?

FailSpy commented 3 years ago

@OpenSauce 'choices' is a dictionary, yes. Meaning it has values attached to keys. So instead of indexing just by position (like in a list), it indexes by its key e.g. "user_rating". And the 'value' for "user_rating" is another dictionary that might contain the key "steam_percent|decimal"

Something to note is a dictionary can contain lists as values, and vice versa. For example, 'steam_keys' is a list of dictionaries

OpenSauce commented 3 years ago

@FailSpy Great, thanks for explaining