sorter: drop non-warhammer game systems (default: Middle-Earth)
The collection is warhammer-only; everything else stays in _unsorted even when names match the catalog. The catalog snapshot keeps all systems - the filter is a sorter default (DROPPED_SYSTEMS, applied in load_catalog and after keyword classification), adjustable with --drop-system/--keep-system.
This commit is contained in:
@@ -27,6 +27,7 @@ import sys
|
||||
from pathlib import Path
|
||||
|
||||
from dlphelper.sorter import (
|
||||
DROPPED_SYSTEMS,
|
||||
format_plan,
|
||||
load_catalog,
|
||||
sort_plan,
|
||||
@@ -57,8 +58,20 @@ def main() -> None:
|
||||
"sort whole extraction directories as units")
|
||||
parser.add_argument("--json", action="store_true",
|
||||
help="print the plan as JSON instead of text")
|
||||
parser.add_argument("--drop-system", action="append", default=[],
|
||||
metavar="NAME",
|
||||
help="never place into this game system "
|
||||
"(default-dropped: Middle-Earth)")
|
||||
parser.add_argument("--keep-system", action="append", default=[],
|
||||
metavar="NAME",
|
||||
help="re-enable a default-dropped game system")
|
||||
args = parser.parse_args()
|
||||
|
||||
dropped = frozenset(DROPPED_SYSTEMS - set(args.keep_system)
|
||||
| set(args.drop_system))
|
||||
if args.keep_system or args.drop_system:
|
||||
log.info("System filter adjusted: dropping %s", ", ".join(sorted(dropped)) or "nothing")
|
||||
|
||||
logging.basicConfig(level=logging.INFO,
|
||||
format="%(asctime)s %(levelname)-7s %(message)s",
|
||||
datefmt="%H:%M:%S")
|
||||
@@ -69,7 +82,9 @@ def main() -> None:
|
||||
# hidden trees like .broken/ must never reach the plan
|
||||
if not any(part.startswith(".") for part in p.relative_to(source).parts)
|
||||
)
|
||||
catalog = load_catalog(args.catalog)
|
||||
catalog = load_catalog(args.catalog, dropped=dropped)
|
||||
if dropped:
|
||||
log.info("Dropped systems: %s", ", ".join(sorted(dropped)))
|
||||
audit = args.audit or (args.library / "sorter_applied.jsonl")
|
||||
|
||||
provenance = None
|
||||
|
||||
Reference in New Issue
Block a user