feat: add migrate step to move mod folders between groups on preset change
Before step_fetch, scan all downloads/ subdirs and move any mod that comparison.json now assigns to a different group. Matching uses steam_id (via meta.cpp publishedid) first, normalized name as fallback. Stale junctions in arma_dir are removed before the folder move so step_link can re-create them pointing to the new location. - New arma_modlist_tools/migrator.py: migrate_mod_groups() - run.py: step_migrate(), --skip-migrate flag, wired into dispatch loop - gui/app.py: step_migrate inserted as Step 3/5 between compare and fetch - gui/locales.py: add step3/4/5 names (en + vi), renumber old 3->4, 4->5 - test_suite.py: 7 new migrator tests (158 total, 0 failed)
This commit is contained in:
18
gui/app.py
18
gui/app.py
@@ -151,7 +151,7 @@ class ArmaModManagerApp(ctk.CTk):
|
||||
# run.py calls fix_console_encoding() at import time, which needs
|
||||
# the real sys.stdout.buffer. Import it before we redirect stdout.
|
||||
try:
|
||||
from run import step_fetch, step_link
|
||||
from run import step_migrate, step_fetch, step_link
|
||||
except Exception as _import_err:
|
||||
self.after(0, lambda: self.post_log(
|
||||
f"\n✗ Failed to load pipeline: {_import_err}\n"
|
||||
@@ -165,7 +165,7 @@ class ArmaModManagerApp(ctk.CTk):
|
||||
from arma_modlist_tools.compare import compare_presets
|
||||
|
||||
# Step 1 — Parse selected presets
|
||||
_hdr("Step 1 / 4", t("pipeline.step1_name"))
|
||||
_hdr("Step 1 / 5", t("pipeline.step1_name"))
|
||||
cfg.modlist_json.mkdir(exist_ok=True)
|
||||
presets = []
|
||||
for fp in sorted(cfg.modlist_html.glob("*.html")):
|
||||
@@ -182,7 +182,7 @@ class ArmaModManagerApp(ctk.CTk):
|
||||
presets.append(preset)
|
||||
|
||||
# Step 2 — Compare
|
||||
_hdr("Step 2 / 4", t("pipeline.step2_name"))
|
||||
_hdr("Step 2 / 5", t("pipeline.step2_name"))
|
||||
result = compare_presets(*presets)
|
||||
cfg.comparison.write_text(
|
||||
json.dumps(result, indent=2, ensure_ascii=False),
|
||||
@@ -193,12 +193,16 @@ class ArmaModManagerApp(ctk.CTk):
|
||||
print(f" Shared: {result['shared']['mod_count']} | "
|
||||
f"Unique: {total_unique}")
|
||||
|
||||
# Step 3 — Fetch
|
||||
_hdr("Step 3 / 4", t("pipeline.step3_name"))
|
||||
# Step 3 — Migrate
|
||||
_hdr("Step 3 / 5", t("pipeline.step3_name"))
|
||||
step_migrate(cfg)
|
||||
|
||||
# Step 4 — Fetch
|
||||
_hdr("Step 4 / 5", t("pipeline.step4_name"))
|
||||
step_fetch(cfg)
|
||||
|
||||
# Step 4 — Link
|
||||
_hdr("Step 4 / 4", t("pipeline.step4_name"))
|
||||
# Step 5 — Link
|
||||
_hdr("Step 5 / 5", t("pipeline.step5_name"))
|
||||
groups = (
|
||||
sorted(p.name for p in cfg.downloads.iterdir() if p.is_dir())
|
||||
if cfg.downloads.is_dir() else []
|
||||
|
||||
@@ -29,8 +29,9 @@ _EN: dict[str, str] = {
|
||||
"pipeline.starting": "Pipeline started",
|
||||
"pipeline.step1_name": "Parse presets",
|
||||
"pipeline.step2_name": "Compare presets",
|
||||
"pipeline.step3_name": "Download mods",
|
||||
"pipeline.step4_name": "Link mods",
|
||||
"pipeline.step3_name": "Migrate mod groups",
|
||||
"pipeline.step4_name": "Download mods",
|
||||
"pipeline.step5_name": "Link mods",
|
||||
|
||||
# ── app.py dialogs ────────────────────────────────────────────────────────
|
||||
"app.dlg_presets_title": "Not enough presets selected",
|
||||
@@ -270,8 +271,9 @@ _VI: dict[str, str] = {
|
||||
"pipeline.starting": "Pipeline đã bắt đầu",
|
||||
"pipeline.step1_name": "Phân tích preset",
|
||||
"pipeline.step2_name": "So sánh preset",
|
||||
"pipeline.step3_name": "Tải mod",
|
||||
"pipeline.step4_name": "Liên kết mod",
|
||||
"pipeline.step3_name": "Di chuyển nhóm mod",
|
||||
"pipeline.step4_name": "Tải mod",
|
||||
"pipeline.step5_name": "Liên kết mod",
|
||||
|
||||
# ── app.py dialogs ────────────────────────────────────────────────────────
|
||||
"app.dlg_presets_title": "Chưa chọn đủ preset",
|
||||
|
||||
Reference in New Issue
Block a user