Commit graph

13247 commits

Author SHA1 Message Date
henry
cb0d15ff84
Remove gmusic plugin (#6192)
Sometimes it is time to let go of old things:
This PR removes the old gmusic plugin and all related docs. 

---

The google play music service was shutdown in 2020 and already
deprecated in beets 1.6.0.
2025-11-28 12:19:10 -08:00
Sebastian Mohr
5cc7dcfce7 Sometimes it is time to let go of old things:
This removes old references and docs for the old gmusic plugin.
2025-11-27 21:58:29 +01:00
henry
b4f0dbf53b
Fix recursion in inline plugin when item_fields shadow DB fields (#6115) (#6174)
## Description

Fixes [#6115](https://github.com/beetbox/beets/issues/6115).

When an inline field definition shadows a built-in database field (e.g.,
redefining `track_no` in `item_fields`), the inline plugin evaluates the
field template by constructing a dictionary of all item values.
Previously, this triggered unbounded recursion because `_dict_for(obj)`
re-entered `__getitem__` for the same key while evaluating the computed
field.

This PR adds a per-object, per-key evaluation guard to prevent re-entry
when the same inline field is accessed during expression evaluation.
This resolves the recursion error while preserving normal computed-field
behavior.

A regression test
(`TestInlineRecursion.test_no_recursion_when_inline_shadows_fixed_field`)
verifies that `$track_no` evaluates correctly (`'01'`) when shadowed.

## To Do

- [x] ~Documentation.~
- [x] ~Changelog.~
- [x] Tests.
2025-11-25 16:25:25 -08:00
Gabriel Push
cd8e466a46 Updated changelog documentation 2025-11-25 19:18:10 -05:00
Gabriel Push
51164024c0 Fixed unit tests import 2025-11-25 18:41:31 -05:00
Gabriel Push
c59134bdb6 Fixed unit tests import 2025-11-25 18:38:09 -05:00
Gabriel Push
e827d43213 Fixed unit tests 2025-11-25 18:35:03 -05:00
Gabriel Push
eb11537328
Merge branch 'master' into gabepush-test-fix 2025-11-25 18:16:08 -05:00
Gabriel Push
13f95dcf3a Added documentation header 2025-11-25 18:15:18 -05:00
henry
b902352139
New Plugin: Titlecase (#6133)
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](https://pypi.org/project/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.

- [x] Documentation. (If you've added a new command-line flag, for
example, find the appropriate page under `docs/` to describe it.)
- [x] Changelog. (Add an entry to `docs/changelog.rst` to the bottom of
one of the lists near the top of the document.)
- [x] Tests. - Not 100% coverage, but didn't see a lot of other plugins
with testing for import stages.
2025-11-23 10:34:05 -08:00
Sebastian Mohr
d446e10fb0
Add album template value in ftintitle plugin (#6164)
## Description

I was hoping to use the functionality from `ftintitle` to set the path's
album artist as the main artist, but that wasn't possible, so I added a
template value `album_artist_no_feat`.
2025-11-21 18:42:06 +01:00
Sebastian Mohr
ba18ee2f14 Added comment for deprecation in 3.0.0. 2025-11-21 18:31:59 +01:00
asardaes
be0b71043c Revert "Remove class variables for template fields and funcs"
This reverts commit a7033fe63b.
2025-11-21 18:31:59 +01:00
asardaes
23a19e9409 Remove class variables for template fields and funcs 2025-11-21 18:31:59 +01:00
asardaes
2eff2d25f5 Improve typing for template fields and funcs 2025-11-21 18:31:59 +01:00
asardaes
9c37f94171 Add album template value in ftintitle plugin 2025-11-21 18:31:59 +01:00
Gabriel Push
c0ca045c20
Merge branch 'master' into gabepush-test-fix 2025-11-20 16:15:59 -05:00
Gabriel Push
ba45fedde5 Fix inline recursion test formatting 2025-11-20 16:09:01 -05:00
Gabriel Push
aced802c56 Fix recursion in inline plugin when item_fields shadow DB fields (#6115) 2025-11-20 15:57:22 -05:00
Sebastian Mohr
f79c125d15
Catch ValueError when beetsplug.bpd cannot be imported (#6170)
Catch ValueError when setting gst required version

`pytest.importorskip` is used to catch the case when beetsplug.bpd cannot
be imported. On macOS, the `gi` module was able to be imported, but when
trying to specify `gi.require_version`, a `ValueError` is raised about
Gst being unavailable. pytest does not catch this `ValueError` during
`importskip` as it is not an `ImportError`, and thus the test suite
errors during the test collection phase.

With this change, we catch the ValueError, and re-raise it as an
`ImportError` and pytest gracefully skips those tests.

Fixes #3324
2025-11-19 12:49:07 +01:00
Ognyan Moore
aa2dc9005f
Catch ValueError when setting gst required version
pytest.importskip is used to catch the case when beetsplug.bpd cannot be
imported. On macOS, the gi module was able to be imported, but when
trying to specify `gi.require_version`, a ValueError is raised about
Gst being unavailable. pytest does not catch this ValueError during
importskip as it is not an ImportError, and thus the test suite errors
during the test collection phase.

With this change, we catch the ValueError, and re-raise it as an
ImportError and pytest gracefully skips those tests.
2025-11-19 14:43:30 +03:00
Sebastian Mohr
88ca0ce1fb
Plugins/web: fix endpoints /…/values/… (#6158)
Following #4709 and #5447, the web plugin used single-quotes (ie. string
litteral) in the SQL query for table columns.

Thus, for instance, the query `GET /item/values/albumartist` would
return the litteral "albumartist" instead of a list of unique album
artists.

This prevents the Mopidy beets integration from working, returning the
single artist "albumartist".
2025-11-17 10:21:31 +01:00
Théophile Bastian
189fedb008 Web plugin: add type hint for g.lib 2025-11-15 21:02:43 +01:00
Théophile Bastian
666c412b0e plugins/web: fix endpoints /…/values/…
Following #4709 and #5447, the web plugin used single-quotes (ie. string
litteral) in the SQL query for table columns. Thus, for instance, the query
`GET /item/values/albumartist` would return the litteral "albumartist"
instead of a list of unique album artists.
2025-11-15 21:02:38 +01:00
Sebastian Mohr
07445fdd07
Fix import --from-logfile (#6161)
Fixes "none of the paths are importable" error that was accidentally
introduced in 4260162d4

4260162d44 (diff-e324b20657a7d6b43b8b7aeb5754b96774f5062294b5ba7f1e3062845e9e7044R1382-R1390)
2025-11-13 19:32:19 +01:00
J0J0 Todos
97bc0b3b8c Changelog for #6161 2025-11-13 19:26:18 +01:00
J0J0 Todos
2ef77852b7 Fix import --from-logfile
Fixes "none of the paths are importable" error with any valid import log
file that was accidentally introduced in commit 4260162d4
2025-11-13 19:26:18 +01:00
Šarūnas Nejus
e326aafac0
Allow selecting either tags or genres in the includes, defaulting to genres (#5874)
Genres is a filtered list based on what musicbrainz considers a genre,
tags are all the user-submitted tags. [1]

1.
https://musicbrainz.org/doc/MusicBrainz_API#:~:text=Since%20genres%20are,!).
2025-11-12 21:40:02 +00:00
Aidan Epstein
672bf0bf41 Add tests. 2025-11-11 17:08:46 -08:00
Aidan Epstein
d7636fb0c3 Apply suggestions from code review
Co-authored-by: Šarūnas Nejus <snejus@protonmail.com>
2025-11-11 13:18:51 -08:00
Aidan Epstein
9e7d5debdc Allow selecting either tags or genres in the includes, defaulting to genres
Genres is a filtered list based on what musicbrainz considers a genre,
tags are all the user-submitted tags. [1]

1. https://musicbrainz.org/doc/MusicBrainz_API#:~:text=Since%20genres%20are,!).

Also apply suggestions from code review

Co-authored-by: Šarūnas Nejus <snejus@protonmail.com>
2025-11-11 20:01:37 +00:00
Sebastian Mohr
f3da80e512
FIX: Dereference symlinks before hardlinking (#5684)
When creating a hardlink, either during import or `beet convert`, if the
origin of the hardlink was a symlink, that symlink used to be directly
copied. This could create broken symlinks if the origin symlink was
relative, and in either case, probably wasn't the user's desired
behavior.

This change de-references all symlinks before creating a hardlink, such
that the end result is a normal file with the same inode as the original
file. See #5676 for more discussion about the original issue.

Fixes #5676
2025-11-11 17:07:47 +01:00
Emi Katagiri-Simpson
29a5b06f67
Merge remote-tracking branch 'upstream/master' into dereference-symlinks-while-hardlinking 2025-11-11 07:58:10 -05:00
Šarūnas Nejus
3a72d85c5e
Drop support for Python 3.9 (#6144)
Drop support for Python 3.9 and pyupgrade the codebase.

Dependency upgrades:

<img width="644" height="1017" alt="image"
src="https://github.com/user-attachments/assets/e5be110b-66fb-4373-8413-e09a56ba54bc"
/>
2025-11-11 04:09:46 +00:00
Šarūnas Nejus
bef249e616
Fix format-docs command 2025-11-11 04:03:52 +00:00
Šarūnas Nejus
881549e83c
Enable all pyupgrade lint rules 2025-11-08 12:09:52 +00:00
Šarūnas Nejus
ffa70acad9
Ignore pyupgrade blame 2025-11-08 12:09:52 +00:00
Šarūnas Nejus
d486885af3
pyupgrade Python 3.10 2025-11-08 12:09:52 +00:00
Šarūnas Nejus
dc33932871
Update python version references 2025-11-08 12:09:52 +00:00
Šarūnas Nejus
a7830bebae
Update python requirement and dependencies 2025-11-08 11:55:20 +00:00
Šarūnas Nejus
d64efbb6c1
Upgrade deps before upgrade 2025-11-08 11:55:20 +00:00
Emi Katagiri-Simpson
b405d2fded
Migrate os calls to pathlib calls in hardlink util function
See discussion here: https://github.com/beetbox/beets/pull/5684#discussion_r2502432781
2025-11-07 15:05:56 -05:00
henry
29b9958626
BUG: Wrong path edited when running config -e (#5685)
As per #5652, `beet --config <path> config -e` edited the default config
path, even though that's not the config that would be used by beets.

It seems like this was the result of a deliberate short-circuit in
[`_raw_main()`](c2de6feada/beets/ui/__init__.py (L1832)).
The short-circuit prevents malformed configs from causing a crash before
opening the editor, but also prevents the setup function from loading
the custom config at all.

The solution used here is to just expose the CLI options to
`edit_config()`, so that it can use the custom config path if its set. I
also suspect that the branch in
[`config_func()`](c2de6feada/beets/ui/commands.py (L2354))
which is getting short circuited is actually unreachable, but I left it
in with a note just in case.

Fixes #5652

## To Do

- [x] ~~Documentation~~ (N/A)
- [X] Changelog
- [X] Tests
2025-11-07 11:51:26 -08:00
henry
81f10729e1
Merge branch 'master' into edit-custom-config 2025-11-07 11:40:50 -08:00
Sebastian Mohr
7cca07d2c3
Accept lyrics source as a string (#6149)
## Description

Fixes #5962.

The fix was shared in the issue. Now it uses ```as_str_seq``` similarly
to other plugins.
2025-11-07 10:40:35 +01:00
Ratiq Narwal
26a8e164d5 Remove newline character between list points 2025-11-06 18:10:48 -08:00
Ratiq Narwal
f77c03ed90 Remove unnecessary space 2025-11-06 17:58:25 -08:00
Ratiq Narwal
60ad6dc503 Fix changelog formatting 2025-11-06 17:41:21 -08:00
Emi Katagiri-Simpson
0e74605efd
Merge remote-tracking branch 'upstream/master' into dereference-symlinks-while-hardlinking 2025-11-06 20:30:40 -05:00
Ratiq Narwal
a7becf8490 Improve changelog 2025-11-06 17:29:33 -08:00