diff --git a/PLATFORM_IDs.md b/PLATFORM_IDs.md index 60e8737..42b2171 100644 --- a/PLATFORM_IDs.md +++ b/PLATFORM_IDs.md @@ -4,10 +4,10 @@ Platform ID list for GOG Galaxy 2.0 Integrations | ID | Name | | --- | --- | +| test | Testing purposes | | steam | Steam | | psn | PlayStation Network | | xboxone | Xbox Live | -| generic | Manually added games | | origin | Origin | | uplay | Uplay | | battlenet | Battle.net | diff --git a/README.md b/README.md index 60896ba..9ed988b 100644 --- a/README.md +++ b/README.md @@ -36,20 +36,31 @@ Communication between an integration and the client is also possible with the us import sys from galaxy.api.plugin import Plugin, create_and_run_plugin from galaxy.api.consts import Platform +from galaxy.api.types import Authentication, Game, LicenseInfo, LicenseType + class PluginExample(Plugin): def __init__(self, reader, writer, token): super().__init__( - Platform.Generic, # Choose platform from available list - "0.1", # Version + Platform.Test, # choose platform from available list + "0.1", # version reader, writer, token ) # implement methods + + # required async def authenticate(self, stored_credentials=None): - pass + return Authentication('test_user_id', 'Test User Name') + + # required + async def get_owned_games(self): + return [ + Game('test', 'The Test', None, LicenseInfo(LicenseType.SinglePurchase)) + ] + def main(): create_and_run_plugin(PluginExample, sys.argv) @@ -76,6 +87,20 @@ In order to be found by GOG Galaxy 2.0 an integration folder should be placed in `~/Library/Application Support/GOG.com/Galaxy/plugins/installed` +### Logging +Root logger is already setup by GOG Galaxy to store rotated log files in: + +- Windows: + + `%programdata%\GOG.com\Galaxy\logs` + +- macOS: + + `/Users/Shared/GOG.com/Galaxy/Logs` + +Plugin logs are kept in `plugin--.log`. +When debugging, inspecting the other side of communication in the `GalaxyClient.log` can be helpful as well. + ### Manifest @@ -84,8 +109,8 @@ Obligatory JSON file to be placed in an integration folder. ```json { "name": "Example plugin", - "platform": "generic", - "guid": "UNIQUE-GUID", + "platform": "test", + "guid": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx", "version": "0.1", "description": "Example plugin", "author": "Name", @@ -97,9 +122,8 @@ Obligatory JSON file to be placed in an integration folder. | property | description | |---------------|---| -| `guid` | | -| `description` | | -| `url` | | +| `guid` | custom Globally Unique Identifier | +| `version` | the same string as `version` in `Plugin` constructor | | `script` | path of the entry point module, relative to the integration folder | ### Dependencies diff --git a/src/galaxy/http.py b/src/galaxy/http.py index 2f3539f..a5bc76a 100644 --- a/src/galaxy/http.py +++ b/src/galaxy/http.py @@ -6,7 +6,6 @@ Exemplary simple web service could looks like: .. code-block:: python - import logging from galaxy.http import create_client_session, handle_exception class BackendClient: