Commit graph

2951 commits

Author SHA1 Message Date
Michael Krieger
dc13308784 Remove tests. Update docs. Remove unnecessary return
Remove tests.  Update docs.  Remove unnecessary return.
2025-10-14 03:17:34 +01:00
Michael Krieger
b1c87cd98c Change parameter name, add return, add tests
Change the parameter name to omit_single_disc (vs previously zero_disc_if_single_disc)

Add return of 'fields_set' so that, if triggered by the command line `beets zero`, it will still effect the item.write.

Added tests.
2025-10-14 03:17:34 +01:00
Šarūnas Nejus
3b38045d01
Only penalize multi data sources on first import 2025-10-10 20:36:33 +01:00
Šarūnas Nejus
90ca0a799a
Consider unseen tracks in data source matching 2025-10-10 20:36:33 +01:00
Šarūnas Nejus
5757579e27
Improve visibility of Distance tests failures 2025-10-10 20:36:33 +01:00
Šarūnas Nejus
e6895bb52d
Reset cached_classproperty cache for every test 2025-10-10 20:36:33 +01:00
Šarūnas Nejus
455d620ae0
Fix data source penalty application logic
The data_source penalty was not being calculated correctly because
`_get_distance` was being called for **all** enabled metadata plugins
which eventually meant that matches were being penalised needlessly.

This commit refactors the distance calculation to:
- Remove the plugin-based track_distance() and album_distance() methods
  that were applying penalties incorrectly
- Calculate data_source penalties directly in track_distance() and
  distance() functions when sources don't match
- Use a centralized get_penalty() function to retrieve plugin-specific
  penalty values via a registry with O(1) lookup
- Change default data_source_penalty from 0.0 to 0.5 to ensure
  mismatches are penalized by default
- Add data_source to get_most_common_tags() to determine the likely
  original source for comparison

This ensures that tracks and albums from different data sources are
properly penalized during matching, improving match quality and
preventing cross-source matches.
2025-10-10 20:36:33 +01:00
Šarūnas Nejus
60e0efb8ea
Make naming consistent with the field name 2025-10-10 20:36:33 +01:00
J0J0 Todos
a642609faa
Merge branch 'master' into ffnp 2025-10-06 11:06:10 +02:00
Henry
267428f0a4 Merge branch 'master' of github.com:henry-oberholtzer/beets into discogs-anv-support 2025-10-03 15:05:48 -07:00
Henry
f5acdec2b1 Update configuration format. 2025-10-03 14:44:22 -07:00
Sebastian Mohr
4782e96599
Move vfs.py to beetsplug._utils package to avoid polluting core namespace (#6017)
This PR moves the `vfs.py` module, which is only used by plugins, to
avoid polluting the main beets namespace. Also exposes the `vfs` and
`art` module from beets with a deprecation warning.
2025-10-01 12:28:18 +02:00
Henry
9371ab81ec Merge remote-tracking branch 'origin' into discogs-anv-support 2025-09-30 19:23:23 -07:00
Vrihub
5f9800ec43
Merge branch 'master' into ffnp 2025-09-30 17:41:13 +02:00
Vrihub
638afc3d2c Refactor tests using pytest 2025-09-30 15:54:33 +02:00
Sebastian Mohr
89c2e10680 Removed typealias, worked locally with mypy but does seem to cause
issues with the ci. Also python 3.9 requires unions here...
2025-09-30 13:39:49 +02:00
Sebastian Mohr
caebf185f1 Removed unused ParamSpec and added a consistency check in the tests. 2025-09-30 13:37:51 +02:00
Sebastian Mohr
461bc049a0 Enhanced custom logger typing and logging tests 2025-09-30 13:37:51 +02:00
Šarūnas Nejus
7954671c73
Mock DummyPlugin properly 2025-09-29 11:39:16 +01:00
Henry
c44c535b22 Fully parametrize testing 2025-09-28 10:49:56 -07:00
Henry
b1903417f4 Add artist credit support, artist name variation support, more flexible featured credit. 2025-09-27 14:29:25 -07:00
Henry
1cf2254e74 Merge branch 'master' into dev 2025-09-27 11:48:52 -07:00
Henry
dd57c0da2d improve flexibility of use of anv on artist tracks 2025-09-27 10:42:29 -07:00
Henry
85201a4e17 merge with master branch 2025-09-27 08:04:53 -07:00
pSpitzner
cc0024e089 Spotify tests are now consistent with quote change 2025-09-27 13:22:41 +02:00
Henry
1e677d57c1 Updates to documentation 2025-09-26 21:37:18 -07:00
Henry
0ec6689395 test updates, one case still failing 2025-09-26 17:56:25 -07:00
Henry
5a43d6add4 Testing and implemented anv method, also added Featuring customizable string 2025-09-26 16:01:33 -07:00
Henry
533aa6379b Test working, need to implement anv now 2025-09-25 22:38:02 -07:00
Henry Oberholtzer
9c8172be12 Write initial ANV test 2025-09-26 01:55:28 +02:00
Henry
b61306ea0d Fixes, test improvement, rebase to master 2025-09-25 08:39:38 -07:00
Henry
43f2d423fa testing, updated changelog 2025-09-25 08:19:46 -07:00
Henry
876c57c8b3 Featured artists extracted and appended, need to see if join needs to be variable 2025-09-25 08:19:46 -07:00
Henry
5c03672874 Test written, beginning fix 2025-09-25 08:19:46 -07:00
Šarūnas Nejus
787d9b4a40
Merge branch 'master' into discogs-disambiguation-fix 2025-09-22 21:50:34 +01:00
Henry Oberholtzer
8e644157e8 Refactor tests, adjust changelog, move config option to new features. 2025-09-22 19:47:50 +02:00
Trey Turner
042b5d64eb test(ftintitle): fix flake, massage mypy 2025-09-21 22:27:11 +01:00
Trey Turner
6ad7c5489c test(ftintitle): parameterize tests 2025-09-21 22:27:11 +01:00
Trey Turner
f0a6059685 feat(FtInTitle): support tracks by artists != album artist 2025-09-21 22:27:11 +01:00
henry
e577df0f25
Merge branch 'master' into discogs-disambiguation-fix 2025-09-21 09:34:12 -07:00
Sebastian Mohr
c991b14e7d fix test by changing patch 2025-09-21 08:04:51 -07:00
Sebastian Mohr
34114fe915 New import location for art.py 2025-09-21 08:01:48 -07:00
J0J0 Todos
2e307b519a lastgenre: Also mock try_write in test_pretend..
and add and original genre instead empty string (clarify intention of
test / readability). Remove not really necessary assert items checks.
2025-09-21 07:07:14 +02:00
Alok Saboo
9b1537f226 Add test for --pretend option in LastGenrePlugin to skip library updates 2025-09-21 07:07:14 +02:00
Sebastian Mohr
73dc8f2bc7 fix test by changing patch 2025-09-20 14:04:48 +02:00
Sebastian Mohr
a796d6d799 New import location for art.py 2025-09-20 14:01:38 +02:00
Henry
dda265dc77 Disambiguation fix implemented & tested 2025-09-19 20:46:07 -07:00
Henry Oberholtzer
24fbc566f6 initial changes, changelog adjusted, TODO: test for various artists and update docs 2025-09-20 01:58:56 +02:00
ThinkChaos
eb83058b13 style: remove extraneous pass statements 2025-09-19 21:11:51 +01:00
ThinkChaos
b0caac871a fix: enable tracebacks for "user"/custom sqlite functions
A bit niche but I tried setting my bareasc prefix to an empty string,
and was getting an obtuse error. This should help make clearer what is
happening when queries fail.

The exception is not properly raised up the stack in the first place
because it happens across 2 FFI boundaries: the DB query
(Python -> SQLite), and the custom DB function (SQLite -> Python).
Thus Python cannot forwarded it back to itself through SQLite, and it's
treated as an "unraisable" exception.

We could override `sys.unraisablehook` to not print anything for the
original exception, and store it in a global for the outer Python
interpreter to fetch and raise properly, but that's pretty hacky,
limited to a single DB instance and query at once, and risks swallowing
other "unraisable" exceptions.
Instead we just tell the user to look above for what Python prints.

Sample output:
```
Exception ignored in: <function unidecode_expect_ascii at
0x7f7fa20bb060>
Traceback (most recent call last):
  File "site-packages/unidecode/__init__.py", line 60, in
unidecode_expect_ascii
    bytestring = string.encode('ASCII')
                 ^^^^^^^^^^^^^
AttributeError: 'bytes' object has no attribute 'encode'
Traceback (most recent call last):
  File "site-packages/beets/dbcore/db.py", line 988, in query
    cursor = self.db._connection().execute(statement, subvals)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
sqlite3.OperationalError: user-defined function raised exception

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "site-packages/beets/__main__.py", line 9, in <module>
    sys.exit(main())
             ^^^^^^
  File "site-packages/beets/ui/__init__.py", line 1865, in main
    _raw_main(args)
  File "site-packages/beets/ui/__init__.py", line 1852, in _raw_main
    subcommand.func(lib, suboptions, subargs)
  File "site-packages/beets/ui/commands.py", line 1599, in list_func
    list_items(lib, decargs(args), opts.album)
  File "site-packages/beets/ui/commands.py", line 1594, in list_items
    for item in lib.items(query):
                ^^^^^^^^^^^^^^^^
  File "site-packages/beets/library.py", line 1695, in items
    return self._fetch(Item, query, sort or
self.get_default_item_sort())

^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "site-packages/beets/library.py", line 1673, in _fetch
    return super()._fetch(model_cls, query, sort)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "site-packages/beets/dbcore/db.py", line 1301, in _fetch
    rows = tx.query(sql, subvals)
           ^^^^^^^^^^^^^^^^^^^^^^
  File "site-packages/beets/dbcore/db.py", line 991, in query
    raise DBCustomFunctionError()
beets.dbcore.db.DBCustomFunctionError: beets defined SQLite function
failed; see the other errors above for details
```
2025-09-19 21:11:51 +01:00