Skip to content

Add show_progress() to globally suppress MGT progress bars#332

Merged
alexarje merged 2 commits into
masterfrom
copilot/optimize-ffmpeg-commands
Apr 13, 2026
Merged

Add show_progress() to globally suppress MGT progress bars#332
alexarje merged 2 commits into
masterfrom
copilot/optimize-ffmpeg-commands

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Apr 13, 2026

Progress bars are useful interactively but break batch pipelines and server logs due to repeated \r writes. This adds a global toggle to suppress them.

Changes

  • musicalgestures/_utils.py: Adds _SHOW_PROGRESS module-level flag (default True) and show_progress(enabled: bool) function. MgProgressbar.progress() short-circuits silently when the flag is False, while still advancing finished state correctly.
  • musicalgestures/__init__.py: Exports show_progress at the top-level package.
  • tests/test_utils.py: Adds Test_show_progress (8 tests) covering flag state, output suppression, finished tracking, and round-trip enable/disable behaviour.

Usage

import musicalgestures as mg

mg.show_progress(False)  # suppress all progress bars

for video in my_large_dataset:
    result = mg.MgVideo(video, starttime=5, endtime=15)  # silent

mg.show_progress(True)   # re-enable for interactive use
mg.MgVideo(single_video)  # progress bar visible again

Copilot AI linked an issue Apr 13, 2026 that may be closed by this pull request
Copilot AI changed the title [WIP] Optimize ffmpeg command usage for better performance Add show_progress() to globally suppress MGT progress bars Apr 13, 2026
Copilot AI requested a review from alexarje April 13, 2026 15:40
@alexarje alexarje marked this pull request as ready for review April 13, 2026 16:05
@alexarje alexarje merged commit 1a26cb6 into master Apr 13, 2026
2 of 11 checks passed
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.

Misc of suggestions

2 participants