Compare commits

..

5 Commits
0.5 ... 0.7

Author SHA1 Message Date
Romuald Juchnowicz-Bierbasz
6c0389834b Increment version 2019-02-21 15:29:39 +01:00
Romuald Juchnowicz-Bierbasz
bc7d1c2914 SDK-2538: Use Optional 2019-02-21 15:17:38 +01:00
Romuald Juchnowicz-Bierbasz
d69e1aaa08 SDK-2538: Add LicenseType enum 2019-02-21 15:11:49 +01:00
Romuald Juchnowicz-Bierbasz
c2a0534162 Deploy only from master 2019-02-20 16:44:53 +01:00
Paweł Kierski
1614fd6eb2 Fix end of stream detecting 2019-02-20 16:41:44 +01:00
6 changed files with 28 additions and 17 deletions

View File

@@ -20,5 +20,7 @@ deploy_package:
- curl -X POST --silent --show-error --fail
"https://gitlab.gog.com/api/v4/projects/${CI_PROJECT_ID}/repository/tags?tag_name=${VERSION}&ref=${CI_COMMIT_REF_NAME}&private_token=${PACKAGE_DEPLOYER_API_TOKEN}"
when: manual
only:
- master
except:
- tags

View File

@@ -23,6 +23,12 @@ class Feature(Enum):
ImportUsers = "ImportUsers"
VerifyGame = "VerifyGame"
class LicenseType(Enum):
SinglePurchase = "SinglePurchase"
FreeToPlay = "FreeToPlay"
OtherUserLicense = "OtherUserLicense"
Unknown = "Unknown"
class LocalGameState(Enum):
Installed = "Installed"
Running = "Running"

View File

@@ -64,10 +64,12 @@ class Server():
async def run(self):
while self._active:
data = await self._reader.readline()
if not data:
# on windows rederecting a pipe to stdin result on continues
# not-blocking return of empty line on EOF
try:
data = await self._reader.readline()
if not data:
self._eof()
continue
except:
self._eof()
continue
data = data.strip()

View File

@@ -1,7 +1,7 @@
from dataclasses import dataclass
from typing import List
from typing import List, Optional
from galaxy.api.consts import LocalGameState, PresenceState
from galaxy.api.consts import LicenseType, LocalGameState, PresenceState
@dataclass
class Authentication():
@@ -10,8 +10,8 @@ class Authentication():
@dataclass
class LicenseInfo():
license_type: str
owner: str = None
license_type: LicenseType
owner: Optional[str] = None
@dataclass
class Dlc():
@@ -39,8 +39,8 @@ class LocalGame():
@dataclass
class Presence():
presence_state: PresenceState
game_id: str = None
presence_status: str = None
game_id: Optional[str] = None
presence_status: Optional[str] = None
@dataclass
class UserInfo():

View File

@@ -2,7 +2,7 @@ from setuptools import setup, find_packages
setup(
name="galaxy.plugin.api",
version="0.5",
version="0.7",
description="Galaxy python plugin API",
author='Galaxy team',
author_email='galaxy@gog.com',

View File

@@ -2,6 +2,7 @@ import asyncio
import json
from galaxy.api.types import Game, Dlc, LicenseInfo
from galaxy.api.consts import LicenseType
from galaxy.api.errors import UnknownError
def test_success(plugin, readline, write):
@@ -13,15 +14,15 @@ def test_success(plugin, readline, write):
readline.side_effect = [json.dumps(request), ""]
plugin.get_owned_games.return_value = [
Game("3", "Doom", None, LicenseInfo("SinglePurchase", None)),
Game("3", "Doom", None, LicenseInfo(LicenseType.SinglePurchase, None)),
Game(
"5",
"Witcher 3",
[
Dlc("7", "Hearts of Stone", LicenseInfo("SinglePurchase", None)),
Dlc("8", "Temerian Armor Set", LicenseInfo("FreeToPlay", None)),
Dlc("7", "Hearts of Stone", LicenseInfo(LicenseType.SinglePurchase, None)),
Dlc("8", "Temerian Armor Set", LicenseInfo(LicenseType.FreeToPlay, None)),
],
LicenseInfo("SinglePurchase", None))
LicenseInfo(LicenseType.SinglePurchase, None))
]
asyncio.run(plugin.run())
plugin.get_owned_games.assert_called_with()
@@ -89,7 +90,7 @@ def test_failure(plugin, readline, write):
}
def test_add_game(plugin, write):
game = Game("3", "Doom", None, LicenseInfo("SinglePurchase", None))
game = Game("3", "Doom", None, LicenseInfo(LicenseType.SinglePurchase, None))
async def couritine():
plugin.add_game(game)
@@ -127,7 +128,7 @@ def test_remove_game(plugin, write):
}
def test_update_game(plugin, write):
game = Game("3", "Doom", None, LicenseInfo("SinglePurchase", None))
game = Game("3", "Doom", None, LicenseInfo(LicenseType.SinglePurchase, None))
async def couritine():
plugin.update_game(game)