forked from sergey-galasov/psn-galaxy
-
Notifications
You must be signed in to change notification settings - Fork 21
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
1996d50
commit fedef01
Showing
13 changed files
with
390 additions
and
38 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,2 @@ | ||
aiohttp==3.5.4 | ||
galaxy.plugin.api==0.62 | ||
urllib3==1.24.1 | ||
galaxy.plugin.api==0.64 | ||
certifi==2019.3.9 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
from dataclasses import dataclass | ||
|
||
|
||
@dataclass | ||
class AccountUserInfo: | ||
region: str | ||
country: str | ||
language: str | ||
age: int | ||
|
||
|
||
class PSNFreePlusStore: | ||
BASE_URL = 'https://store.playstation.com/' | ||
GAMES_CONTAINTER_URL = BASE_URL + 'valkyrie-api/{language}/{country}/{age}/container/{id}' | ||
SESSION = BASE_URL + 'kamaji/api/valkyrie_storefront/00_09_000/user/session' | ||
SUBSCRIPTION_DETAILS = BASE_URL + 'kamaji/api/valkyrie_storefront/00_09_000/gateway/store/v1/users/me/subscription/IP9102-NPIA90006_00' | ||
|
||
PSPLUS_FREEGAMES_REGION_STORE = { | ||
'SCEA': 'STORE-MSF77008-PSPLUSFREEGAMES', | ||
'SCEE': 'STORE-MSF75508-PLUSINSTANTGAME', | ||
'SCE-ASIA': 'STORE-MSF86012-PLUS_FTT_CONTENT', | ||
'SCEJ': 'PN.CH.JP-PN.CH.MIXED.JP-PSPLUSFREEPLAY', | ||
'SCEK': 'STORE-MSF86012-PLUS_FTT_KR' | ||
} | ||
|
||
def __init__(self, http_client, user: AccountUserInfo): | ||
self._http_client = http_client | ||
self.id = self.PSPLUS_FREEGAMES_REGION_STORE[user.region] | ||
self.country = user.country | ||
self.language = user.language[:2] | ||
self.age = 21 if user.age > 21 else user.age | ||
|
||
@property | ||
def games_container_url(self): | ||
return self.GAMES_CONTAINTER_URL.format( | ||
language=self.language, country=self.country, age=self.age, id=self.id) | ||
|
||
async def get_subscription_info(self): | ||
"""This provides for information about user subscription data such as 'date_end' | ||
TODO: use it in plugin.get_subscriptions to provide extended info about subscritpion | ||
""" | ||
await self._refresh_session() | ||
return await self._http_client.get(self.SUBSCRIPTION_DETAILS) | ||
|
||
async def _refresh_session(self): | ||
"""TODO: generate auth code from logged-in user context""" | ||
body = 'code=' # + code | ||
res = await self._http_client.post(self.SESSION, data=body) | ||
return await res.json() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,7 @@ | ||
__version__ = "0.27" | ||
__version__ = "0.28" | ||
|
||
__changelog__ = { | ||
"0.28": """ | ||
- Implements `get_subscription_games` to report current free games from PSPlus | ||
""" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.