Initial scaffold: Flask webui + APScheduler + Playwright automation for MassPrice rule scheduling
Some checks failed
Deploy / deploy (push) Failing after 51s
Some checks failed
Deploy / deploy (push) Failing after 51s
Drives massprice.tcgplayer.com's Run Rule action per-rule on a user-configured schedule (multiple times/day, day-of-week toggles), replacing MassPrice's native scheduler (capped at 15 schedules account-wide, one run/day, with observed clock drift). Deployed via Forgejo push-to-deploy on Unraid, matching arr-summary/card-grader. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01H6TgffxTvYhqxykAbVQg2v
This commit is contained in:
commit
2fdb9be9b9
19 changed files with 1197 additions and 0 deletions
35
storage.py
Normal file
35
storage.py
Normal file
|
|
@ -0,0 +1,35 @@
|
|||
"""Small JSON read/write helpers for the state files under DATA_DIR.
|
||||
|
||||
Every file is written via a temp-file + os.replace so a crash mid-write
|
||||
never leaves a half-written JSON file behind for the next read.
|
||||
"""
|
||||
import json
|
||||
import os
|
||||
import threading
|
||||
|
||||
DATA_DIR = os.environ.get("DATA_DIR", "/data")
|
||||
|
||||
_lock = threading.Lock()
|
||||
|
||||
|
||||
def _path(name):
|
||||
return os.path.join(DATA_DIR, name)
|
||||
|
||||
|
||||
def load(name, default):
|
||||
path = _path(name)
|
||||
with _lock:
|
||||
if not os.path.exists(path):
|
||||
return default
|
||||
with open(path) as f:
|
||||
return json.load(f)
|
||||
|
||||
|
||||
def save(name, data):
|
||||
path = _path(name)
|
||||
with _lock:
|
||||
os.makedirs(DATA_DIR, exist_ok=True)
|
||||
tmp = path + ".tmp"
|
||||
with open(tmp, "w") as f:
|
||||
json.dump(data, f, indent=2)
|
||||
os.replace(tmp, path)
|
||||
Loading…
Add table
Add a link
Reference in a new issue