Commit graph

13207 commits

Author SHA1 Message Date
Sebastian Mohr
a69f575b90 Moved config check into find_metadata_source_plugins func. 2025-11-10 18:44:21 +01:00
Sebastian Mohr
2951f38fe5 Renamed variable to use protected names. 2025-11-10 18:43:55 +01:00
Sebastian Mohr
7d088e9435 Fixed cache clear issue. 2025-11-10 18:43:55 +01:00
Sebastian Mohr
1401e22c32 Added default config and simplified proxy class. 2025-11-10 18:43:55 +01:00
Sebastian Mohr
ace14d0c62 Added a proxy to catch and handle exceptions in metadataplugins during
the autotag process.
2025-11-10 18:43:55 +01: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
Ratiq Narwal
a7becf8490 Improve changelog 2025-11-06 17:29:33 -08:00
Ratiq Narwal
e9afe069bc Accept lyrics source as a string 2025-11-06 17:19:27 -08:00
Emi Katagiri-Simpson
86a74970f9
Merge remote-tracking branch 'upstream/master' into HEAD 2025-11-06 20:11:57 -05:00
Sebastian Mohr
61a4c737ee
Refactor ui/commands.py monolith into modular structure (#6119)
## Description

This one’s a big one 🎣 Proceed with care and a bit
of time ;)

The `ui/commands.py` file had grown into an unwieldy monolith (2000+
lines) over time, so this PR breaks it apart into a modular structure
i.e. **one file per command**, plus some cleanup and reorganization
along the way.

---

###  What changed

* **Commands modularized:**
Every command (`help`, `list`, `move`, `update`, `remove`, etc.) now
lives in its own file under `ui/commands/`.
* **Support code reorganized:**
  * Utility functions moved into a separate helper module.
* `commands.py` converted into `commands/__init__.py` for better import
handling.
* The `import` command (and related helpers) moved into its own folder:
    * `importer/session.py` for import session logic
    * `importer/display.py` for display-related functions
* **Tests cleaned up:**
  * Each command’s tests now live in their own file.
  * All UI-related tests were moved into a dedicated folder for clarity.
2025-11-05 16:01:10 +01:00
Sebastian Mohr
f495a9e18d Added more descriptions to git-blame-ignore-revs file. 2025-11-05 15:54:35 +01:00
Sebastian Mohr
b3b7dc3316 Added changelog entry and git blame ignore revs. 2025-11-03 14:04:58 +01:00
Sebastian Mohr
25ae330044 refactor: moved some more imports that are only used in the commands
in their respective files. Also fixed some imports
2025-11-03 14:03:25 +01:00
Sebastian Mohr
a59e41a883 tests: move command tests into dedicated files
Moved tests related to ui into own folder.
Moved 'modify' command tests into own file.
Moved 'write' command tests into own file.
Moved 'fields' command tests into own file.
Moved 'do_query' test into own file.
Moved 'list' command tests into own file.
Moved 'remove' command tests into own file.
Moved 'move' command tests into own file.
Moved 'update' command tests into own file.
Moved 'show_change' test into test_import file.
Moved 'summarize_items' test into test_import file.
Moved 'completion' command test into own file.
2025-11-03 14:00:58 +01:00
Sebastian Mohr
59c93e7013 refactor: reorganize command modules and utils
Moved commands.py into commands/__init__.py for easier refactoring.
Moved `version` command into its own file.
Moved `help` command into its own file.
Moved `stats` command into its own file.
Moved `list` command into its own file.
Moved `config` command into its own file.
Moved `completion` command into its own file.
Moved utility functions into own file.
Moved `move` command into its own file.
Moved `fields` command into its own file.
Moved `update` command into its own file.
Moved `remove` command into its own file.
Moved `modify` command into its own file.
Moved `write` command into its own file.
Moved `import` command into its own folder, more commit following.
Moved ImportSession related functions into `importer/session.py`.
Moved import display display related functions into `importer/display.py`
Renamed import to import_ as a module cant be named import.
Fixed imports in init file.
2025-11-03 13:32:14 +01: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
Emi Katagiri-Simpson
1e1c649398
Use already generated config path in test_edit_config_with_custom_path 2025-10-28 16:56:43 -04:00
Emi Katagiri-Simpson
1a1fcbc3bc
Merge remote-tracking branch 'upstream/master' into edit-custom-config 2025-10-28 16:55:39 -04: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