You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
fix(cli): say nothing is playing in the share flags - #1075
When nothing is playing, spotatui playback --share-album returned the error failed to generate a shareable url for the current song, which talked about a song even when sharing an album, and neither flag indicated that playback was stopped.
This change:
Extracts URL formatting into pure helpers track_share_url and album_share_url taking Option<&PlayableItem>.
In the None branch, returns clear errors stating that nothing is playing:
--share-track: nothing is playing, so there is no song or episode to share
--share-album: nothing is playing, so there is no album or show to share
Updates share_track_or_episode and share_album_or_show to call the helpers while preserving the single read of app.current_playback_context.
Adds tests track_share_url_with_nothing_playing_says_nothing_is_playing, album_share_url_with_nothing_playing_says_nothing_is_playing, and album_share_url_of_a_playing_track_is_its_album_link.
Corrects the typo comment // Evalute the subcommand to // Evaluate the subcommand in src/cli/handle.rs.
cargo test --no-default-features --features telemetry,tui (1931 passed; 0 failed)
git diff tools/gates.count (empty, direct_playback_context_reads preserved at 87)
Additional notes
Errors remain standard lowercase anyhow Errs without routing through handle_error.
Existing URLs and other error messages are completely unchanged.
tools/gates.count counter is unchanged.
Summary by CodeRabbit
Bug Fixes
Share commands now clearly report that nothing is playing when used without active playback, including the album-sharing command.
Sharing an album while a track is playing now generates the correct album link, rather than an incorrect or mismatched link. These updates make the feedback more consistent across share options and ensure album links reflect the requested content.
No actionable comments were generated in the recent review.
Walkthrough
The CLI share methods now use URL helpers that return flag-specific errors when no item is playing. Tests cover both empty-playback errors and album URL generation from a playing track.
Changes: CLI share errors
Layer / File(s)
Summary
Share URL helpers and tests src/cli/cli_app.rs
Added helpers that generate track or episode and album or show URLs. Missing playback now returns flag-specific errors. Tests cover both errors and an album URL generated from a playing track.
CLI integration and changelog src/cli/cli_app.rs, src/cli/handle.rs, CHANGELOG.md
The share methods pass the optional current item to the URL helpers. The changelog records the empty-playback messages. A subcommand comment spelling is corrected.
The change makes the CLI report a clear "nothing is playing" message for the share flags when nothing is playing. Existing links are unchanged. No merge-blocking risk is evident.
Pre-merge checks: 4
Check name
Status
Explanation
Description Check
Check skipped - CodeRabbit’s high-level summary is enabled.
Title check
The title uses the conventional-commit prefix fix(cli) and matches the main change. The PR makes the share flags report a specific "nothing is playing" error when no track or album is playing, which t…
Linked Issues check
Issue #1050 is the only active direct link. Its coding requirements are met at the reviewed head, based on the whole-PR diff of src/cli/cli_app.rs against the merge base. Error text for track_share_ur…
Out of Scope Changes check
The src/cli/cli_app.rs whole-PR diff contains only work that issue #1050 requests: two pure helpers, updated async share methods, three named tests, and the imports the tests need. No TUI copy-link co…
Full details: Title check
Explanation
The title uses the conventional-commit prefix fix(cli) and matches the main change. The PR makes the share flags report a specific "nothing is playing" error when no track or album is playing, which the title describes. The title is concise and imperative, and it meets the configured title requirements.
Full details: Linked Issues check
Explanation
Issue #1050 is the only active direct link. Its coding requirements are met at the reviewed head, based on the whole-PR diff of src/cli/cli_app.rs against the merge base. Error text for track_share_url(None) and album_share_url(None) matches the issue. The old 'current song' message is removed. Both async methods read current_playback_context once and call the helpers. Existing URLs and other messages are unchanged. Errors remain Err values. The three required tests exist and use no Spotify client or network. Not directly inspected: the handle.rs comment fix, the CHANGELOG.md entry, and tools/gates.count. These rest on the PR summary. The incremental diff since the previous reviewed head could not be read.
Full details: Out of Scope Changes check
Explanation
The src/cli/cli_app.rs whole-PR diff contains only work that issue #1050 requests: two pure helpers, updated async share methods, three named tests, and the imports the tests need. No TUI copy-link code changes appear, consistent with the exclusion of #1042. The handle.rs comment fix and CHANGELOG.md entry match the issue's acceptance criteria, but were not inspected directly and rest on the PR summary.
Finishing Touches
Generate unit tests (beta)
Create a new PR
Simplify code
Create a new PR
Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.
Reviewing files that changed from the base of the PR and between e5d5689 and cf8952d.
Files selected for processing: 1
CHANGELOG.md
Included review availability: This review used your included allowance. Your plan provides up to 4 included reviews per hour; 3 remain after this review.
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
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.
Summary
When nothing is playing,
spotatui playback --share-albumreturned the errorfailed to generate a shareable url for the current song, which talked about a song even when sharing an album, and neither flag indicated that playback was stopped.This change:
track_share_urlandalbum_share_urltakingOption<&PlayableItem>.Nonebranch, returns clear errors stating that nothing is playing:--share-track:nothing is playing, so there is no song or episode to share--share-album:nothing is playing, so there is no album or show to shareshare_track_or_episodeandshare_album_or_showto call the helpers while preserving the single read ofapp.current_playback_context.track_share_url_with_nothing_playing_says_nothing_is_playing,album_share_url_with_nothing_playing_says_nothing_is_playing, andalbum_share_url_of_a_playing_track_is_its_album_link.// Evalute the subcommandto// Evaluate the subcommandinsrc/cli/handle.rs.### FixedinCHANGELOG.md.Fixes #1050.
Testing
cargo test --no-default-features --features telemetry,tui share_url(3 passed; 0 failed; 1928 filtered out)cargo fmt --all -- --checkcargo clippy --no-default-features --features telemetry,tui -- -D warningscargo test --no-default-features --features telemetry,tui(1931 passed; 0 failed)git diff tools/gates.count(empty, direct_playback_context_reads preserved at 87)Additional notes
Errs without routing throughhandle_error.tools/gates.countcounter is unchanged.Summary by CodeRabbit