GOG Galaxy SDK Team f1fd00fcd3 version 0.38
2019-06-26 12:46:23 +02:00
2019-06-17 18:11:24 +02:00
2019-06-26 12:46:23 +02:00
2019-06-26 12:46:23 +02:00
2019-05-29 13:09:13 +02:00
2019-06-17 17:41:44 +02:00
2019-05-29 13:09:13 +02:00
2019-06-17 17:41:44 +02:00
2019-06-07 15:08:47 +02:00
2019-06-26 12:46:23 +02:00

GOG Galaxy Integrations Python API

This Python library allows to easily build community integrations for various gaming platforms with GOG Galaxy 2.0.

Features

Each integration in GOG Galaxy 2.0 comes as a separate Python script, and is launched as a separate process, that which needs to communicate with main instance of GOG Galaxy 2.0.

The provided features are:

  • multistep authorisation using a browser built into GOG Galaxy 2.0
  • support for GOG Galaxy 2.0 features:
    • importing owned and detecting installed games
    • installing and launching games
    • importing achievements and game time
    • importing friends lists and statuses
    • importing friends recomendations list
    • receiving and sending chat messages
  • cache storage

Platform Id's

Each integration can implement only one platform. Each integration must declare which platform it's integrating.

List of possible Platofrm IDs

Basic usage

Eeach integration should inherit from the :class:~galaxy.api.plugin.Plugin class. Supported methods like :meth:~galaxy.api.plugin.Plugin.get_owned_games should be overwritten - they are called from the GOG Galaxy client in the appropriate times. Each of those method can raise exceptions inherited from the :exc:~galaxy.api.jsonrpc.ApplicationError. Communication between an integration and the client is also possible with the use of notifications, for example: :meth:~galaxy.api.plugin.Plugin.update_local_game_status.

import sys
from galaxy.api.plugin import Plugin, create_and_run_plugin
from galaxy.api.consts import Platform

class PluginExample(Plugin):
    def __init__(self, reader, writer, token):
        super().__init__(
            Platform.Generic, # Choose platform from available list
            "0.1", # Version
            reader,
            writer,
            token
        )

    # implement methods
    async def authenticate(self, stored_credentials=None):
        pass

def main():
    create_and_run_plugin(PluginExample, sys.argv)

# run plugin event loop
if __name__ == "__main__":
    main()

Deployment

The client has a built-in Python 3.7 interpreter, so the integrations are delivered as python modules. In order to be found by GOG Galaxy 2.0 an integration folder should be placed in lookup directory. Beside all the python files, the integration folder has to contain manifest.json and all third-party dependencies. See an examplary structure.

Lookup directory

  • Windows:

    %localappdata%\GOG.com\Galaxy\plugins\installed

  • macOS:

    ~/Library/Application Support/GOG.com/Galaxy/plugins/installed

Manifest

Obligatory JSON file to be placed in a integration folder.

{
    "name": "Example plugin",
    "platform": "generic",
    "guid": "UNIQUE-GUID",
    "version": "0.1",
    "description": "Example plugin",
    "author": "Name",
    "email": "author@email.com",
    "url": "https://github.com/user/galaxy-plugin-example",
    "script": "plugin.py"
}
property description
guid
description
url
script path of the entry point module, relative to the integration folder

Dependencies

All third-party packages (packages not included in Python 3.7 standard library) should be deployed along with plugin files. Use the folowing command structure:

pip install DEP --target DIR --implementation cp --python-version 37

For example plugin that uses requests has structure as follows:

installed
└── my_integration
    ├── galaxy
    │   └── api
    ├── requests
    │   └── ...
    ├── plugin.py
    └── manifest.json

By integrating or attempting to integrate any applications or content with or into GOG Galaxy 2.0 you represent that such application or content is your original creation (other than any software made available by GOG) and/or that you have all necessary rights to grant such applicable rights to the relevant community integration to GOG and to GOG Galaxy 2.0 end users for the purpose of use of such community integration and that such community integration comply with any third party license and other requirements including compliance with applicable laws.

Description
No description provided
Readme MIT 466 KiB
Languages
Python 100%