Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rough draft of incorporating how long to beat times #35

Draft
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

shaapaoja
Copy link

Used the howlongtobeatpy to incorporate the how long to beat times. This does add a substantial amount of time to the script, so it probably should not be done by default.

Used the howlongtobeatpy to incorporate the how long to beat times. This does add a substantial amount of time to the script, so it probably should not be done by default.
@shaapaoja
Copy link
Author

Created a draft pull request because I imagine there is a good chance that this is not how you would want this accomplished. Regardless I thought I would at least share what I put together because for a project I was working on I needed an idea on game completion times.

@Varstahl
Copy link
Contributor

Varstahl commented Dec 8, 2020

There's nothing wrong with the code, although I'm wondering if we should merge this:

  • there's no way to know if the results in question are of the game itself, since it picks the best match from the results but we have no guarantees.
  • it significantly increases export times, it (obviously) went from a few seconds to several minutes now (not even finished yet). Update several more minutes later I interrupted it, and it was still at K.
  • unless I'm mistaken it's a single request for every single game. In my case there's about 1300 games, so it's 1300 requests in a handful of seconds. Sum it up for whoever does this at the same time, and we weaponized this tool into a DDoS vector.
  • there's no caching. It means that every time you re-export you redo all the requests all over again.

For smaller libraries it's a no brainer, but for huge libraries this can cause a lot of issues. If we want this feature, I would suggest doing a 2 pass for it, keep the export as is, and then use a second script to embed download times into the CSV, with caching to speed it up.

I'll let @AB1908 be the judge of that.

Improvements made in this commit:
1. Moved HTTP logic to a single session to avoid session creation times
2. Made async calls for all the HTTP calls
3. Added a progress bar using tqdm to give user some visibility into progress being made

Time for my library of ~600 titles went from ~15 minutes to ~1 minute
@shaapaoja
Copy link
Author

Added significant performance improvements with the latest changes. I would suggest you try again as you have a larger library than I do.
I looked into the howlongtobeat.com site and didn't see any particular way to get a batch of games at once except for using a steam ID, which clearly will not work for this case.
I also ran this many times today and did not run into any DDOS type issues.
Regardless if there is more that people can think of I would consider looking into helping more, but I personally believe it is in a pretty good state now.
The first draft I knew was in a pretty rough state, but now I think it could actually be usable. I will obviously let you and @AB1908 be the judges though.

@shaapaoja
Copy link
Author

Also forgot to mention I converted everything to be only in hours as I personally wanted to be able to easily sort by these times in Google Sheets.
I created a number format of the following "# ?/? "Hours"; ; ; @" to show up nicely while being able to also add sorting.

@AB1908
Copy link
Owner

AB1908 commented Dec 22, 2020

Wow, I've been busy and this was indeed on my todo list. This code is now far beyond what I can comprehend so I might have to do quite a bit of reading before I can fully understand and review the thing. Thanks for all the work though!

I think @Varstahl raised quite a few good points and I do prefer the output in hours as well. I believe converting hours to days, months, etc is quite doable on a user's end.

Initially, I had thought of doing a "percent match" when using HLTB and I'd set a threshold for a value to be accepted. Does the library have anything like that? If not, I suppose we'll have to come up other ideas lest we allow false positives to creep in. What are your thoughts?

@FolkSong
Copy link

FolkSong commented Oct 9, 2021

I think it may have broken, for me the output file has "UNAVAILABLE" as every entry in the HLTB columns.

@AB1908
Copy link
Owner

AB1908 commented Oct 11, 2021

I've been unable to test this as I've been busy with some other projects. Perhaps the HLTB wrapper has changed significantly since last this was used.

@FolkSong
Copy link

FolkSong commented Nov 6, 2021

Just FYI I've started using Playnite which has HLTB and export plugins, so please don't look at this for my sake. I would suggest anyone using Gog Galaxy to give Playnite a try.

@AB1908
Copy link
Owner

AB1908 commented Nov 7, 2021

I've done exactly the same. Playnite seems to be much better suited to my needs and offers native export options haha.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants