|
game_launcher 1.1.0
Modern Linux game launcher with Steam / Proton / Wine integration
|
Service for fetching game time estimates from HowLongToBeat. More...
#include <hltb_service.h>
Public Types | |
| using | InfoCallback = std::function<void(const HowLongToBeatInfo&)> |
| using | SearchCallback = std::function<void(const std::vector<HLTBSearchResult>&)> |
Static Public Member Functions | |
| static void | batchFetch (std::vector< Game * > &games, const std::function< void(int completed, int total)> &progressCallback=nullptr) |
| Fetch HLTB info for multiple games. | |
| static void | clearCache () |
| Clear the HLTB cache. | |
| static LRUCache< std::string, HowLongToBeatInfo >::Stats | getCacheStats () |
| Get cache statistics. | |
| static HowLongToBeatInfo | getGameInfo (const std::string &gameName) |
| Get time estimates for a game by name. | |
| static void | getGameInfoAsync (const std::string &gameName, const InfoCallback &callback) |
| Get game info asynchronously. | |
| static HowLongToBeatInfo | getGameInfoById (int hltbId) |
| Get time estimates by HLTB game ID. | |
| static std::vector< HLTBSearchResult > | search (const std::string &query, int maxResults=10) |
| Search for games on HLTB. | |
| static void | searchAsync (const std::string &query, const SearchCallback &callback, int maxResults=10) |
| Search asynchronously. | |
Service for fetching game time estimates from HowLongToBeat.
Usage:
Definition at line 69 of file hltb_service.h.
| using HLTBService::InfoCallback = std::function<void(const HowLongToBeatInfo&)> |
Definition at line 73 of file hltb_service.h.
| using HLTBService::SearchCallback = std::function<void(const std::vector<HLTBSearchResult>&)> |
Definition at line 74 of file hltb_service.h.
|
static |
Fetch HLTB info for multiple games.
| games | Games to fetch info for (updates in place) |
| progressCallback | Optional callback for progress updates |
Efficiently fetches HLTB data for multiple games, skipping those that already have fresh data.
Definition at line 590 of file hltb_service.cpp.
References getGameInfo().
|
static |
Clear the HLTB cache.
Definition at line 630 of file hltb_service.cpp.
References hltbCache(), and Logger::info().
|
static |
|
static |
Get time estimates for a game by name.
| gameName | Game name to search for |
Searches HLTB and returns the best matching result. Results are cached with a 30-day TTL.
Definition at line 437 of file hltb_service.cpp.
References Logger::debug(), HowLongToBeatInfo::found, hltbCache(), Logger::info(), search(), and Logger::warn().
Referenced by batchFetch(), and getGameInfoAsync().
|
static |
Get game info asynchronously.
| gameName | Game name to search for |
| callback | Function called with results |
Definition at line 523 of file hltb_service.cpp.
References getGameInfo().
|
static |
Get time estimates by HLTB game ID.
| hltbId | HowLongToBeat game ID |
Definition at line 501 of file hltb_service.cpp.
References HowLongToBeatInfo::found, and Logger::warn().
|
static |
Search for games on HLTB.
| query | Search query |
| maxResults | Maximum results to return |
Definition at line 387 of file hltb_service.cpp.
References Logger::debug(), ShellUtils::escapeJson(), Logger::info(), and Logger::warn().
Referenced by getGameInfo(), and searchAsync().
|
static |
Search asynchronously.
| query | Search query |
| callback | Function called with results |
| maxResults | Maximum results |
Definition at line 556 of file hltb_service.cpp.
References search().