UncleGoogle / galaxy-integration-humblebundle

Humble Bundle integration for GOG Galaxy 2.0
GNU General Public License v3.0
186 stars 19 forks source link

Auto-tagging based on library source #84

Closed Kaylakaze closed 4 years ago

Kaylakaze commented 4 years ago

Right now, you can't really tell what is from Trove, DRM-Free, or a key. It'd be good if these could be tagged in some way (if tags themselves wouldn't work) so that they could be grouped or at least distinguished from each other.

Kaylakaze commented 4 years ago

Or, alternatively (and maybe better) could this be divided into separate integrations (one for keys, one for drm-free and Trove)?

UncleGoogle commented 4 years ago

Hey, I'm aware of this problem, refer to this issue: https://github.com/gogcom/galaxy-integrations-python-api/issues/55

TLDR: they wrote that currently no plan for bookmark management from plugin side, but licenses will be supported in the future with custom names (in this case "Trove").

Tags could be OK-ish for keys, but tagging method has to be is triggered manually (each time) from settings window in Galaxy. So not very helpful. I cannot send auto-tagged games to Galaxy. But maybe it is better than nothing... what do you think?

Kaylakaze commented 4 years ago

Actually, I think my updated idea about it being two separate integrations (if GOG would allow it) would be the optimal process since the DRM-free and Trove content is handled VERY differently than the key content. Plus it'd allow separate icons for each.

The license solution does sound good depending on how long it takes the GOG team to implement, especially since it'd be so useful for other stuff (like Origin as mentioned in the thread).

UncleGoogle commented 4 years ago

DRM-free and Trove content is handled VERY differently than the key content

True. Initial plan was to show only DRM-free. And that the best fit to Galaxy philosophy (there are no pure-key stores ID in platforms ID list for possible integrations).

Then people wanted keys as an option - because it is handy. Technically is also very near - it's the same API call - in one order there are both keys and links to drm downloads. And login is common the same for trove. It is more handy to log in only once and it is easier to support one codebase.

Multiple integrations for the same platform are not supported in Galaxy. This closes the possibility of creating parallel integration.

Kaylakaze commented 4 years ago

And login is common the same for trove. It is more handy to log in only once and it is easier to support one codebase.

That's true, and the obvious major point of inefficiency. I do very much like the key functionality. Your code would give me a good place to start on making something that could, at the very least, create a Google Sheet of unused keys and URLs for getting them, if I can figure out the code (I've always hated Python and am not exceptionally well-versed in it). Being able to compare them with all your other libraries though is a nice unique functionality provided by Galaxy.

I just took a look at the integration Github and am completely flabbergasted by the lack of insight and forward-thinking of the GOG team. I can't even begin to fathom how they thought it was a good idea to predefine possible platforms.

Kaylakaze commented 4 years ago

After some experimentation, I found that you CAN have more than one plugin to the same integration (it's just that a single plugin can't do more than one integration). I currently have 2 copies of your Humble Bundle plugin running: one that pulls Keys and one that pulls Trove.

Unfortunately, this doesn't help too much since they still have the same icon and bookmark. But the data is being stored in separate databases.

Update: I took my "keys" plugin and changed the manifest to "totalwar" and the init to Platform.TotalWar and it loaded my Humble Bundle keys to the "Total War" bookmark and gave them a circular icon with lots of spacing. The Install button doesn't work, probably a result of the "features" for Total War integration not showing "Install Games" as an option when connecting. I'm not sure where those features are coming from.

UncleGoogle commented 4 years ago

Hey. Sorry for late response.

Your code would give me a good place to start on making something that could, at the very least, create a Google Sheet of unused keys and URLs for getting them, if I can figure out the code (I've always hated Python and am not exceptionally well-versed in it).

Just replace _get_keys method in library.py file with sth like that, change CSV_NAME and restart Galaxy (keys should be included in config file; it can be open with double click on Install button of any game) :

    @staticmethod
    def _get_keys(orders: list, show_revealed_keys: bool) -> List[Key]:
        keys = []
        for details in orders:
            for tpks in details['tpkd_dict']['all_tpks']:
                try:
                    key = Key(tpks)
                except Exception as e:
                    logging.error(f"Error while parsing tpks {repr(e)}: {tpks}", extra={'tpks': tpks})
                else:
                    keys.append(key)

        CSV_NAME = 'C:\Users\me\Desktop\humble_keys.csv'
        with open(CSV_NAME, 'w') as f:
            for key in keys:
                print(key.human_name, key.key_val or 'not revealed', sep='\t', file=f)

        return keys

Unfortunately there is not separate link to activation, all it must be done manually in https://www.humblebundle.com/home/keys

After some experimentation, I found that you CAN have more than one plugin to the same integration (it's just that a single plugin can't do more than one integration).

Nice, how did you do that? Can you add a comment there: #30 ?

Update: I took my "keys" plugin and changed the manifest to "totalwar" (...)

Ah I see. Probably they store some information on backend. Maybe hardcode. Maybe such multiple games coming from totalwar are suspicious :grinning:

UncleGoogle commented 4 years ago

I've added manual tags import. It will be released on 7.0 hopefully next week.

UncleGoogle commented 4 years ago

Released. Closing, as can't do more now.