Skip to content

chore: low-priority cleanups (logging, imports, deps, atempo, test hygiene) - #8

Open
rsmxingu wants to merge 1 commit into
rsd:masterfrom
rsmxingu:chore/low-priority-cleanups
Open

chore: low-priority cleanups (logging, imports, deps, atempo, test hygiene)#8
rsmxingu wants to merge 1 commit into
rsd:masterfrom
rsmxingu:chore/low-priority-cleanups

Conversation

@rsmxingu

Copy link
Copy Markdown

Bundles the low-priority review items into one PR. No user-facing behavior changes except the atempo edge-case fix.

Changes

Logging — one mechanism instead of two

_setup_logging() did a manual os.remove / truncate(0) dance and used a RotatingFileHandler. Replaced with RotatingFileHandler(mode="w"): each session still starts with a fresh log (the behavior documented in the README) and the rotating handler still caps in-session growth.

ui.py — hoist imports

import sys / import ctypes moved from inside __init__ to the module top.

processor.py — atempo chaining for extreme speeds

A single ffmpeg atempo only accepts factors in [0.5, 2.0]. Added _atempo_chain() which decomposes out-of-range speeds into a valid chain (e.g. 2.5 -> "atempo=2.0000,atempo=1.2500"). The common 1.2x path is byte-for-byte unchanged. This fixes a latent failure when auto-editor marks a clip faster than 2x. Applied to both the cut and no-cut audio paths.

requirements

  • Added conservative upper bounds; pinned auto-editor<30 because the frozen-bundle integration relies on v29 internals (.v3 timeline, --no-seek, download_binary hook).
  • Added requirements-dev.txt (pytest).

Test hygiene

  • Renamed test_pipeline.pyintegration_pipeline.py. It is a manual, ffmpeg-driven smoke script, not a unit test — the test_*.py name caused pytest to collect and run the whole pipeline on a normal test run.
  • Added TestAtempoChain (4 cases).
  • Fixed a stale progress-math comment in test_run_success_two_pass.

Deferred

Silence-threshold input validation was intentionally left out: it depends on messagebox, which is fixed in a separate PR ("import tkinter.messagebox explicitly"). Adding it here would couple the two.

Testing

  • python3 -m py_compile processor.py ui.py tests/test_processor.py integration_pipeline.py passes.
  • python3 -m unittest tests.test_processor12 passed.
  • tests/test_ui.py requires tkinter (unavailable in my sandbox); please run python3 -m unittest tests.test_ui to confirm the ui.py import hoist there.

🤖 Generated with Claude Code

…giene)

Bundle of the low-priority review items:

- Logging: replace the manual remove/truncate-on-startup dance with
  RotatingFileHandler(mode="w"). Each session still starts with a fresh log
  (documented behavior preserved) and the rotating handler still caps in-session
  growth — one mechanism instead of two overlapping ones.

- ui.py: hoist `import sys` / `import ctypes` from inside __init__ to module top.

- processor.py: add _atempo_chain() so playback speeds outside ffmpeg's
  single-filter [0.5, 2.0] atempo range are decomposed into a valid chain
  (e.g. 2.5 -> "atempo=2.0000,atempo=1.2500"). The common 1.2x case is
  unchanged ("atempo=1.2000"). Fixes a latent failure for clips auto-editor
  marks faster than 2x. Used in both the cut and no-cut audio paths.

- requirements: add conservative upper bounds; pin auto-editor <30 since the
  frozen-bundle integration depends on v29 internals. Add requirements-dev.txt
  (pytest) for the test suite.

- Rename test_pipeline.py -> integration_pipeline.py: it is a manual,
  ffmpeg-driven smoke script, not a unit test; the test_*.py name made pytest
  collect and execute the whole pipeline on a normal test run.

Tests:
- Add TestAtempoChain (in-range, >2.0 chaining, far->chained, <0.5 chaining).
- Fix a stale progress-math comment in test_run_success_two_pass.
- tests/test_processor: 12 passed.

Deferred: silence-threshold input validation pairs with the messagebox import
fix (separate PR) and is intentionally left out here to avoid coupling.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant