Commit Graph

14906 Commits

Author SHA1 Message Date
Šarūnas Nejus
4fc3df4cc5 Use r&b instead of rhytm and blues 2026-07-15 08:29:29 +01:00
Šarūnas Nejus
55fb8ad5ed Escape single quote in aliases.yaml to fix treesitter 2026-07-15 08:29:29 +01:00
Šarūnas Nejus
1cbe481c96 Replace \g<...> backrefs 2026-07-15 08:29:29 +01:00
Šarūnas Nejus
746af4f6cf Do not normalize disney to soundtrack 2026-07-15 08:29:29 +01:00
Šarūnas Nejus
b454bc013b Normalize psytrance 2026-07-15 08:29:28 +01:00
Šarūnas Nejus
6aec4b693f Handle psychedelic folk/soul 2026-07-15 08:29:12 +01:00
Šarūnas Nejus
e38d0b801c Normalize synthwave, synth-pop and synth punk 2026-07-15 08:29:12 +01:00
Šarūnas Nejus
c911d933fa Do not normalize generic genres into more specific ones 2026-07-15 08:29:11 +01:00
J0J0 Todos
0ff30094e5 minimal alternative 2026-07-05 22:59:21 +02:00
J0J0 Todos
a991a37012 Alias, tree, wl changes 2026-07-05 22:59:21 +02:00
J0J0 Todos
a3fe4cc168 Changelog for #6466 genre aliases 2026-07-05 22:59:21 +02:00
J0J0 Todos
9e438955a4 lastgenre: The default aliases file 2026-07-05 22:59:21 +02:00
J0J0 Todos
bfdb18ad1e lastgenre: Genre aliases docs; Tools chapter, More
- Document the genre alias normalization feature and the default aliases
  we ship with the plugin (by using rst "literalinclude" referring to
  aliases.yaml directly)
- Clarify what canonicalization acutually does when used without a
  whitelist enabled.
- New docs chapter "Using the right tool"
2026-07-05 22:59:21 +02:00
J0J0 Todos
fb1054a362 lastgenre: Fixes to whitelist and genres tree
This fixes some inconsistencies in spelling in the data files we ship
with the plugin as well as adds some new genres to both files that
seem to be returned often by last.fm.

Personal note: Of course changes like this always are somewhat
opinionated but it is still better to fix and streamline whatever data
files we used to ship with beets so far instead of ignoring unusable
data in them forever.

For some changes the default aliases feature helps to streamline
inconsistencies that come from last.fm already.
2026-07-05 22:59:21 +02:00
J0J0 Todos
198b16825c lastgenre: Tests for _filter_valid helper,
even though it's indirectly tested via resolve_genres tests and
elsewhere, it makes sense to keep them to help with future refactoring.
2026-07-05 22:59:21 +02:00
J0J0 Todos
cc0eec99ee lastgenre: Tests for genre alias normalization 2026-07-05 22:59:17 +02:00
J0J0 Todos
4af91aadb8 lastgenre: Sync instance var naming
client and main plugin classes use the same names for instance
variables now
2026-07-05 22:06:19 +02:00
J0J0 Todos
1610306b82 lastgenre: Genre aliases; Refactoring
- Genre alias normalization feature implementation
- Extend and simplify _filter_valid()
- Remove drop_ignored_genres()
- More smaller ignorelist related refactoring
2026-07-05 22:06:19 +02:00
Šarūnas Nejus
94ef7d8d1f typing: add types to beets.util and beets.test.helper (#6805)
I've started working on migrating the codebase to `pathlib.Path` and
this is the very first step: fully type `beets.util` and
`beets.test.helper`. Next, I will me migrating tests to use
`pathlib.Path`.

First half of #6808.

- Extracts shared path/temp-directory behavior into `PathsMixin`, and
splits import-specific test setup into `ImporterMixin`. This makes
`beets.test.helper` more modular and gives test helpers a clearer
inheritance structure.

- Updates `TestHelper` and import helpers to use those smaller mixins,
while keeping existing test behavior intact. The main architectural
effect is better separation between core test setup, filesystem helpers,
and importer-specific utilities.

- Tightens typing across `beets.test.helper` and `beets.util`,
especially around path handling. `beets.util` now accepts a broader set
of path types through `PathLike`/`AnyPath`, which reduces friction
between `bytes`, `str`, and `Path` usage.

- Aligns helper internals with the typed interfaces by normalizing path
handling in methods like `touch`, using typed `template(...)` entries
for importer path formats, and fixing a few return-type/inheritance edge
cases.

- High-level impact: this is mainly a typing and test-infrastructure
cleanup. It improves maintainability and type-checker accuracy without
changing production architecture or intended runtime behavior.
2026-07-05 13:03:46 +01:00
Šarūnas Nejus
fc085e790c typing: fix beets.test.helper 2026-07-05 12:58:59 +01:00
Šarūnas Nejus
29c887db5b typing: add types to beets.test.helper 2026-07-03 23:51:40 +01:00
Šarūnas Nejus
1418a80e05 typing: make path utils more flexible re path types 2026-07-03 23:51:40 +01:00
Šarūnas Nejus
f313add4ec typing: add types to beets.util 2026-07-03 23:51:40 +01:00
Šarūnas Nejus
6d11f2392b Test speedup: cache config.sources in ConfigMixin (#6772)
- Moves the expensive config setup into `ConfigMixin`, which now caches
a default `config.sources` baseline once and rebuilds isolated test
config from that baseline for each test instead of re-reading full
config every time.
- Changes the shared test config flow so the `config` fixture is now
function-scoped, giving each test and parametrized case a fresh config
by default.
- Updates affected tests such as `test/autotag/test_distance.py`,
`test/plugins/test_lastgenre.py`, and `test/plugins/test_lyrics.py` to
use the new isolated flow, since per-test config setup is no longer too
expensive.

**High-level impact**

- Improves test isolation by preventing shared config state from leaking
across tests.
- Makes the suite easier to reason about because config lifecycle is
handled in one place.
- Speeds up tests up to `2x` by avoiding repeated full config reads
while keeping fresh per-test state.

See two test modules, for example, where `ConfigMixin` is used
extensively:

### Before

```sh
$ pytest test/test_library.py
...
test/test_library.py ...............ss........................................................................................... [148/174]
..........................                                                                                                        [174/174]
...
================================= 172 passed, 2 skipped in 10.42s ==========================================================================
$ pytest test/test_importer.py
...
test/test_importer.py ..s.ss.........................................s.......s.........................................           [137/137]
...
================================= 129 passed, 8 skipped in 12.90s ==========================================================================
```

### After

```sh
$ pytest test/test_library.py
...
test/test_library.py ...............ss........................................................................................... [148/174]
..........................                                                                                                        [174/174]
...
================================== 172 passed, 2 skipped in 4.98s ==========================================================================
$ pytest test/test_importer.py
...
test/test_importer.py ..s.ss.........................................s.......s.........................................           [137/137]
...
================================== 129 passed, 8 skipped in 9.27s ==========================================================================
```
2026-07-03 22:07:53 +01:00
Šarūnas Nejus
7cf8896597 Make the global config fixture function-scoped 2026-07-03 21:21:19 +01:00
Šarūnas Nejus
7c8924d8c9 Cache config.source in ConfigMixin for test speedup 2026-07-03 21:21:19 +01:00
Šarūnas Nejus
051485be7e utils: centralise path asciification (#6733)
- This change moves path Unicode normalization and separator cleanup
into `beets.util.asciify_path()`, so path shaping now lives in one place
instead of being split between `beets.library.models` and `util`.

- Callers in `Item.destination()`, `art_destination()`, and
`tmpl_asciify()` now use the same `util.asciify_path()` flow. This makes
path generation more consistent and removes duplicate platform-specific
normalization logic from the library layer.

- High-level impact: when `asciify_paths` is enabled, all asciified
paths now get the same normalization, transliteration, and
separator-replacement behavior through one shared utility. This should
make path handling easier to reason about and safer to change later.

- Test coverage follows the architecture change: focused asciify
behavior tests move from `test/test_library.py` to `test/test_util.py`,
so `asciify_path()` is tested directly where the behavior now lives.
2026-07-03 21:20:17 +01:00
Šarūnas Nejus
8968648341 Update asciification tests 2026-07-03 18:59:19 +01:00
Šarūnas Nejus
89a831613a Centralize path asciification normalization
- Move Unicode normalization and separator replacement into util.asciify_path.
- Update library callers and relocate focused asciify tests to util coverage.
2026-07-03 18:59:19 +01:00
Šarūnas Nejus
207d4bb858 Fix importfeeds to continue on symlink creation failures (#6765)
Fixes #840.

When `importfeeds` is configured with `formats: link`, it creates a
symlink for each imported track. If that symlink can't be created — on
Windows without the privilege to make symlinks (the original report),
but also on any OS when the destination directory isn't writable or the
filesystem doesn't support symlinks — `beets.util.link()` raises
`FilesystemError`. That exception wasn't caught, so it propagated out of
the import pipeline and aborted the entire `beet import` run, even
though the tracks had already been imported into the library.

This wraps the `link()` call in `ImportFeedsPlugin._record_items()` in
`try/except FilesystemError`, logs a per-item warning, and continues
with the remaining items — so a failed symlink is skipped rather than
fatal. This is the "catch and skip" behaviour suggested in the issue
thread. It catches `FilesystemError` (not `OSError`, which `util.link()`
wraps) and mirrors the existing handling in `beetsplug/playlist.py` and
the fetchart fix (#6193).

Adds five regression tests (warn-and-continue, that remaining items are
still linked, that only `FilesystemError` is caught, and that a
successful link still creates the symlink). Also verified manually: with
a read-only feeds directory, `beet import` now finishes with a warning
(exit `0`) instead of aborting (exit `1`), and the track is still
imported.
2026-07-03 18:38:10 +01:00
Temitope S Olugbemi
65a01c2c2a fix(importfeeds): keep import going when a symlink can't be created
When `formats` includes `link`, importfeeds creates a symlink per imported
item. A failed symlink (lacking privilege on Windows, a read-only directory, or
a filesystem without symlink support) raised beets.util.FilesystemError out of
the import pipeline and aborted the whole `beet import` run, even though the
tracks were already imported.

Catch FilesystemError around the link() call, log a per-item warning, and
continue with the remaining items. Add regression tests for the
warn-and-continue behaviour, that only FilesystemError is caught, and that a
successful link still creates the symlink. Add a changelog entry.

Fixes #840.
2026-07-03 10:26:17 -07:00
Šarūnas Nejus
c90f42dbdb test: move test modules under packages that they belong to (#6775)
- Move test files from the top-level `test/` directory into
package-specific folders like `test/dbcore/`, `test/plugins/`,
`test/util/`, and `test/extra/`.

- Keep test coverage the same, but make the test suite match the
codebase structure more closely. This makes ownership and navigation
clearer, and helps reviewers find related tests faster.

- Add the large file-move commit to `.git-blame-ignore-revs` so `git
blame` stays useful and points at real logic changes instead of this
mechanical reorganization.
2026-06-30 21:54:16 +01:00
Šarūnas Nejus
312a993332 Add last two commits to blame ignore revs 2026-06-30 21:48:43 +01:00
Šarūnas Nejus
aef9c64cb0 Move DummyIMBackend to fixtures 2026-06-30 21:48:40 +01:00
Šarūnas Nejus
900543baca Move test modules under folders that they belong to 2026-06-30 21:48:40 +01:00
Šarūnas Nejus
7002103ee4 test: split test_dbcore.py and test_files.py (#6774)
#### What changed

- Reorganized tests so they live closer to the subsystem they cover:
- query parsing tests moved from `test/test_dbcore.py` to
`test/test_queryparse.py`
- utility/path tests moved from `test/test_files.py` to
`test/test_util.py`
- Added shared lightweight db test fixtures in `beets/test/fixtures.py`,
and updated tests to import `ModelFixture1` and `SortFixture` from
there.
- Added the related refactor commits to `.git-blame-ignore-revs` so `git
blame` stays focused on real logic changes.

#### Why this matters

- The test suite is now structured by responsibility instead of growing
large mixed-purpose test files.
- Shared fixtures remove duplicate dbcore test setup and make cross-file
reuse simpler.
- This lowers coupling between test modules and makes future test
changes easier to find and review.

#### High-level impact

- Test-only refactor; no production behavior changes.
- Improves maintainability, readability, and ownership of the test
architecture.
- Keeps blame history cleaner after the test file split.
2026-06-30 21:48:23 +01:00
Šarūnas Nejus
0dd1725131 Add three commits to blame ignore revs 2026-06-30 21:40:26 +01:00
Šarūnas Nejus
816cddbfd5 Define DB fixtures in a shared place 2026-06-30 21:39:34 +01:00
Šarūnas Nejus
88202493ad Rip out queryparse tests away from test_dbcore 2026-06-30 21:39:34 +01:00
Šarūnas Nejus
b1ae461723 Rip out util tests from test_files 2026-06-30 21:39:34 +01:00
Šarūnas Nejus
8bfcfb1870 Switch to uv (#6535)
I think we've had enough of poetry so I let Claude Code migrate the code
base to `uv`. Let's see.

Fixes: #5783
2026-06-30 12:49:50 +01:00
Šarūnas Nejus
84a558dff5 Pin poethepoet below 0.47.0
See https://github.com/nat-n/poethepoet/issues/408
2026-06-30 12:44:24 +01:00
Šarūnas Nejus
4cfbb0167d Replace pipx tool installs with uv tool
- Use uv tool install for poethepoet in GitHub workflows and contributor docs.
- Recommend uv tool for isolated beets and plugin installs.
2026-06-30 12:44:24 +01:00
Šarūnas Nejus
d6a9b6d7fe Add --locked flag to all uv installs 2026-06-30 12:44:24 +01:00
Šarūnas Nejus
f8bf95e0d9 Add dev dependency group 2026-06-30 12:44:24 +01:00
Šarūnas Nejus
9ba0d723f8 Make docs a dependency group 2026-06-30 12:44:24 +01:00
Šarūnas Nejus
a3547b486c Do not attempt to install linux-specific deps on Windows 2026-06-30 12:44:24 +01:00
Šarūnas Nejus
a4e00380a8 Add a note to the changelog 2026-06-30 12:44:24 +01:00
Šarūnas Nejus
99b5da869d Replace poetry by uv 2026-06-30 12:44:21 +01:00
Sebastian Mohr
dbeba765f0 Remove logging import sideeffect (#6755)
This PR refactors configuration and logging initialization in the beets
UI layer.

Logging is no longer implicitly configured as a side effect of import;
it is now initialized explicitly during UI startup. This allows library
users to fully control logging configuration themselves, and enables
more granular logging setup based on user configuration (future PR).

It also clarifies startup order by deferring heavier initialization
until after logging is available for proper error reporting.

---
This is related to the multi-step efforts to improve logging in beets
https://github.com/beetbox/beets/issues/6553
2026-06-30 13:07:34 +02:00