Skip to content

[codex] Fix playback dependency handling and bump version#3

Merged
thepushkarp merged 3 commits intomainfrom
codex/fix-playback-deps-pr
Mar 10, 2026
Merged

[codex] Fix playback dependency handling and bump version#3
thepushkarp merged 3 commits intomainfrom
codex/fix-playback-deps-pr

Conversation

@thepushkarp
Copy link
Owner

Summary

  • fail fast when playback is requested without mpv
  • stop the TUI from claiming playback started when mpv startup fails
  • document Brew vs cargo install runtime dependency expectations
  • bump the crate version from 0.0.2 to 0.0.3

Why

A fresh install could reach playback code without a working player backend. In the CLI, mls play discovered that late during process spawn. In the TUI, playback start errors were swallowed and the UI could report Playing: ... even though nothing started.

This change makes missing mpv explicit and actionable for the runtime paths that need it while keeping browse/list features usable without playback.

What changed

  • return dependency exit code 4 with Playback requires mpv. Install: brew install mpv for mls play when mpv is absent
  • normalize playback startup errors into a user-facing message
  • only update TUI playback state after a successful start, including triage mode
  • add a CLI regression test for missing mpv and a TUI unit test for failed playback startup state
  • update install docs so Homebrew and cargo install paths describe different runtime provisioning

Validation

  • cargo test
  • cargo clippy --all-targets --all-features -- -D warnings
  • cargo fmt --check
  • PATH="$(pwd)/tests/fixtures/mock_bin" target/debug/mls --quiet play README.md -> exit 4 with install hint

Companion change

A companion PR in thepushkarp/homebrew-tap adds mpv to the Brew formula and verifies the dependency stays declared. These two PRs should merge together.

@gemini-code-assist
Copy link

Summary of Changes

Hello, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request significantly improves the robustness and user experience of the media-ls application by addressing issues related to missing playback dependencies. It ensures that users are immediately informed if the mpv player is not available when attempting to play media, both in the command-line interface and the terminal user interface. The changes also streamline error reporting for playback failures and provide clearer installation instructions for runtime dependencies across different installation methods.

Highlights

  • Dependency Handling: Implemented fail-fast behavior for the play command when the mpv player is not installed, returning an explicit error code and message.
  • TUI Playback Error Handling: Prevented the TUI from incorrectly indicating playback has started when mpv fails to launch, and now displays user-friendly error messages for playback failures.
  • Documentation Updates: Clarified runtime dependency expectations in README.md for Homebrew versus cargo install and source builds, detailing the need for ffmpeg, mpv, and trash.
  • Version Bump: Bumped the crate version from 0.0.2 to 0.0.3.
Changelog
  • Cargo.lock
    • Updated media-ls package version to 0.0.3.
  • Cargo.toml
    • Updated media-ls crate version to 0.0.3.
  • README.md
    • Updated installation instructions for Homebrew, Cargo, and source builds to clarify runtime dependencies for ffmpeg, mpv, and trash.
  • src/deps.rs
    • Added constants for mpv dependency error and warning messages.
  • src/main.rs
    • Implemented early exit with an error code if mpv is missing for the play command and updated warning messages.
  • src/playback.rs
    • Added a utility function playback_error_message to format user-friendly error messages for playback failures.
  • src/tui/mod.rs
    • Refactored TUI playback state management with new helper functions, improved error handling for playback startup, and added a unit test for playback failure.
  • src/tui/triage.rs
    • Modified triage mode playback initiation to use the new apply_playback_start_result function for consistent error handling.
  • tests/cli.rs
    • Added a new CLI test case to verify the correct exit code and error message when attempting playback without mpv.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for GitHub and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request effectively improves the handling of the mpv playback dependency. It introduces a 'fail fast' mechanism for the CLI, prevents the TUI from displaying misleading playback status on startup failure, and enhances the documentation regarding installation dependencies. The addition of regression and unit tests is a great way to ensure these fixes are robust. I have one suggestion to slightly refactor the new error handling function for better readability, aligning with our guidelines on reducing code duplication.

@thepushkarp thepushkarp marked this pull request as ready for review March 10, 2026 02:30
@thepushkarp thepushkarp merged commit ff51eda into main Mar 10, 2026
3 checks passed
@thepushkarp thepushkarp deleted the codex/fix-playback-deps-pr branch March 10, 2026 02:58
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