Skip to content

New Plugin: Titlecase#6133

Merged
henry-oberholtzer merged 31 commits intobeetbox:masterfrom
henry-oberholtzer:titlecase
Nov 23, 2025
Merged

New Plugin: Titlecase#6133
henry-oberholtzer merged 31 commits intobeetbox:masterfrom
henry-oberholtzer:titlecase

Conversation

@henry-oberholtzer
Copy link
Member

This plugin aims to address the shortcomings of the %title function, as brought up in issues #152, #3298 and an initial look to improvement with #3411. It supplies a new string format command, %titlecase which doesn't interfere with any prior expected behavior of the %title format command.

It also adds the ability to apply titlecase logic to metadata fields that a user selects, which is useful if you, like me, are looking for stylistic consistency and the minor stylistic differences between Musizbrainz, Discogs, Deezer etc, with title case are slightly infuriating.

This will add an optional dependency of titlecase, which allows the titlecase core logic to be externally maintained.

If there's not enough draw to have this as a core plugin, I can also spin this into an independent one, but it seemed like a recurring theme that the %title string format didn't really behave as expected, and I wanted my metadata to match too.

  • Documentation. (If you've added a new command-line flag, for example, find the appropriate page under docs/ to describe it.)
  • Changelog. (Add an entry to docs/changelog.rst to the bottom of one of the lists near the top of the document.)
  • Tests. - Not 100% coverage, but didn't see a lot of other plugins with testing for import stages.

@henry-oberholtzer henry-oberholtzer requested a review from a team as a code owner October 26, 2025 23:47
@github-actions
Copy link

Thank you for the PR! The changelog has not been updated, so here is a friendly reminder to check if you need to add an entry.

sourcery-ai[bot]

This comment was marked as outdated.

@henry-oberholtzer henry-oberholtzer linked an issue Oct 28, 2025 that may be closed by this pull request
Copy link
Contributor

@semohr semohr left a comment

Choose a reason for hiding this comment

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

The documentation is lovely! Added some small comments but looks good overall.

@semohr semohr self-assigned this Oct 29, 2025
@henry-oberholtzer henry-oberholtzer marked this pull request as draft November 10, 2025 01:26
@henry-oberholtzer
Copy link
Member Author

Want to add an option intercept candidates for auto tagging before the distances have been calculated, so the changes the plugin makes are more obvious on import - have reverted to draft until then.

@henry-oberholtzer henry-oberholtzer marked this pull request as ready for review November 16, 2025 00:18
@github-actions
Copy link

Thank you for the PR! The changelog has not been updated, so here is a friendly reminder to check if you need to add an entry.

sourcery-ai[bot]

This comment was marked as outdated.

@codecov
Copy link

codecov bot commented Nov 16, 2025

Codecov Report

❌ Patch coverage is 99.15966% with 1 line in your changes missing coverage. Please review.
✅ Project coverage is 67.71%. Comparing base (d446e10) to head (80482a8).
⚠️ Report is 152 commits behind head on master.
✅ All tests successful. No failed tests found.

Files with missing lines Patch % Lines
beetsplug/titlecase.py 99.15% 0 Missing and 1 partial ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master    #6133      +/-   ##
==========================================
+ Coverage   67.49%   67.71%   +0.22%     
==========================================
  Files         136      137       +1     
  Lines       18533    18652     +119     
  Branches     3126     3148      +22     
==========================================
+ Hits        12508    12630     +122     
+ Misses       5361     5359       -2     
+ Partials      664      663       -1     
Files with missing lines Coverage Δ
beetsplug/titlecase.py 99.15% <99.15%> (ø)

... and 2 files with indirect coverage changes

🚀 New features to boost your workflow:
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Copy link
Contributor

@semohr semohr left a comment

Choose a reason for hiding this comment

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

This looks great to me! I added some minor comment.

We might want to cleanup the git commit history a bit. E.g. there are quite a few merges from master which seem unnecessary to me. We could also do a squash, depends a bit which commit information we want to keep.

Further the poetry.lock file changed a bit more than I expected for a singular addition of the titlecase dependency. We might want to not update the other dependencies here.

Changelog entry is missing.

@henry-oberholtzer
Copy link
Member Author

We might want to cleanup the git commit history a bit. E.g. there are quite a few merges from master which seem unnecessary to me. We could also do a squash, depends a bit which commit information we want to keep.

I think we could squash and clean this up to whatever degree feels good, I'll defer to your opinion on it since you have more experience with this project.

Further the poetry.lock file changed a bit more than I expected for a singular addition of the titlecase dependency. We might want to not update the other dependencies here.

I'll double check the pyproject.toml and lock file to make sure they're not too different from the master branch, I think we might be seeing the merge in of the recent updates? It should've run with --no-update....

@semohr
Copy link
Contributor

semohr commented Nov 19, 2025

I'll double check the pyproject.toml and lock file to make sure they're not too different from the master branch, I think we might be seeing the merge in of the recent updates? It should've run with --no-update....

I just used the github diff view, it is a bit flakey recently. Should be gone after a rebase than 👍

@henry-oberholtzer
Copy link
Member Author

Think we should be good to go now - probably easier just to squash merge this, especially since it's just one whole new feature. I'll make sure to squash irrelevant commits as I go next time.

Copy link
Contributor

@semohr semohr left a comment

Choose a reason for hiding this comment

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

I just had one last look!

There is one type:ignore that is not required anymore, otherwise I'm very happy to approve this.

If you are up for, could you add a test for the imported function too:

beetsplug/titlecase.py                    120      8     44      3  92.07%   81->exit, 83, 161->157, 231-237

I don't think we will ever write one if we don't do in this PR ;)

@henry-oberholtzer
Copy link
Member Author

Got that test added. It is isn't as much of an integration test with the whole import flow, but it makes sure that the logic of the function does what it is supposed to.

@henry-oberholtzer henry-oberholtzer merged commit b902352 into beetbox:master Nov 23, 2025
14 checks passed
@henry-oberholtzer henry-oberholtzer deleted the titlecase branch November 23, 2025 18:34
@JOJ0 JOJ0 added the plugin Pull requests that are plugins related label Jan 10, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

newplugin plugin Pull requests that are plugins related

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Fix first letter caps

3 participants