Add opt-in diagnostic logging
This commit is contained in:
@@ -3,6 +3,7 @@ import argparse
|
||||
|
||||
from serato_doctor.config import ScanConfig
|
||||
from serato_doctor.crate_parser import parse_crates
|
||||
from serato_doctor.logging import configure_logging
|
||||
from serato_doctor.models.library import Library
|
||||
from serato_doctor.scanner import scan_audio
|
||||
from serato_doctor.report import write_csv, write_missing_report
|
||||
@@ -20,6 +21,10 @@ def main():
|
||||
default=[],
|
||||
help="Old library root stored in crates; may be supplied more than once",
|
||||
)
|
||||
parser.add_argument(
|
||||
"--verbose", action="store_true", help="Write diagnostic progress to stderr"
|
||||
)
|
||||
parser.add_argument("--log-file", help="Write scan progress to a log file")
|
||||
args = parser.parse_args()
|
||||
|
||||
config = ScanConfig.build(
|
||||
@@ -28,7 +33,13 @@ def main():
|
||||
out=Path(args.out),
|
||||
report=Path(args.report),
|
||||
reference_roots=(Path(root) for root in args.reference_root),
|
||||
verbose=args.verbose,
|
||||
log_file=Path(args.log_file) if args.log_file else None,
|
||||
)
|
||||
logger = configure_logging(config.verbose, config.log_file)
|
||||
logger.info("Starting read-only library scan")
|
||||
logger.debug("Serato directory: %s", config.serato)
|
||||
logger.debug("Music directory: %s", config.music)
|
||||
|
||||
library = Library.build(
|
||||
references=parse_crates(
|
||||
@@ -38,9 +49,13 @@ def main():
|
||||
)
|
||||
results = library.reconcile_by_filename()
|
||||
missing_count = sum(1 for result in results if not result.exists_by_filename)
|
||||
logger.info("Parsed %d crate references", len(library.references))
|
||||
logger.info("Scanned %d disk tracks", len(library.tracks))
|
||||
logger.info("Found %d references missing by filename", missing_count)
|
||||
|
||||
write_csv(results, config.out)
|
||||
write_missing_report(results, config.report)
|
||||
logger.info("Wrote CSV and missing-reference reports")
|
||||
|
||||
print(f"Crate references: {len(library.references)}")
|
||||
print(f"Disk tracks: {len(library.tracks)}")
|
||||
|
||||
Reference in New Issue
Block a user