Commit graph

13185 commits

Author SHA1 Message Date
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
beda6fc71b
Add mbpseudo plugin for pseudo-release proposals (#5888)
## Description
Adds the new `mbpseudo` plugin, that proactively searches for pseudo-releases during import and
adds them as candidates. Since it also depends on MusicBrainz, there are
some special considerations for the default logic (which is now a plugin
as well). However, at the very least it expects a list of desired [names
of scripts](https://en.wikipedia.org/wiki/ISO_15924) in the
configuration, for example:

```yaml
mbpseudo:
    scripts:
    - Latn
```

It will use that to search for pseudo-releases that match some of the
desired scripts, but will only do so if the input tracks match against
an official release that is not in one of the desired scripts.

## Standalone Usage

This would be the recommended approach, which involves disabling the
`musicbrainz` plugin. The `mbpseudo` plugin will manually delegate the
initial search to it. Since the data source of official releases will
still match MusicBrainz, weights are still relevant:

```yaml
mbpseudo:
    source_weight: 0.0
    scripts:
    - Latn

musicbrainz:
    source_weight: 0.1
```

A setup like that would ensure that the pseudo-releases have slightly
more preference when choosing the final proposal.

## Combined Usage

I initially thought it would be important to coexist with the
`musicbrainz` plugin when it's enabled, and reuse as much of its data as
possible to avoid redundant calls to the MusicBrainz API. I have the
impression this is not really important in the end, and maybe things
could be simplified if we decide that both plugins shouldn't coexist.

As it is right now, using both plugins at the same time would still
work, but it'll only avoid redundancy if `musicbrainz` emits its
candidates before `mbpseudo`, ~which is why I modified the
plugin-loading logic slightly to guarantee ordering. I'm not sure if you
think this could be an issue, but I think the `musicbrainz` plugin is
also used by other plugins and I can imagine it's good to guarantee the
order that is declared in the configuration?~

If the above is fulfilled, the `mbpseudo` plugin will use listeners to
intercept data emitted by the `musicbrainz` plugin and check if any of
them have pseudo-releases that might be desirable.
2025-11-03 13:10:10 +01:00
asardaes
c087851770 Prefer alias if import languages not defined 2025-11-01 13:52:14 +01:00
asardaes
040b2dd940 Add custom_tags_only mode for mbpseudo plugin 2025-11-01 13:52:14 +01:00
asardaes
cb758988ed Fix data source penalty for mbpseudo 2025-11-01 13:52:14 +01:00
asardaes
defc602310 Update docs for mbpseudo plugin 2025-11-01 13:52:11 +01:00
asardaes
160297b086 Add tests for mbpseudo plugin 2025-11-01 13:51:34 +01:00
asardaes
229651dcad Update mbpseudo implementation for beets 2.5 2025-11-01 13:51:34 +01:00
asardaes
a42cabb477 Don't use Optional 2025-11-01 13:51:34 +01:00
asardaes
ab5705f444 Reimplement mbpseudo plugin inheriting from MusicBrainzPlugin 2025-11-01 13:51:34 +01:00
asardaes
79f691832c Use Optional 2025-11-01 13:51:34 +01:00
asardaes
0d90649029 Fix linting issues 2025-11-01 13:51:34 +01:00
asardaes
f3934dc58b Add mbpseudo plugin 2025-11-01 13:51:34 +01:00
asardaes
ac0b221802 Revert "Use pseudo-release's track titles for its recordings"
This reverts commit f3ddda3a422ffbe06722215abeec63436f1a1a43.
2025-11-01 13:51:34 +01:00
asardaes
017930dd99 Use pseudo-release's track titles for its recordings 2025-11-01 13:51:34 +01:00
henry
584329e7f0
Spotify: gracefully handle deprecated audio-features API (#6138)
Spotify has deprecated many of its APIs that we are still using, wasting
calls and time on these API calls; also results in frequent rate limits.

This PR introduces a dedicated `AudioFeaturesUnavailableError` and
tracks audio feature availability with an `audio_features_available`
flag. If the audio-features endpoint returns an HTTP 403 error, raise a
new error, log a warning once, and disable further audio-features
requests for the session.

The plugin now skips attempting audio-features lookups when disabled
(avoiding repeated failed calls and rate-limit issues).

Also, update the changelog to document the behavior.


## To Do

- [x] Changelog. (Add an entry to `docs/changelog.rst` to the bottom of
one of the lists near the top of the document.)
2025-10-31 18:54:49 -07:00
Alok Saboo
7724c661a4 hopefully...this works 2025-10-30 10:49:51 -04:00
Alok Saboo
447511b4c8 ruff formating 2025-10-30 10:47:07 -04:00
Alok Saboo
8305821488 more lint 2025-10-30 10:34:30 -04:00
Alok Saboo
4302ca97eb resolve sorucery issue....make it thread safe 2025-10-30 10:29:07 -04:00
Alok Saboo
e6c70f06c1 lint 2025-10-30 10:20:53 -04:00
Alok Saboo
0d11e19ecf Spotify: gracefully handle 403 from deprecated audio-features API
Add a dedicated AudioFeaturesUnavailableError and track audio-features
availability with an audio_features_available flag. If the audio-features
endpoint returns HTTP 403, raise the new error, log a warning once, and
disable further audio-features requests for the session. The plugin now
skips attempting audio-features lookups when disabled (avoiding repeated
failed calls and potential rate-limit issues).

Also update changelog to document the behavior.
2025-10-30 10:13:54 -04:00
J0J0 Todos
9608ec0925
Add new plugin ImportSource (#4748)
A new plugin that tracks the original source paths of imported media and optionally allows cleaning up those source files.
2025-10-29 08:56:54 +01:00
J0J0 Todos
02a662e923 importfeeds: Fix tests
- Use self.config instead of global config, which was interfering whith
  other plugin tests (test_importsource) when run alongside (eg in CI)
- Rename test
2025-10-29 08:50:01 +01:00
Doron Behar
e181ebeaae importsource: Add new plugin (+docs/tests/changlog) 2025-10-29 08:50:01 +01:00
Sebastian Mohr
adc0d9e477
docs: Rewrite Handling Paths chapter (pathlib vs utils) (#6116)
## Description

Updates the docs chapter "Handling Paths" describing how to modernise
old code and intentionally includes historical details. Examples should
further guide contributors while refactoring. 

Also moved the guide from the contribution guide into the dev docs.
2025-10-28 13:02:25 +01:00
J0J0 Todos
528d5e67e5 docs: Changelog for Handling Paths move/rewrite 2025-10-28 12:56:04 +01:00
J0J0 Todos
d283a35a10 docs: Rewrite Handling Paths chapter (pathlib) 2025-10-28 12:56:04 +01:00
J0J0 Todos
f6ba5bcf01 docs: Move "Handling Paths" to "Developers" chapter 2025-10-28 12:56:04 +01:00
Šarūnas Nejus
52b102cfa8
Add support for Python 3.13 (#6132)
Fixes #5575
Fixes #5822
Fixes #6082
Fixes #6026

### Python 3.13 compatibility
- Updated `librosa` dependency from `^0.10.2.post1` to `>=0.11` where a
bug with `numpy` types is fixed.
- Updated transitive `audioread` dependency which now pulls in
`standard-aifc`, `standard-sunau`, and `audioop-lts` packages for Python
3.13 and above.

### Python 3.14 compatibility
- Python 3.14 introduced stricter requirements for input type in low
level `fnctl.ioctl` function which we used to detect the terminal width.
I replaced it with high-level, cross-platform
`shutil.get_terminal_size()`.
- I'm not adding official support yet, as I faced many issues trying to
install `librosa` dependencies on Python 3.14. It should work fine for
people that do not use `autobpm`, and it may even work for those that do
- if they have the right set of system dependencies available. We can
revise this once we drop Python 3.9 in a couple of days.
2025-10-28 10:32:38 +00:00
Šarūnas Nejus
cbd74b3167
Update confuse 2025-10-28 10:26:35 +00:00
Šarūnas Nejus
e76665bcfb
Do not support 3.14 for now, until we drop 3.9 in a couple of days 2025-10-28 10:26:34 +00:00
Šarūnas Nejus
fdc6d6e787
Revert "Try env var"
This reverts commit e30f7fbe9c.
2025-10-27 08:55:08 +00:00
Šarūnas Nejus
e30f7fbe9c
Try env var 2025-10-27 08:45:19 +00:00
Šarūnas Nejus
ec141dbfd6
Explicitly wrap partial with staticmethod for Py3.14 2025-10-27 08:23:37 +00:00
Šarūnas Nejus
77dffd551d
Add a note in the changelog 2025-10-27 08:23:37 +00:00
Šarūnas Nejus
3eb68ef830
Use cross-platform shutil.get_terminal_size to get term_width
This fixes Python 3.14 incompatibility.
2025-10-27 08:23:37 +00:00
Šarūnas Nejus
1ea3879aae
Upgrade librosa and audioread 2025-10-27 08:23:37 +00:00
J0J0 Todos
201677ae62
lastgenre: Plugin tuning log (-vvv) (#6007) 2025-10-25 17:38:42 +02:00
J0J0 Todos
4b1e5056d5 lastgenre: Document tuning log -vvv 2025-10-23 19:02:27 +02:00
J0J0 Todos
bf507cd5d4 Changelog for lastgenre tuning log #6007 2025-10-23 19:02:27 +02:00
J0J0 Todos
a8204f8cde lastgenre: -vvv tuning log helper, remove -d
Replace extended_debug config and CLI option with -vvv and add a helper
function.
2025-10-23 19:02:03 +02:00
henry
043581e0c9
Ftintitle: Continue even if albumartist and artist is the same (#6102)
## Description

This small PR allows ftintitle to process even if the artist/s in the
artist and albumartist fields are the same.

This fixes the problem with a lot of singles like [Porter Robinsons song
Shelter](https://musicbrainz.org/release/ccc261b9-e4cc-4965-81b8-7c92a5d28601)
and even [Rihanas's album
Umbrella](https://musicbrainz.org/release/60f8f1f5-485b-4637-8574-23f2bb98531f)

Without this fix the songs would end up with the feat. artist in the
artists folder-name and not the feat. in the songs filename.
Without:
`Rihanna feat. JAY‐Z\(2007) Umbrella\01 - Umbrella (radio edit).flac`
`Porter Robinson feat. Madeon\(2016) Shelter\01 - Shelter.flac`
With:
`Rihanna\(2007) Umbrella\01 - Umbrella (radio edit) feat. JAY‐Z.flac`
`Porter Robinson\(2016) Shelter\01 - Shelter feat. Madeon.flac`

I left the current way ftintitle works as the default so stuff doesn't
randomly change for users, but maybe it should is changed as the PR that
changed the ftintitle's behavour is only ~2 month old
https://github.com/beetbox/beets/pull/5943
Thoughts?

I'm also not super happy with the args name
`skip_if_artist_and_album_artists_is_the_same` so any suggestion what it
could be instead is more than welcome 😅


## To Do

<!--
- If you believe one of below checkpoints is not required for the change
you
are submitting, cross it out and check the box nonetheless to let us
know.
  For example: - [x] ~Changelog~
- Regarding the changelog, often it makes sense to add your entry only
once
reviewing is finished. That way you might prevent conflicts from other
PR's in
that file, as well as keep the chance high your description fits with
the
  latest revision of your feature/fix.
- Regarding documentation, bugfixes often don't require additions to the
docs.
- Please remove the descriptive sentences in braces from the enumeration
below,
  which helps to unclutter your PR description.
-->

- [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. (Very much encouraged but not strictly required.)
2025-10-20 17:52:36 -07:00
Jacob Danell
bb541e22c3 Lint the docs 2025-10-20 15:28:33 +02:00
Ember Light
00e3da1a92
Merge branch 'master' into ftintitle-continue-even-if-albumartist-and-artist-is-the-same 2025-10-20 15:24:43 +02:00
Jacob Danell
027b775fcd Change arg name 2025-10-20 15:22:27 +02:00
Šarūnas Nejus
c26c342cc1
feat(plugin/web): support for nexttrack keypress (#6085)
This PR adds support for nexttrack keypress in the web plugin.

It uses feature detection for the Media Session API, and then
instantiates a metadata object for the session, and adds the specific
action handler for the nexttrack keypress.
2025-10-20 00:37:41 +01:00
Šarūnas Nejus
99987b3f27
Merge branch 'master' into feature/web-handle-nexttrack 2025-10-20 00:31:46 +01:00
Šarūnas Nejus
b850516a88
Fix transaction context manager signature (#6112)
Pyrefly reported the contect manager signature of Transaction as
invalid, so I corrected it.
2025-10-20 00:20:01 +01:00
Konstantin
72d879cf82
Merge branch 'master' into fix-invalid-contextmanager 2025-10-19 19:05:35 +02:00