Created
September 5, 2024 18:55
-
-
Save nazhor/5bef7a38cc9bdd7c363b7bc5f416850d to your computer and use it in GitHub Desktop.
Python script for checking installed games with HowLongToBeat
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# https://github.com/ScrappyCocco/HowLongToBeat-PythonAPI/blob/master/README.md | |
import os | |
from howlongtobeatpy import HowLongToBeat | |
GAME_PATHS = [ | |
"C:/Program Files (x86)/Steam/steamapps/common" | |
] | |
def get_game_games(): | |
games_found = [] | |
for game_path in GAME_PATHS: | |
for game_name in os.listdir(game_path): | |
games_found.append(game_name.lower()) | |
return games_found | |
def main(): | |
print("-- Check HowLongToBeat --") | |
print("-------------------------") | |
for game_name in get_game_games(): | |
results = HowLongToBeat().search(game_name) | |
if results is not None and len(results) > 0: | |
best_element = max(results, key=lambda element: element.similarity) | |
print("--", game_name, "--") | |
print("Main story: ", best_element.main_story) | |
print("Main+Extra: ", best_element.main_extra) | |
print("Completionist: ", best_element.completionist) | |
print("-------------------------") | |
if __name__ == '__main__': | |
main() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment