Compare commits

...

4 Commits

Author SHA1 Message Date
GOG Galaxy SDK Team
9d5d48032e version 0.35.2 2019-06-17 18:11:24 +02:00
GOG Galaxy SDK Team
179fd147c1 version 0.35.1 2019-06-17 17:41:44 +02:00
GOG Galaxy SDK Team
7789927ed9 version 0.34 2019-06-14 16:54:11 +02:00
GOG Galaxy SDK Team
e2f26271cb version 0.33.1 2019-06-14 14:49:25 +02:00
8 changed files with 157 additions and 7 deletions

82
PLATFORM_IDs.md Normal file
View File

@@ -0,0 +1,82 @@
### PLATFORM ID LIST
Platform ID list for GOG Galaxy 2.0 Integrations
| ID | Name |
| --- | --- |
| steam | Steam |
| psn | PlayStation Network |
| xboxone | Xbox Live |
| generic | Manually added games |
| origin | Origin |
| uplay | Uplay |
| battlenet | Battle.net |
| epic | Epic Games Store |
| bethesda | Bethesda.net |
| paradox | Paradox Plaza |
| humble | Humble Bundle |
| kartridge | Kartridge |
| itch | Itch.io |
| nswitch | Nintendo Switch |
| nwiiu | Nintendo Wii U |
| nwii | Nintendo Wii |
| ncube | Nintendo Game Cube |
| riot | Riot |
| wargaming | Wargaming |
| ngameboy | Nintendo Game Boy |
| atari | Atari |
| amiga | Amiga |
| snes | SNES |
| beamdog | Beamdog |
| d2d | Direct2Drive |
| discord | Discord |
| dotemu | DotEmu |
| gamehouse | GameHouse |
| gmg | Green Man Gaming |
| weplay | WePlay |
| zx | Zx Spectrum PC |
| vision | ColecoVision |
| nes | NES |
| sms | Sega Master System |
| c64 | Commodore 64 |
| pce | PC Engine |
| segag | Sega Genesis |
| neo | NeoGeo |
| sega32 | Sega 32X |
| segacd | Sega CD |
| 3do | 3DO Interactive |
| saturn | SegaSaturn |
| psx | Sony PlayStation |
| ps2 | Sony PlayStation 2 |
| n64 | Nintendo64 |
| jaguar | Atari Jaguar |
| dc | Sega Dreamcast |
| xboxog | Original Xbox games |
| amazon | Amazon |
| gg | GamersGate |
| egg | Newegg |
| bb | BestBuy |
| gameuk | Game UK |
| fanatical | Fanatical store |
| playasia | PlayAsia |
| stadia | Google Stadia |
| arc | ARC |
| eso | ESO |
| glyph | Trion World |
| aionl | Aion: Legions of War |
| aion | Aion |
| blade | Blade and Soul |
| gw | Guild Wars |
| gw2 | Guild Wars 2 |
| lin2 | Lineage 2 |
| ffxi | Final Fantasy XI |
| ffxiv | Final Fantasy XIV |
| totalwar | TotalWar |
| winstore | Windows Store |
| elites | Elite Dangerous |
| star | Star Citizen |
| psp | Playstation Portable |
| psvita | Playstation Vita |
| nds | Nintendo DS |
| 3ds | Nintendo 3DS |

View File

@@ -20,6 +20,12 @@ The provided features are:
- 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](PLATFORM_IDs.md)
## 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.
@@ -55,8 +61,22 @@ if __name__ == "__main__":
## Deployment
The client has a built-in Python 3.7 interpreter, so the integrations are delivered as `.py` files.
The additional `manifest.json` file is required:
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](#deploy-location). Beside all the python files, the integration folder has to contain [manifest.json](#deploy-manifest) and all third-party dependencies. See an [examplary structure](#deploy-structure-example).
### Lookup directory
<a name="deploy-location"></a>
- Windows:
`%localappdata%\GOG.com\Galaxy\plugins\installed`
- macOS:
`~/Library/Application Support/GOG.com/Galaxy/plugins/installed`
### Manifest
<a name="deploy-manifest"></a>
Obligatory JSON file to be placed in a integration folder.
```json
{
@@ -71,6 +91,32 @@ The additional `manifest.json` file is required:
"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:
<a name="deploy-structure-example"></a>
```bash
installed
└── my_integration
   ├── galaxy
   │   └── api
   ├── requests
   │   └── ...
   ├── plugin.py
└── manifest.json
```
## Legal Notice
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.

View File

@@ -7,6 +7,7 @@ GOG Galaxy Integrations Python API
Overview <overview>
API <galaxy.api>
Platform ID's <platforms>
Index
-------------------

View File

@@ -5,3 +5,11 @@
.. mdinclude:: ../../README.md
:start-line: 6
:end-line: 26
.. excluding Platforms Id's link
:ref:`platforms-link`
.. mdinclude:: ../../README.md
:start-line: 28

View File

@@ -0,0 +1,2 @@
.. _platforms-link:
.. mdinclude:: ../../PLATFORM_IDs.md

View File

@@ -2,7 +2,7 @@ from setuptools import setup, find_packages
setup(
name="galaxy.plugin.api",
version="0.33",
version="0.35.2",
description="GOG Galaxy Integrations Python API",
author='Galaxy team',
author_email='galaxy@gog.com',

View File

@@ -57,7 +57,12 @@ class Plugin:
# internal
self._register_method("shutdown", self._shutdown, internal=True)
self._register_method("get_capabilities", self._get_capabilities, internal=True)
self._register_method("initialize_cache", self._initialize_cache, internal=True)
self._register_method(
"initialize_cache",
self._initialize_cache,
internal=True,
sensitive_params="data"
)
self._register_method("ping", self._ping, internal=True)
# implemented by developer
@@ -466,7 +471,8 @@ class Plugin:
"""
self._notification_client.notify(
"push_cache",
params={"data": self._persistent_cache}
params={"data": self._persistent_cache},
sensitive_params="data"
)
# handlers

View File

@@ -4,6 +4,7 @@ from http import HTTPStatus
import aiohttp
import certifi
import logging
from galaxy.api.errors import (
AccessDenied, AuthenticationRequired, BackendTimeout, BackendNotAvailable, BackendError, NetworkError,
@@ -21,9 +22,9 @@ class HttpClient:
async def close(self):
await self._session.close()
async def request(self, method, *args, **kwargs):
async def request(self, method, url, *args, **kwargs):
try:
response = await self._session.request(method, *args, **kwargs)
response = await self._session.request(method, url, *args, **kwargs)
except asyncio.TimeoutError:
raise BackendTimeout()
except aiohttp.ServerDisconnectedError:
@@ -33,6 +34,8 @@ class HttpClient:
except aiohttp.ContentTypeError:
raise UnknownBackendResponse()
except aiohttp.ClientError:
logging.exception(
"Caught exception while running {} request for {}".format(method, url))
raise UnknownError()
if response.status == HTTPStatus.UNAUTHORIZED:
raise AuthenticationRequired()
@@ -45,6 +48,8 @@ class HttpClient:
if response.status >= 500:
raise BackendError()
if response.status >= 400:
logging.warning(
"Got status {} while running {} request for {}".format(response.status, method, url))
raise UnknownError()
return response