Skip to content

armgit / peach

Public Imported from GitHub
0

Peach: Local-first video metadata scraper and media manager.

refactor: separate runtime data and switch FastAPI production

Peach local maintenancec3753ae719aa
diff --git a/.gitignore b/.gitignore
index 41060b35a..9f1ab1c74 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,4 +1,4 @@
-.venv/
+.venv*/
__pycache__/
*.py[cod]
.pytest_cache/
@@ -10,6 +10,7 @@ dist/
.env
.env.*
!.env.example
+.claude/settings.local.json
*.log
*.bak
diff --git a/AGENTS.md b/AGENTS.md
index c89661bf6..15b3b8cad 100644
--- a/AGENTS.md
+++ b/AGENTS.md
@@ -12,8 +12,8 @@ Before changing the project, read these files in order:
Working rules:
-- `R:\peach-app` is code and documentation. `R:\Resources`, `R:\Media`, `A:\` and `B:\` are runtime data or mounted media and must never be copied into Git.
-- `R:\Resources\Intake\ledger.db` is the truth store. Tests use temporary databases only. A real migration requires a SQLite backup and before/after count checks.
+- `R:\peach-app` is code and documentation. `R:\peach-data`, `R:\media`, `A:\` and `B:\` are runtime data or mounted media and must never be copied into Git.
+- `R:\peach-data\database\ledger.db` is the truth store. Tests use temporary databases only. A real migration requires a SQLite backup and before/after count checks.
- The project is an early personal project: aggressively remove obsolete code and compatibility layers when the replacement is tested. Do not preserve dead interfaces merely for history; Git is the archive.
- Preserve real media, ledger rows, behavior history, credentials, network/firewall state, and unrelated long-running jobs.
- Inspect `git status` and the active listeners/processes before work. Never claim candidate code is production until the service has actually been switched and checked.
diff --git a/README.md b/README.md
index 391dd2551..419c19e55 100644
--- a/README.md
+++ b/README.md
@@ -5,14 +5,16 @@ Peach(蜜桃)是一个单用户、本地优先的个人媒体系统:统一
## 边界
- 项目代码:`R:\peach-app`
-- 真实数据:`R:\Resources`
-- 本地媒体:`R:\Media`
+- 真实数据:`R:\peach-data`
+- 本地媒体:`R:\media`
- 网盘挂载:`A:\`、`B:\`
-- 真相数据库:`R:\Resources\Intake\ledger.db`
+- 真相数据库:`R:\peach-data\database\ledger.db`
- Stash:过渡期可替换 adapter,不是真相源
项目仓库不保存媒体、数据库、凭据、快照、封面或运行日志。
+`R:\peach-data` 使用固定分层:`database` 保存真相库,`generated` 保存可再生成的视觉资产,`sources` 保存原始分析输入,`state` 保存人工维护状态,`secrets` 保存本机凭据材料,`logs` 保存运行记录,`archive` 保存历史备份,`inbox` 是临时下载落地区。
+
## 结构
```text
@@ -31,7 +33,7 @@ peach-app/
```powershell
cd R:\peach-app
-& "$env:LOCALAPPDATA\Programs\Python\Python312\python.exe" -m venv .venv
+& py -3.14 -m venv .venv
& .\.venv\Scripts\python.exe -m pip install -e .
& .\.venv\Scripts\python.exe -m unittest discover -s tests -p 'test_*.py' -v
& .\.venv\Scripts\peach.exe migrate status
diff --git a/docs/ARCHITECTURE.md b/docs/ARCHITECTURE.md
index fc743c4a3..4fe344920 100644
--- a/docs/ARCHITECTURE.md
+++ b/docs/ARCHITECTURE.md
@@ -30,3 +30,16 @@ AI/external metadata -> reviewed candidates -> ledger
- 将 Stash 私有目录或 GPL 构建作为 Peach 的稳定打包依赖
关键取舍见 `docs/adr/`;Stash 的代码级证据见 `docs/STASH.md`。
+
+## Runtime data layout
+
+`R:\peach-data` is intentionally separate from the repository:
+
+- `database/`: SQLite truth store
+- `generated/`: snapshots, posters, avatars and logos
+- `sources/`: immutable/raw browser, follow, inventory and export inputs
+- `state/`: curated local state and locks
+- `secrets/`: local-only secret material
+- `logs/`: current operational logs
+- `archive/`: historical migration evidence and backups
+- `inbox/`: transient imports awaiting processing
diff --git a/docs/HANDOFF.md b/docs/HANDOFF.md
index e20682d18..9186b877d 100644
--- a/docs/HANDOFF.md
+++ b/docs/HANDOFF.md
@@ -12,15 +12,15 @@ This is durable operating knowledge, not a per-session transcript.
## Data safety
-- Real ledger: `R:\Resources\Intake\ledger.db`; WAL mode; normal browsing legitimately changes play/activity fields.
+- Real ledger: `R:\peach-data\database\ledger.db`; WAL mode; normal browsing legitimately changes play/activity fields.
- Tests must create temporary SQLite databases and temporary media files.
- Before real migration: SQLite backup, asset/tag counts, `PRAGMA integrity_check`, migration version check, then service smoke test.
-- Media and generated resources remain under `R:\Media` and `R:\Resources`; they are not repository assets.
+- Media and runtime data remain under `R:\media` and `R:\peach-data`; they are not repository assets.
## Operations
- Main command: `peach serve|migrate` after editable installation.
-- Long-running inventory helpers are under `scripts/`; their scheduled tasks already use `R:\peach-app` for the next start. They use absolute data paths and may be interrupted/restarted where their own locking contract allows it.
+- Long-running inventory helpers are under `scripts/`; their scheduled tasks use `R:\peach-app\.venv\Scripts\python.exe`. They use absolute data paths and may be interrupted/restarted where their own locking contract allows it.
- Check ports 80, 8900 and 9999 before starting or switching services.
- Report verification separately: static/unit/API, desktop browser, 390×844 browser, and whether production was actually restarted.
@@ -34,4 +34,4 @@ This is durable operating knowledge, not a per-session transcript.
## Recovery
-Deprecated scripts and old dated documents were removed from the active tree during the `peach-app` restructure. They remain recoverable from Git history before the restructure commit. Local `_SHARED_STATE` data remains in `R:\Resources\Intake\_SHARED_STATE`; it was deliberately removed only from version control.
+Deprecated scripts and old dated documents were removed from the active tree during the `peach-app` restructure. They remain recoverable from Git history before the restructure commit. Former `_SHARED_STATE` content lives under `R:\peach-data\state`; it is deliberately outside version control. The pre-restructure root repository metadata is retained temporarily under `R:\peach-data\archive\peach-root-repo-backup-20260814` as a recovery copy.
diff --git a/docs/STATUS.md b/docs/STATUS.md
index c4a745849..439e27c4b 100644
--- a/docs/STATUS.md
+++ b/docs/STATUS.md
@@ -4,10 +4,10 @@ Last verified: 2026-08-14
## Runtime
-- Production Peach: legacy server on `0.0.0.0:80`, PID observed as 37392. It has not been switched to the new project yet.
+- Production Peach: FastAPI `0.2.0` from `R:\peach-app` on `0.0.0.0:80`, PID observed as 54576; health mode is `fastapi`.
- Stash: `127.0.0.1:9999`, PID observed as 35332.
-- Traffic monitor: the current instance still runs from the old tools directory; its scheduled task now points to `R:\peach-app` for the next start.
-- FastAPI candidate: implemented and verified on temporary `127.0.0.1:8900`, then stopped.
+- Traffic monitor: running through `RM-TrafficWatch` from `R:\peach-app\.venv`; all probe/sheets tasks use the same project environment.
+- Runtime Python: 3.14.7. The removed system Python 3.12 invalidated the old venv, which was rebuilt and reverified before production start.
- Real ledger migrations: not applied. `schema_migration` is absent in the real database.
Runtime PIDs are observations, not configuration; always re-check them.
@@ -17,13 +17,14 @@ Runtime PIDs are observations, not configuration; always re-check them.
- FastAPI serves home, legacy-compatible JSON, standard Range/HEAD media, thumbnails, posters, avatars and logos.
- Default ledger connections in the compatibility query layer are read-only; activity/play/feedback writes are explicit.
- FFmpeg resolution is centralized: environment, Peach-managed binary, PATH, then temporary Stash fallback.
-- 23 isolated tests passed again after the repository restructure.
+- `R:\peach-data` now separates `database/generated/sources/state/secrets/logs/archive/inbox`; the old empty root Inbox and old Resources/Tools compatibility surface are removed.
+- 23 isolated tests passed under Python 3.14 after the repository and data restructure.
- Desktop 1280×720 and mobile 390×844 browser checks passed on the candidate service.
-- The restructured candidate passed health, home, real read-only list and one-byte Range smoke checks on temporary port 8900; it was then stopped.
+- Production port 80 passed health, home, 2,552-item real read-only list and one-byte `206 Partial Content` Range smoke checks after the switch.
## Next work
-1. Perform a controlled production switch from the old server on port 80 to `peach serve --host 0.0.0.0 --port 80`, with immediate rollback available.
-2. Apply formal migrations to the real ledger only in that maintenance window, with SQLite backup and count/integrity verification.
-3. Restart the traffic monitor at a safe accounting boundary so its running instance also uses the new path.
-4. Remove the final old Web/traffic-monitor compatibility files after no process depends on them.
+1. Apply formal migrations to the real ledger in a maintenance window, with SQLite backup and count/integrity verification.
+2. Move FFmpeg/ffprobe to a Peach-managed installation and remove the temporary Stash binary fallback.
+3. Extract the remaining query/write functions from `compat_web.py`, then delete that compatibility module.
+4. Implement the first real online-source and AI provider adapters behind the existing boundaries.
diff --git a/pyproject.toml b/pyproject.toml
index 8dde77c29..a5edcdd02 100644
--- a/pyproject.toml
+++ b/pyproject.toml
@@ -10,8 +10,8 @@ requires-python = ">=3.12"
dependencies = [
"fastapi==0.116.1",
"httpx==0.28.1",
- "pydantic==2.11.7",
- "starlette==0.47.2",
+ "pydantic==2.13.4",
+ "starlette==0.47.3",
"uvicorn==0.35.0",
]
diff --git a/scripts/audit_ledger.py b/scripts/audit_ledger.py
index c2e19260b..2b4c91119 100644
--- a/scripts/audit_ledger.py
+++ b/scripts/audit_ledger.py
@@ -5,7 +5,7 @@ import sqlite3
from pathlib import Path
-DB = Path(r"R:\Resources\Intake\ledger.db")
+DB = Path(r"R:\peach-data\database\ledger.db")
def main():
diff --git a/scripts/ledger.py b/scripts/ledger.py
index df7b3e438..6b71539d8 100644
--- a/scripts/ledger.py
+++ b/scripts/ledger.py
@@ -6,7 +6,7 @@ r"""
python rm-ledger.py init 建库
python rm-ledger.py scan 115 B:\ 扫一个挂载点(只读元数据)
python rm-ledger.py scan pikpak A:\
- python rm-ledger.py scan local R:\Media\创作者
+ python scripts/ledger.py scan local R:\media\创作者
python rm-ledger.py stash 从 Stash 拉场景/标签/Studio/Performer
python rm-ledger.py follow 导入 X / Pixiv 关注列表(在线资产)
python rm-ledger.py stats 统计
@@ -17,7 +17,7 @@ r"""
"""
import os, sys, csv, json, sqlite3, time, urllib.request, urllib.error
-DB = os.path.expandvars(r"R:\Resources\Intake\ledger.db")
+DB = os.path.expandvars(r"R:\peach-data\database\ledger.db")
STASH = "http://127.0.0.1:9999/graphql"
VIDEO = {".mp4", ".m4v", ".mkv", ".avi", ".wmv", ".mov", ".ts", ".flv", ".rmvb", ".mpg", ".m2ts"}
diff --git a/scripts/probe.py b/scripts/probe.py
index ba1b34d65..88dfa3ab4 100644
--- a/scripts/probe.py
+++ b/scripts/probe.py
@@ -15,9 +15,9 @@
"""
import os, sys, time, json, sqlite3, subprocess, threading, queue
-DB = r"R:\Resources\Intake\ledger.db"
+DB = r"R:\peach-data\database\ledger.db"
FFPROBE = r"C:\Users\longm\AppData\Local\Stash\ffmpeg-btbn\ffmpeg-master-latest-win64-gpl-shared\bin\ffprobe.exe"
-LOG = r"R:\Resources\Migration_Logs\probe-{}.log".format(time.strftime("%Y%m%d-%H%M%S"))
+LOG = r"R:\peach-data\logs\probe-{}.log".format(time.strftime("%Y%m%d-%H%M%S"))
a = sys.argv[1:]
def opt(name, default, cast=str):
@@ -29,7 +29,7 @@ LIMIT = opt("--limit", 0, int)
# ---------- 单实例保护 ----------
# 多个实例同时跑会互抢 SQLite 写锁,全部卡死(实测踩过:三个实例并存时 ffprobe 数归零)
-LOCKFILE = r"R:\Resources\Intake\.probe.lock"
+LOCKFILE = r"R:\peach-data\state\.probe.lock"
try:
_lock = open(LOCKFILE, "x")
_lock.write(str(os.getpid()))
diff --git a/scripts/sheets.py b/scripts/sheets.py
index 64736d442..4bc5f499b 100644
--- a/scripts/sheets.py
+++ b/scripts/sheets.py
@@ -16,11 +16,11 @@
"""
import os, sys, time, hashlib, sqlite3, subprocess, threading, queue, tempfile, shutil
-DB = r"R:\Resources\Intake\ledger.db"
+DB = r"R:\peach-data\database\ledger.db"
BIN = r"C:\Users\longm\AppData\Local\Stash\ffmpeg-btbn\ffmpeg-master-latest-win64-gpl-shared\bin"
FFMPEG, FFPROBE = os.path.join(BIN, "ffmpeg.exe"), os.path.join(BIN, "ffprobe.exe")
-OUTROOT = r"R:\Resources\Intake\snapshots\cloud"
-LOG = r"R:\Resources\Migration_Logs\sheets-{}.log".format(time.strftime("%Y%m%d-%H%M%S"))
+OUTROOT = r"R:\peach-data\generated\snapshots\cloud"
+LOG = r"R:\peach-data\logs\sheets-{}.log".format(time.strftime("%Y%m%d-%H%M%S"))
a = sys.argv[1:]
def opt(n, d, cast=str): return cast(a[a.index(n) + 1]) if n in a else d
diff --git a/scripts/status.py b/scripts/status.py
index 4fa84d005..80d5dc17f 100644
--- a/scripts/status.py
+++ b/scripts/status.py
@@ -3,7 +3,7 @@
"""一屏看完项目状态。无副作用,随时可跑。"""
import os, sqlite3, glob, time, subprocess
-DB = r"R:\Resources\Intake\ledger.db"
+DB = r"R:\peach-data\database\ledger.db"
c = sqlite3.connect(f"file:{DB}?mode=ro", uri=True)
q1 = lambda s: c.execute(s).fetchone()[0]
qa = lambda s: c.execute(s).fetchall()
@@ -58,7 +58,7 @@ except Exception:
for pat, nm in (("probe-*.log", "ffprobe"), ("sheets-*.log", "接触表"),
("sha1-*.log", "SHA1"), ("cloud-delete-*.log", "删除")):
- fs = sorted(glob.glob(rf"R:\Resources\Migration_Logs\{pat}"), key=os.path.getmtime)
+ fs = sorted(glob.glob(rf"R:\peach-data\logs\{pat}"), key=os.path.getmtime)
if not fs:
continue
f = fs[-1]
diff --git a/scripts/suggest.py b/scripts/suggest.py
index 065b17e3b..a5e0f7682 100644
--- a/scripts/suggest.py
+++ b/scripts/suggest.py
@@ -19,7 +19,7 @@ import os, sys, json, random, sqlite3
from collections import Counter, defaultdict
from pathlib import Path
-DB = r"R:\Resources\Intake\ledger.db"
+DB = r"R:\peach-data\database\ledger.db"
MOODS = str(Path(__file__).with_name("moods.json"))
N_OUT = 6
diff --git a/scripts/sync_sha1_115.py b/scripts/sync_sha1_115.py
index 07858bbe7..832fa5902 100644
--- a/scripts/sync_sha1_115.py
+++ b/scripts/sync_sha1_115.py
@@ -19,16 +19,16 @@
import os, sys, json, sqlite3, time
from collections import defaultdict
-DB = r"R:\Resources\Intake\ledger.db"
+DB = r"R:\peach-data\database\ledger.db"
COOKIE = os.path.expandvars(r"%USERPROFILE%\.115-cookies.txt")
-LOG = r"R:\Resources\Migration_Logs\sha1-{}.log".format(time.strftime("%Y%m%d-%H%M%S"))
+LOG = r"R:\peach-data\logs\sha1-{}.log".format(time.strftime("%Y%m%d-%H%M%S"))
try:
from p115client import P115Client
from p115client.tool.iterdir import iter_files
except ImportError:
print("缺少依赖,先执行:")
- print(r' "%LOCALAPPDATA%\Programs\Python\Python312\python.exe" -m pip install -U p115client')
+ print(r' .\.venv\Scripts\python.exe -m pip install -U p115client')
sys.exit(1)
logf = open(LOG, "w", encoding="utf-8", buffering=1)
diff --git a/scripts/traffic_watch.py b/scripts/traffic_watch.py
index c5b7c1cdf..1792ac786 100644
--- a/scripts/traffic_watch.py
+++ b/scripts/traffic_watch.py
@@ -27,8 +27,8 @@ import os, re, sys, json, time, subprocess
PIPE = r"\\.\pipe\verge-mihomo"
SECRET = "set-your-secret"
-LOG = r"R:\Resources\Migration_Logs\trafficwatch-{}.log".format(time.strftime("%Y%m%d-%H%M%S"))
-ALERT = r"R:\Resources\Migration_Logs\流量警报.txt"
+LOG = r"R:\peach-data\logs\trafficwatch-{}.log".format(time.strftime("%Y%m%d-%H%M%S"))
+ALERT = r"R:\peach-data\logs\流量警报.txt"
A = sys.argv[1:]
def _o(n, d, c=str): return c(A[A.index(n) + 1]) if n in A else d
diff --git a/scripts/validate_migration.py b/scripts/validate_migration.py
index b8850b6ba..6316c5b87 100644
--- a/scripts/validate_migration.py
+++ b/scripts/validate_migration.py
@@ -11,7 +11,7 @@ sys.path.insert(0, str(PROJECT_ROOT / "src"))
from peach.migrations import sqlite_backup, upgrade
-SOURCE = Path(r"R:\Resources\Intake\ledger.db")
+SOURCE = Path(r"R:\peach-data\database\ledger.db")
MIGRATIONS = PROJECT_ROOT / "migrations"
diff --git a/src/peach/api.py b/src/peach/api.py
index d4e4e77ce..093e0834c 100644
--- a/src/peach/api.py
+++ b/src/peach/api.py
@@ -42,7 +42,7 @@ def create_app(settings: PeachSettings | None = None) -> FastAPI:
)
app = FastAPI(
title="Peach API",
- version="0.1.0",
+ version="0.2.0",
docs_url="/docs" if settings.docs_enabled else None,
redoc_url=None,
openapi_url="/openapi.json" if settings.docs_enabled else None,
@@ -66,7 +66,7 @@ def create_app(settings: PeachSettings | None = None) -> FastAPI:
def healthz() -> dict[str, Any]:
# 不探测/迁移数据库;健康检查必须无副作用。
ffmpeg = resolver.ffmpeg()
- return {"ok": True, "service": "peach-api", "mode": "candidate",
+ return {"ok": True, "service": "peach-api", "mode": "fastapi",
"db": "available" if settings.db_path.is_file() else "missing",
"ffmpeg": ffmpeg.source if ffmpeg else "unavailable"}
diff --git a/src/peach/cli.py b/src/peach/cli.py
index 0ebd46ab0..16647d797 100644
--- a/src/peach/cli.py
+++ b/src/peach/cli.py
@@ -5,11 +5,11 @@ from datetime import datetime
from pathlib import Path
from .api import create_app
-from .config import DATA_ROOT, MIGRATIONS_DIR, PeachSettings
+from .config import DATABASE_PATH, MIGRATIONS_DIR, PeachSettings
from .migrations import plan, upgrade
-DEFAULT_DB = DATA_ROOT / "Intake" / "ledger.db"
+DEFAULT_DB = DATABASE_PATH
def _serve(args: argparse.Namespace) -> int:
diff --git a/src/peach/compat_web.py b/src/peach/compat_web.py
index dc6acda0b..0402bb122 100644
--- a/src/peach/compat_web.py
+++ b/src/peach/compat_web.py
@@ -26,13 +26,13 @@ from http.server import ThreadingHTTPServer, BaseHTTPRequestHandler
from http.cookies import SimpleCookie
from pathlib import Path
-DB = r"R:\Resources\Intake\ledger.db"
+DB = r"R:\peach-data\database\ledger.db"
HERE = os.path.dirname(os.path.abspath(__file__))
PAGE = os.path.join(os.path.dirname(os.path.dirname(HERE)), "web", "index.html")
-SNAP_ROOT = r"R:\Resources\Intake\snapshots"
-LOGO_ROOT = r"R:\Resources\Intake\logos"
-AVA_ROOT = r"R:\Resources\Intake\avatars"
-POSTER_ROOT = r"R:\Resources\Intake\posters"
+SNAP_ROOT = r"R:\peach-data\generated\snapshots"
+LOGO_ROOT = r"R:\peach-data\generated\logos"
+AVA_ROOT = r"R:\peach-data\generated\avatars"
+POSTER_ROOT = r"R:\peach-data\generated\posters"
FFPROBE = os.path.join(os.environ.get("LOCALAPPDATA", ""), "Stash", "ffmpeg-btbn",
"ffmpeg-master-latest-win64-gpl-shared", "bin", "ffprobe.exe")
FFMPEG = os.path.join(os.environ.get("LOCALAPPDATA", ""), "Stash", "ffmpeg-btbn",
diff --git a/src/peach/config.py b/src/peach/config.py
index 8417d5eed..817da6915 100644
--- a/src/peach/config.py
+++ b/src/peach/config.py
@@ -4,21 +4,29 @@ from pathlib import Path
PROJECT_ROOT = Path(__file__).resolve().parents[2]
-DATA_ROOT = Path(os.environ.get("PEACH_DATA_ROOT", r"R:\Resources"))
-INTAKE_ROOT = DATA_ROOT / "Intake"
+DATA_ROOT = Path(os.environ.get("PEACH_DATA_ROOT", r"R:\peach-data"))
+DATABASE_DIR = DATA_ROOT / "database"
+DATABASE_PATH = DATABASE_DIR / "ledger.db"
+GENERATED_DIR = DATA_ROOT / "generated"
+SOURCES_DIR = DATA_ROOT / "sources"
+STATE_DIR = DATA_ROOT / "state"
+SECRETS_DIR = DATA_ROOT / "secrets"
+LOG_DIR = DATA_ROOT / "logs"
+ARCHIVE_DIR = DATA_ROOT / "archive"
+INBOX_DIR = DATA_ROOT / "inbox"
MIGRATIONS_DIR = PROJECT_ROOT / "migrations"
@dataclass(frozen=True)
class PeachSettings:
- db_path: Path = INTAKE_ROOT / "ledger.db"
+ db_path: Path = DATABASE_PATH
page_path: Path = PROJECT_ROOT / "web" / "index.html"
token: str = ""
legacy_module_path: Path = Path(__file__).with_name("compat_web.py")
docs_enabled: bool = False
- allowed_media_roots: tuple[Path, ...] = (Path(r"R:\Media"), Path("B:/"), Path("A:/"))
- snapshot_root: Path = INTAKE_ROOT / "snapshots"
- poster_root: Path = INTAKE_ROOT / "posters"
- avatar_root: Path = INTAKE_ROOT / "avatars"
- logo_root: Path = INTAKE_ROOT / "logos"
+ allowed_media_roots: tuple[Path, ...] = (Path(r"R:\media"), Path("B:/"), Path("A:/"))
+ snapshot_root: Path = GENERATED_DIR / "snapshots"
+ poster_root: Path = GENERATED_DIR / "posters"
+ avatar_root: Path = GENERATED_DIR / "avatars"
+ logo_root: Path = GENERATED_DIR / "logos"
allow_legacy_stash_ffmpeg: bool = True
diff --git a/tests/test_fastapi_api.py b/tests/test_fastapi_api.py
index 3e041c4c9..bf6638f34 100644
--- a/tests/test_fastapi_api.py
+++ b/tests/test_fastapi_api.py
@@ -80,7 +80,7 @@ class FastApiContractTests(unittest.IsolatedAsyncioTestCase):
async def test_health_is_side_effect_free(self):
response = await self.client.get("/healthz")
self.assertEqual(response.status_code, 200)
- self.assertEqual(response.json()["mode"], "candidate")
+ self.assertEqual(response.json()["mode"], "fastapi")
async def test_auth_and_items_contract(self):
denied = await self.client.get("/api/items")
diff --git a/tests/test_rm_ledger.py b/tests/test_rm_ledger.py
index aba1c20f0..e808af543 100644
--- a/tests/test_rm_ledger.py
+++ b/tests/test_rm_ledger.py
@@ -40,13 +40,13 @@ class LedgerSchemaTests(unittest.TestCase):
con = sqlite3.connect(self.db)
con.execute(
"INSERT INTO asset(location,path,name,medium,creator) VALUES('local',?,?,?,?)",
- (r"R:\Media\one.mp4", "one.mp4", "video", "Channel Owner"),
+ (r"R:\media\one.mp4", "one.mp4", "video", "Channel Owner"),
)
con.commit()
con.close()
response = {"findScenes": {"scenes": [{
"id": "42", "title": "one", "rating100": 80, "o_counter": 2, "play_count": 3,
- "files": [{"path": r"R:\Media\one.mp4", "size": 10, "duration": 30,
+ "files": [{"path": r"R:\media\one.mp4", "size": 10, "duration": 30,
"width": 1920, "height": 1080, "video_codec": "h264",
"frame_rate": 30, "audio_codec": "aac"}],
"studio": {"name": "Studio A"},
@@ -59,11 +59,11 @@ class LedgerSchemaTests(unittest.TestCase):
con = sqlite3.connect(self.db)
row = con.execute(
"SELECT creator,studio,stash_scene_id FROM asset WHERE path=?",
- (r"R:\Media\one.mp4",),
+ (r"R:\media\one.mp4",),
).fetchone()
tags = {x[0] for x in con.execute(
"SELECT tag FROM asset_tag WHERE asset_id=(SELECT id FROM asset WHERE path=?)",
- (r"R:\Media\one.mp4",),
+ (r"R:\media\one.mp4",),
)}
con.close()
self.assertEqual(row, ("Channel Owner", "Studio A", 42))