Fix for windows
This commit is contained in:
parent
967397b5d5
commit
16cde75220
@ -32,7 +32,15 @@ from datetime import datetime, timedelta, timezone
|
|||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
|
|
||||||
HERE = Path(__file__).parent
|
HERE = Path(__file__).parent
|
||||||
|
PROJECT_ROOT = (HERE / ".." / "..").resolve()
|
||||||
POOL_DIR = HERE / "scenarios" / "pool"
|
POOL_DIR = HERE / "scenarios" / "pool"
|
||||||
|
|
||||||
|
if sys.platform == "win32":
|
||||||
|
ADB = str(PROJECT_ROOT / "tools" / "adb" / "windows" / "adb.exe")
|
||||||
|
elif sys.platform == "darwin":
|
||||||
|
ADB = str(PROJECT_ROOT / "tools" / "adb" / "macos" / "adb")
|
||||||
|
else:
|
||||||
|
ADB = "adb"
|
||||||
BOUNDS_RE = re.compile(r"\[(\d+),(\d+)\]\[(\d+),(\d+)\]")
|
BOUNDS_RE = re.compile(r"\[(\d+),(\d+)\]\[(\d+),(\d+)\]")
|
||||||
|
|
||||||
# ---------------------------------------------------------------- config/db
|
# ---------------------------------------------------------------- config/db
|
||||||
@ -88,7 +96,7 @@ def query_active_materials(db_path: Path):
|
|||||||
# ---------------------------------------------------------------- ADB helpers
|
# ---------------------------------------------------------------- ADB helpers
|
||||||
|
|
||||||
def adb(serial, *args):
|
def adb(serial, *args):
|
||||||
cmd = ["adb"]
|
cmd = [ADB]
|
||||||
if serial:
|
if serial:
|
||||||
cmd += ["-s", serial]
|
cmd += ["-s", serial]
|
||||||
cmd += list(args)
|
cmd += list(args)
|
||||||
@ -135,7 +143,7 @@ def get_device_tz(serial) -> timezone:
|
|||||||
|
|
||||||
|
|
||||||
def get_adb_serials():
|
def get_adb_serials():
|
||||||
r = subprocess.run(["adb", "devices"], check=True, capture_output=True)
|
r = subprocess.run([ADB, "devices"], check=True, capture_output=True)
|
||||||
serials = []
|
serials = []
|
||||||
for line in r.stdout.decode().splitlines()[1:]:
|
for line in r.stdout.decode().splitlines()[1:]:
|
||||||
parts = line.split()
|
parts = line.split()
|
||||||
@ -157,7 +165,7 @@ def back(serial):
|
|||||||
def parse_ozon_rows(xml):
|
def parse_ozon_rows(xml):
|
||||||
rows = []
|
rows = []
|
||||||
for m in re.finditer(
|
for m in re.finditer(
|
||||||
r'<node\s[^>]*?text="([^"]*(?:Пополнени|Переводы)[^"]*)"'
|
r'<node\s[^>]*?text="([^"]*)"'
|
||||||
r'[^>]*?bounds="(\[\d+,\d+\]\[\d+,\d+\])"', xml):
|
r'[^>]*?bounds="(\[\d+,\d+\]\[\d+,\d+\])"', xml):
|
||||||
text, bounds = m.group(1), m.group(2)
|
text, bounds = m.group(1), m.group(2)
|
||||||
bm = BOUNDS_RE.match(bounds)
|
bm = BOUNDS_RE.match(bounds)
|
||||||
@ -177,7 +185,7 @@ def parse_ozon_rows(xml):
|
|||||||
|
|
||||||
|
|
||||||
def is_ozon_list(xml):
|
def is_ozon_list(xml):
|
||||||
return "Операции" in xml and ("Пополнени" in xml or "Переводы" in xml)
|
return "Операции" in xml
|
||||||
|
|
||||||
|
|
||||||
def extract_ozon_detail_time(xml):
|
def extract_ozon_detail_time(xml):
|
||||||
|
|||||||
@ -13,4 +13,19 @@ foreach ($_c in $_configCandidates) {
|
|||||||
if (-not $_configPath) { Write-Host "ERROR: config.ini not found" -ForegroundColor Red; exit 1 }
|
if (-not $_configPath) { Write-Host "ERROR: config.ini not found" -ForegroundColor Red; exit 1 }
|
||||||
$_configArg = @("--config", $_configPath)
|
$_configArg = @("--config", $_configPath)
|
||||||
Write-Host "Config: $_configPath" -ForegroundColor Gray
|
Write-Host "Config: $_configPath" -ForegroundColor Gray
|
||||||
& "C:\Users\User\AppData\Local\Programs\Python\Python312-arm64\python.exe" "$PSScriptRoot\gen_fetch_transactions.py" @_configArg @args
|
$_pythonExe = $null
|
||||||
|
foreach ($_cmd in (Get-Command python, python3, py -ErrorAction SilentlyContinue)) {
|
||||||
|
if ($_cmd.Source -notlike "*WindowsApps*") { $_pythonExe = $_cmd.Source; break }
|
||||||
|
}
|
||||||
|
if (-not $_pythonExe) {
|
||||||
|
$_pythonExe = (Get-ChildItem "$env:LOCALAPPDATA\Programs\Python\*\python.exe",
|
||||||
|
"C:\Users\*\AppData\Local\Programs\Python\*\python.exe",
|
||||||
|
"C:\Program Files\Python*\python.exe",
|
||||||
|
"C:\Python*\python.exe" -ErrorAction SilentlyContinue |
|
||||||
|
Select-Object -First 1).FullName
|
||||||
|
}
|
||||||
|
if (-not $_pythonExe) {
|
||||||
|
Write-Host "ERROR: python not found. Install Python or add it to PATH." -ForegroundColor Red; exit 1
|
||||||
|
}
|
||||||
|
Write-Host "Python: $_pythonExe" -ForegroundColor Gray
|
||||||
|
& $_pythonExe "$PSScriptRoot\gen_fetch_transactions.py" @_configArg @args
|
||||||
@ -1,10 +0,0 @@
|
|||||||
{
|
|
||||||
"bank_name": "dushanbe_city_bank",
|
|
||||||
"material_id": "61d967d1-8d3e-4d05-ba01-8c8ab327b945",
|
|
||||||
"type": "FETCH_TRANSACTIONS",
|
|
||||||
"body": {
|
|
||||||
"amount": -100,
|
|
||||||
"created_at": "2026-04-10T09:39:15Z"
|
|
||||||
},
|
|
||||||
"_tag": "pixel7_dushanbe_01_embedded_minus_1"
|
|
||||||
}
|
|
||||||
@ -1,10 +0,0 @@
|
|||||||
{
|
|
||||||
"bank_name": "dushanbe_city_bank",
|
|
||||||
"material_id": "61d967d1-8d3e-4d05-ba01-8c8ab327b945",
|
|
||||||
"type": "FETCH_TRANSACTIONS",
|
|
||||||
"body": {
|
|
||||||
"amount": -100,
|
|
||||||
"created_at": "2026-04-05T14:31:21Z"
|
|
||||||
},
|
|
||||||
"_tag": "pixel7_dushanbe_02_minus_1_2131"
|
|
||||||
}
|
|
||||||
@ -1,10 +0,0 @@
|
|||||||
{
|
|
||||||
"bank_name": "dushanbe_city_bank",
|
|
||||||
"material_id": "61d967d1-8d3e-4d05-ba01-8c8ab327b945",
|
|
||||||
"type": "FETCH_TRANSACTIONS",
|
|
||||||
"body": {
|
|
||||||
"amount": -100,
|
|
||||||
"created_at": "2026-04-05T14:25:48Z"
|
|
||||||
},
|
|
||||||
"_tag": "pixel7_dushanbe_03_minus_1_2125"
|
|
||||||
}
|
|
||||||
@ -1,10 +0,0 @@
|
|||||||
{
|
|
||||||
"bank_name": "dushanbe_city_bank",
|
|
||||||
"material_id": "61d967d1-8d3e-4d05-ba01-8c8ab327b945",
|
|
||||||
"type": "FETCH_TRANSACTIONS",
|
|
||||||
"body": {
|
|
||||||
"amount": -100,
|
|
||||||
"created_at": "2026-04-05T11:36:06Z"
|
|
||||||
},
|
|
||||||
"_tag": "pixel7_dushanbe_04_minus_1_1836"
|
|
||||||
}
|
|
||||||
@ -1,10 +0,0 @@
|
|||||||
{
|
|
||||||
"bank_name": "dushanbe_city_bank",
|
|
||||||
"material_id": "61d967d1-8d3e-4d05-ba01-8c8ab327b945",
|
|
||||||
"type": "FETCH_TRANSACTIONS",
|
|
||||||
"body": {
|
|
||||||
"amount": -100,
|
|
||||||
"created_at": "2026-04-05T11:19:43Z"
|
|
||||||
},
|
|
||||||
"_tag": "pixel7_dushanbe_05_minus_1_1819"
|
|
||||||
}
|
|
||||||
@ -1,10 +0,0 @@
|
|||||||
{
|
|
||||||
"bank_name": "dushanbe_city_bank",
|
|
||||||
"material_id": "61d967d1-8d3e-4d05-ba01-8c8ab327b945",
|
|
||||||
"type": "FETCH_TRANSACTIONS",
|
|
||||||
"body": {
|
|
||||||
"amount": 100,
|
|
||||||
"created_at": "2026-04-03T13:52:06Z"
|
|
||||||
},
|
|
||||||
"_tag": "pixel7_dushanbe_06_plus_1_2052"
|
|
||||||
}
|
|
||||||
@ -1,10 +0,0 @@
|
|||||||
{
|
|
||||||
"bank_name": "ozon",
|
|
||||||
"material_id": "30bc106c-6935-4f4b-85f3-f1a06adc5c13",
|
|
||||||
"type": "FETCH_TRANSACTIONS",
|
|
||||||
"body": {
|
|
||||||
"amount": 10000,
|
|
||||||
"created_at": "2026-04-11T10:39:00Z"
|
|
||||||
},
|
|
||||||
"_tag": "pixel7_ozon_01_evgeny_plus_100"
|
|
||||||
}
|
|
||||||
@ -1,10 +0,0 @@
|
|||||||
{
|
|
||||||
"bank_name": "ozon",
|
|
||||||
"material_id": "30bc106c-6935-4f4b-85f3-f1a06adc5c13",
|
|
||||||
"type": "FETCH_TRANSACTIONS",
|
|
||||||
"body": {
|
|
||||||
"amount": -10000,
|
|
||||||
"created_at": "2026-04-10T09:40:00Z"
|
|
||||||
},
|
|
||||||
"_tag": "pixel7_ozon_02_vlad_minus_100"
|
|
||||||
}
|
|
||||||
@ -1,10 +0,0 @@
|
|||||||
{
|
|
||||||
"bank_name": "ozon",
|
|
||||||
"material_id": "30bc106c-6935-4f4b-85f3-f1a06adc5c13",
|
|
||||||
"type": "FETCH_TRANSACTIONS",
|
|
||||||
"body": {
|
|
||||||
"amount": -30000,
|
|
||||||
"created_at": "2026-04-08T08:34:00Z"
|
|
||||||
},
|
|
||||||
"_tag": "pixel7_ozon_03_vlad_minus_300"
|
|
||||||
}
|
|
||||||
@ -1,10 +0,0 @@
|
|||||||
{
|
|
||||||
"bank_name": "ozon",
|
|
||||||
"material_id": "30bc106c-6935-4f4b-85f3-f1a06adc5c13",
|
|
||||||
"type": "FETCH_TRANSACTIONS",
|
|
||||||
"body": {
|
|
||||||
"amount": 10000,
|
|
||||||
"created_at": "2026-04-08T08:14:00Z"
|
|
||||||
},
|
|
||||||
"_tag": "pixel7_ozon_04_vlad_plus_100"
|
|
||||||
}
|
|
||||||
@ -1,10 +0,0 @@
|
|||||||
{
|
|
||||||
"bank_name": "ozon",
|
|
||||||
"material_id": "30bc106c-6935-4f4b-85f3-f1a06adc5c13",
|
|
||||||
"type": "FETCH_TRANSACTIONS",
|
|
||||||
"body": {
|
|
||||||
"amount": 10000,
|
|
||||||
"created_at": "2026-04-08T08:02:00Z"
|
|
||||||
},
|
|
||||||
"_tag": "pixel7_ozon_05_vlad_plus_100_b"
|
|
||||||
}
|
|
||||||
@ -1,10 +0,0 @@
|
|||||||
{
|
|
||||||
"bank_name": "ozon",
|
|
||||||
"material_id": "30bc106c-6935-4f4b-85f3-f1a06adc5c13",
|
|
||||||
"type": "FETCH_TRANSACTIONS",
|
|
||||||
"body": {
|
|
||||||
"amount": 10000,
|
|
||||||
"created_at": "2026-04-06T13:54:00Z"
|
|
||||||
},
|
|
||||||
"_tag": "pixel7_ozon_06_evgeny_plus_100_b"
|
|
||||||
}
|
|
||||||
@ -1,10 +0,0 @@
|
|||||||
{
|
|
||||||
"bank_name": "ozon",
|
|
||||||
"material_id": "49001bb5-3b24-478d-b913-c2242aea0732",
|
|
||||||
"type": "FETCH_TRANSACTIONS",
|
|
||||||
"body": {
|
|
||||||
"amount": 10000,
|
|
||||||
"created_at": "2026-04-10T09:40:00Z"
|
|
||||||
},
|
|
||||||
"_tag": "tecno_ozon_01_galina_plus_100"
|
|
||||||
}
|
|
||||||
@ -1,10 +0,0 @@
|
|||||||
{
|
|
||||||
"bank_name": "ozon",
|
|
||||||
"material_id": "49001bb5-3b24-478d-b913-c2242aea0732",
|
|
||||||
"type": "FETCH_TRANSACTIONS",
|
|
||||||
"body": {
|
|
||||||
"amount": 30000,
|
|
||||||
"created_at": "2026-04-08T08:34:00Z"
|
|
||||||
},
|
|
||||||
"_tag": "tecno_ozon_02_galina_plus_300"
|
|
||||||
}
|
|
||||||
@ -1,10 +0,0 @@
|
|||||||
{
|
|
||||||
"bank_name": "ozon",
|
|
||||||
"material_id": "49001bb5-3b24-478d-b913-c2242aea0732",
|
|
||||||
"type": "FETCH_TRANSACTIONS",
|
|
||||||
"body": {
|
|
||||||
"amount": -10000,
|
|
||||||
"created_at": "2026-04-08T08:32:00Z"
|
|
||||||
},
|
|
||||||
"_tag": "tecno_ozon_03_vlad_minus_100_a"
|
|
||||||
}
|
|
||||||
@ -1,10 +0,0 @@
|
|||||||
{
|
|
||||||
"bank_name": "ozon",
|
|
||||||
"material_id": "49001bb5-3b24-478d-b913-c2242aea0732",
|
|
||||||
"type": "FETCH_TRANSACTIONS",
|
|
||||||
"body": {
|
|
||||||
"amount": -10000,
|
|
||||||
"created_at": "2026-04-08T08:23:00Z"
|
|
||||||
},
|
|
||||||
"_tag": "tecno_ozon_04_vlad_minus_100_b"
|
|
||||||
}
|
|
||||||
@ -1,10 +0,0 @@
|
|||||||
{
|
|
||||||
"bank_name": "ozon",
|
|
||||||
"material_id": "49001bb5-3b24-478d-b913-c2242aea0732",
|
|
||||||
"type": "FETCH_TRANSACTIONS",
|
|
||||||
"body": {
|
|
||||||
"amount": -10000,
|
|
||||||
"created_at": "2026-04-08T08:14:00Z"
|
|
||||||
},
|
|
||||||
"_tag": "tecno_ozon_05_galina_minus_100_a"
|
|
||||||
}
|
|
||||||
@ -1,10 +0,0 @@
|
|||||||
{
|
|
||||||
"bank_name": "ozon",
|
|
||||||
"material_id": "49001bb5-3b24-478d-b913-c2242aea0732",
|
|
||||||
"type": "FETCH_TRANSACTIONS",
|
|
||||||
"body": {
|
|
||||||
"amount": -10000,
|
|
||||||
"created_at": "2026-04-08T08:02:00Z"
|
|
||||||
},
|
|
||||||
"_tag": "tecno_ozon_06_galina_minus_100_b"
|
|
||||||
}
|
|
||||||
@ -1,10 +0,0 @@
|
|||||||
{
|
|
||||||
"bank_name": "ozon",
|
|
||||||
"material_id": "49001bb5-3b24-478d-b913-c2242aea0732",
|
|
||||||
"type": "FETCH_TRANSACTIONS",
|
|
||||||
"body": {
|
|
||||||
"amount": 55000,
|
|
||||||
"created_at": "2026-03-20T14:36:00Z"
|
|
||||||
},
|
|
||||||
"_tag": "tecno_ozon_07_vlad_plus_550"
|
|
||||||
}
|
|
||||||
Loading…
Reference in New Issue
Block a user