diff --git a/change_sync_bias.py b/change_sync_bias.py index 46bb089..a918181 100644 --- a/change_sync_bias.py +++ b/change_sync_bias.py @@ -1,10 +1,29 @@ +R""" +Add or subtract the standard ITG sync bias (9 milliseconds) +to all of the sync offsets in a pack. + +This script updates the offsets of both SM and SSC simfiles, +including any SSC charts with their own timing data. + +If you actually intend to use this script in practice, +you may want to keep track of which packs you've already adjusted +using a text file in each pack directory or some other system. + +Usage examples: + + # Convert a pack from "null sync" to "ITG sync" + python change_sync_bias.py +9 "C:\StepMania\Songs\My Pack" + + # Convert a pack from "ITG sync" to "null sync" + python change_sync_bias.py -9 "C:\StepMania\Songs\My Pack" +""" import argparse from decimal import Decimal import sys from typing import Union import simfile -from simfile.dir import SimfilePack +import simfile.dir class ChangeSyncBiasArgs: @@ -58,6 +77,8 @@ def change_sync_bias(simfile_path: str, args: ChangeSyncBiasArgs): input_filename=f"{simfile_path}", backup_filename=f"{simfile_path}~", ) as sf: + print(f"Processing {simfile_path}") + # Always adjust the simfile's offset adjust_offset(sf, delta) @@ -74,7 +95,7 @@ def main(argv): # Iterate over SimfileDirectory objects from the pack # so that we can easily get the .sm and/or .ssc paths - for simfile_dir in SimfilePack(args.pack).simfile_dirs(): + for simfile_dir in simfile.dir.SimfilePack(args.pack).simfile_dirs(): # Try to update whichever formats exist for simfile_path in [simfile_dir.sm_path, simfile_dir.ssc_path]: