Skip to content

Commit

Permalink
Merge pull request #4 from kurokobo/fix-msstore
Browse files Browse the repository at this point in the history
fix: use package id instead
  • Loading branch information
kurokobo authored Jul 8, 2021
2 parents 96def54 + 995af05 commit a3e8d4d
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 31 deletions.
16 changes: 8 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -129,14 +129,14 @@ Get **Platform Name** of the product to track. You can use the helper script in
```bash
$ docker-compose run --rm notifier helper/app_finder.py -p msstore -m JP -i 9nblggh2jhxj
KEY App Id Market Name Platform Package Name
------------------------------ ------------ -------- ------------------------ ----------------- -------------------------------------------------------
9nblggh2jhxj:Windows.Xbox 9nblggh2jhxj JP Minecraft for Windows 10 Windows.Xbox Microsoft.MinecraftUWP_1.16.22101.70_x86__8wekyb3d8bbwe
9nblggh2jhxj:Windows.Universal 9nblggh2jhxj JP Minecraft for Windows 10 Windows.Universal Microsoft.MinecraftUWP_1.16.22101.0_x86__8wekyb3d8bbwe
9nblggh2jhxj:Windows.Universal 9nblggh2jhxj JP Minecraft for Windows 10 Windows.Universal Microsoft.MinecraftUWP_1.16.22101.0_arm__8wekyb3d8bbwe
9nblggh2jhxj:Windows.Xbox 9nblggh2jhxj JP Minecraft for Windows 10 Windows.Xbox Microsoft.MinecraftUWP_1.16.22101.70_arm__8wekyb3d8bbwe
9nblggh2jhxj:Windows.Universal 9nblggh2jhxj JP Minecraft for Windows 10 Windows.Universal Microsoft.MinecraftUWP_1.16.22101.0_x64__8wekyb3d8bbwe
9nblggh2jhxj:Windows.Xbox 9nblggh2jhxj JP Minecraft for Windows 10 Windows.Xbox Microsoft.MinecraftUWP_1.16.22101.70_x64__8wekyb3d8bbwe
KEY App Id Market Name Platform Package Id
------------------------------ ------------ -------- ------------------------ ----------------- ----------------------------------------
9nblggh2jhxj:Windows.Xbox 9nblggh2jhxj JP Minecraft for Windows 10 Windows.Xbox 845277e2-565d-741e-3c91-a883a873d4be-Arm
9nblggh2jhxj:Windows.Universal 9nblggh2jhxj JP Minecraft for Windows 10 Windows.Universal 6c489be8-f48d-a78b-a405-44633558c5f7-Arm
9nblggh2jhxj:Windows.Xbox 9nblggh2jhxj JP Minecraft for Windows 10 Windows.Xbox 426ccf1b-9364-fc9a-3a9d-f24ab7b493a6-X86
9nblggh2jhxj:Windows.Universal 9nblggh2jhxj JP Minecraft for Windows 10 Windows.Universal 7ac62c84-44fc-8c53-3f64-549fcbe9c471-X86
9nblggh2jhxj:Windows.Universal 9nblggh2jhxj JP Minecraft for Windows 10 Windows.Universal 78c121c0-7dc6-29ca-7a71-3298afb37686-X64
9nblggh2jhxj:Windows.Xbox 9nblggh2jhxj JP Minecraft for Windows 10 Windows.Xbox b0d37c82-091c-c4c5-e702-d7e12aff541d-X64
```
Keep the value of the `KEY` column (`<App Id>:<Platform>`) of the row of the platform you want to track. This value can be used to prepare `.env` file in later steps.
Expand Down
14 changes: 3 additions & 11 deletions helper/app_finder.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import argparse
import re

from gevent import monkey

Expand Down Expand Up @@ -53,7 +52,7 @@ def gather_msstore(id, market):
}
_product_info = requests.get(url=_endpoint, headers=_headers, params=_params).json()

_header = ["KEY", "App Id", "Market", "Name", "Platform", "Package Name"]
_header = ["KEY", "App Id", "Market", "Name", "Platform", "Package Id"]
_table = []
for _package in _product_info["Products"][0]["DisplaySkuAvailabilities"][0]["Sku"][
"Properties"
Expand All @@ -62,21 +61,14 @@ def gather_msstore(id, market):
"LocalizedProperties"
][0]["SkuTitle"]
_platform_dependencies = _package["PlatformDependencies"][0]["PlatformName"]
_package_fullname = ""
if _package["PackageFullName"]:
_package_fullname = _package["PackageFullName"]
elif _package["PackageDownloadUris"]:
_package_fullname = re.sub(
"^.*/", "", _package["PackageDownloadUris"][0]["Uri"]
)

_package_id = _package["PackageId"]
_row = [
"{}:{}".format(id, _platform_dependencies),
id,
market,
_name,
_platform_dependencies,
_package_fullname,
_package_id,
]
_table.append(_row)

Expand Down
16 changes: 4 additions & 12 deletions modules/msstore.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import copy
import logging
import re
from datetime import datetime

import ms_cv
Expand Down Expand Up @@ -82,22 +81,15 @@ def gather_app_info(self):
"LocalizedProperties"
][0]["SkuTitle"]

_package_fullname = []
_package_ids = []

for _package in _current_product["DisplaySkuAvailabilities"][0]["Sku"][
"Properties"
]["Packages"]:
if _package["PlatformDependencies"][0]["PlatformName"] == _app.filter:
_fullname = ""
if _package["PackageFullName"]:
_fullname = _package["PackageFullName"]
elif _package["PackageDownloadUris"]:
_fullname = re.sub(
"^.*/", "", _package["PackageDownloadUris"][0]["Uri"]
)
_package_fullname.append(_fullname)
_package_ids.append(_package["PackageId"])

_package_fullname.sort()
_package_ids.sort()

_last_updated = None
if self.old_result and _app.id in self.old_result:
Expand All @@ -108,7 +100,7 @@ def gather_app_info(self):
id=_app.id,
name=_name,
),
data=",".join(_package_fullname),
data=",".join(_package_ids),
last_checked=self.timestamp,
last_updated=_last_updated,
)
Expand Down

0 comments on commit a3e8d4d

Please sign in to comment.