Repository navigation
Remove dead code and trim over-built helpers - #132
Merged
Merged
Conversation
Merged
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #129.
A cleanup pass that makes the code shorter and easier to follow. The only change users will notice is that a bad
--astreamsvalue now stops the run with an error, instead of being logged and ignored. That matches how #121 handles other bad settings.What changed
--astreamsparsing (arguments.py):_parse_astreamswent from about 50 lines to about 10. It still accepts a comma-separated string or a JSON list from a config file and removes duplicates. Negative, decimal, blank, or non-numeric values now raise aValueError, andmain()shows the message and exits with code 1 (no traceback).CODEC_OVERRIDES(twopass.py): now a flat{codec: {second-pass options}}table. No codec used the"both"or"pass1"sections, so the loop is oneupdate()call, and the test that only patched in a fake"both"entry is gone.versioning.py: rewritten down to what the update notice needs. Thepyproject.tomlfallback and the unusedpackage_name=andtimeout_s=parameters are gone. Versions are compared by their leading numbers (so 0.4.10 is newer than 0.4.9), replacing a helper that also compared the raw strings. A missing install now catches onlyPackageNotFoundError, and the comment inmain()no longer claims the check never delays startup (it waits up to the 1.5 second timeout).red(text)helper (twopass.py): replaces the repeated"\033[31m" + dedent(...).strip() + "\033[0m"pattern intwopass.pyand__main__.py.windows.pyis left alone, since it must not import other modules.parse_time(value, duration): replacestimestamp_from_percentage. It returns seconds directly, soclip_timesno longer turns a percentage into a timestamp string and parses it back.run_passreusescommand_for_displayfor the failed command, so the error shows a command you can paste into a terminal.FILE_SIZE_MULT = 1 / 1024**2;_normalize_amix_argsis inlined inget_args;logging.getLogger().setLevel(logging.INFO)moved from import time intomain(); the-adefault now comes fromFALLBACK_AUDIO_BRso the two 96 kbps values can't drift apart.Testing
uv run pytest --cov: 296 passed, 99.34% coverage.uv run ruff format . && uv run ruff check .: clean.ff4d bikes.mp4 --from 10% --to 00:00:15 -s 2produced a 1.98 MB file.ff4d bikes.mp4 --astreams "0,-1" --dry-runexits with code 1 and printsInvalid --astreams value '0,-1'. ....