Skip to content

smartplaylist: Copy-paste-able list of playlists#6404

Open
JOJ0 wants to merge 4 commits intomasterfrom
spl_copy_paste_able
Open

smartplaylist: Copy-paste-able list of playlists#6404
JOJ0 wants to merge 4 commits intomasterfrom
spl_copy_paste_able

Conversation

@JOJ0
Copy link
Copy Markdown
Member

@JOJ0 JOJ0 commented Mar 2, 2026

Description

A simple QoL feature for splupdate - when wanting to update multiple (not all) smartplaylists, it is not very convenient to copy-paste the name from the output the plugin uses.

So for example issuing beet splupdate non_existent_list we get: ['playlist_name_1', 'playlist name 2', ...]. This output can't easily be copy-pasted back to a shell command like

beet splupdate playlist_name_1 'playlist name 2'

This change handles quoting for shell using shlex.quote which makes it easy to copy-paste several lists in a row (eg. with common prefixes). Also the list of playlists is now sorted alphabetically prior to printing on the shell!

Addition refactorings

A tiny fix below if not pretend: where .items() for dict-iterating should have been used in the first place.

Todo

  • Documentation. (Not required IMO)
  • Changelog.
  • Tests.

Copilot AI review requested due to automatic review settings March 2, 2026 07:18
@JOJ0 JOJ0 requested a review from a team as a code owner March 2, 2026 07:18
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR tweaks the smartplaylist plugin’s CLI error output to make the “available playlists” list easier to copy/paste when a user passes an unknown playlist name.

Changes:

  • Sort the available smart playlist names before printing them in the splupdate error.
  • Print the available playlist names as a space-delimited string instead of Python’s list repr.
  • Add an Unreleased changelog entry describing the behavior change.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 4 comments.

File Description
docs/changelog.rst Documents the updated smartplaylist error output behavior in the Unreleased changelog.
beetsplug/smartplaylist.py Sorts unmatched playlist names and changes error formatting to a space-delimited list.

@codecov
Copy link
Copy Markdown

codecov bot commented Mar 2, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 70.06%. Comparing base (e536514) to head (481ed7c).
✅ All tests successful. No failed tests found.

Additional details and impacted files
@@           Coverage Diff           @@
##           master    #6404   +/-   ##
=======================================
  Coverage   70.05%   70.06%           
=======================================
  Files         147      147           
  Lines       18560    18563    +3     
  Branches     3026     3026           
=======================================
+ Hits        13003    13006    +3     
  Misses       4924     4924           
  Partials      633      633           
Files with missing lines Coverage Δ
beetsplug/smartplaylist.py 76.26% <100.00%> (+0.36%) ⬆️
🚀 New features to boost your workflow:
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@JOJ0 JOJ0 marked this pull request as draft March 2, 2026 07:24
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 2 out of 2 changed files in this pull request and generated no new comments.

@JOJ0
Copy link
Copy Markdown
Member Author

JOJ0 commented Mar 2, 2026

Oh I didn't realize that playlist file names could have spaces since I don't use it like that. Hmm then this needs polishisng. Probably simply wrapping into double quotes should suffice?

@JOJ0 JOJ0 force-pushed the spl_copy_paste_able branch 2 times, most recently from d7d1fb1 to ed21954 Compare April 3, 2026 11:11
JOJ0 added a commit that referenced this pull request Apr 3, 2026
@JOJ0 JOJ0 force-pushed the spl_copy_paste_able branch from ed21954 to 53e9196 Compare April 3, 2026 11:13
JOJ0 added 2 commits April 3, 2026 13:16
When supplying an invalid playlist name, the list of all playlists is
shell quoted (single quotes) and becomes usable for copy/paste-ing to
the user's shell.
JOJ0 added a commit that referenced this pull request Apr 3, 2026
@JOJ0 JOJ0 force-pushed the spl_copy_paste_able branch from 53e9196 to d555167 Compare April 3, 2026 11:17
@JOJ0 JOJ0 requested a review from Copilot April 3, 2026 11:21
@JOJ0 JOJ0 marked this pull request as ready for review April 3, 2026 11:22
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.

JOJ0 added a commit that referenced this pull request Apr 3, 2026
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
@JOJ0 JOJ0 force-pushed the spl_copy_paste_able branch from 2697b83 to e87d6f4 Compare April 3, 2026 15:43
JOJ0 and others added 2 commits April 3, 2026 19:50
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
@JOJ0 JOJ0 force-pushed the spl_copy_paste_able branch from e87d6f4 to 481ed7c Compare April 3, 2026 17:50
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.

2 participants