Commit graph

12768 commits

Author SHA1 Message Date
Šarūnas Nejus
452644bbf3
Remove assert_lib_dir_empty 2025-07-09 09:21:49 +01:00
Šarūnas Nejus
e6d5f73964
Use pathlib.Path in test_convert 2025-07-09 09:21:49 +01:00
Šarūnas Nejus
31dbd51222
Replace assertExists and assertNotExist 2025-07-09 09:21:49 +01:00
Šarūnas Nejus
c706f62fb2
Replace assertExists in test_files 2025-07-09 09:21:48 +01:00
Šarūnas Nejus
e40c7fd71c
Introduce Album.art_filepath to simplify existence checks 2025-07-09 09:21:47 +01:00
Šarūnas Nejus
d017270196
Use pathlib.Path in test_smartplaylist.py 2025-07-09 09:17:14 +01:00
Šarūnas Nejus
edd3df99ba
Introduce TestHelper.temp_dir_path 2025-07-09 09:17:14 +01:00
Šarūnas Nejus
9e4b117454
Speed up tests that only need IOMixin 2025-07-09 09:17:13 +01:00
Šarūnas Nejus
605cea9bdc
Rip away io stuff from TestHelper to IOMixin 2025-07-09 09:17:13 +01:00
Šarūnas Nejus
a815305fcd
Remove decargs and other references to Python 2 (#5859)
This PR modernizes the codebase by removing Python 2 compatibility code
and simplifying several areas:

- Deleted `BytesQuery` class (replaced with `PathQuery`)
- Removed `decargs()` function that was a no-op in Python 3
- Simplified `print_()` function signature and implementation
- Removed coding-related workarounds in various modules
2025-07-09 02:56:31 +01:00
Šarūnas Nejus
afe97cf31e
Do not assign args to query 2025-07-08 11:37:34 +01:00
Šarūnas Nejus
4260162d44
Remove all Python 2 references 2025-07-08 11:37:34 +01:00
Šarūnas Nejus
7cada1c9f8
Remove no-op decargs 2025-07-08 11:37:33 +01:00
Sebastian Mohr
e6016c125b Added changelog entry. 2025-07-08 11:38:12 +02:00
Sebastian Mohr
9cd1a50785 Added git blame ignore 2025-07-08 11:38:12 +02:00
Sebastian Mohr
98377ab5f6 Split library file into different files inside library folder. 2025-07-08 11:38:12 +02:00
Šarūnas Nejus
3d364e4666
Only consider release collections in mbcollection plugin (#5856)
Currently, `mbcollection` takes the first collection it finds (if the
user does not explicitely indicates one in the configuration).

The problem is that the user may have collections of types that we are
not interested in (e.g. recording collections, artist collections,
etc.).

Since the `get_collections` response returns the collections types, we
can only keep the `release` collections.
2025-07-07 16:31:05 +01:00
Nicolas Mémeint
eb497eee1a Only consider release collections in mbcollection plugin 2025-07-07 13:25:25 +02:00
Šarūnas Nejus
f461651797
Minor improvements to deezer plugin typing. (#5814)
Added some more typehints to deezer plugin.

I know, it is properly not used much and we don't even have test for the
deezer plugin but I want to make this a bit more maintainable, mainly to
prepare for https://github.com/beetbox/beets/pull/5787 and make
migration a bit easier.
2025-07-07 12:14:20 +01:00
Sebastian Mohr
50604b0510 Fixed linting issue after rebase. 2025-07-07 11:40:51 +02:00
Sebastian Mohr
04a3dd2169 Adjusted typehint for search api. Removed optional none from filter. 2025-07-07 11:37:02 +02:00
Sebastian Mohr
1f15598294 Moved constants back to top. 2025-07-07 11:37:02 +02:00
Sebastian Mohr
6ab0f8d3a7 Removed old docstring. 2025-07-07 11:37:02 +02:00
Sebastian Mohr
085b89b70b Minor improvements to deezer plugin typing. 2025-07-07 11:37:02 +02:00
Sebastian Mohr
59ecfd9a49 Moved fetch_data and _get_track function. 2025-07-07 11:36:38 +02:00
Martin Atukunda
a64acf8aa2
Merge branch 'master' into feature/add-artist-to-item-entry-template 2025-07-07 09:35:15 +03:00
J0J0 Todos
a01e603492
Support m3u8 ending in playlist plugin (#5829)
m3u8 files are technically supported in the playlist plugin, only the
difference in the file ending prevented usage of such files.
2025-07-07 08:13:16 +02:00
J0J0 Todos
cf557fb41b playlist: Use pathlib.Path and add types for is_m3u_file()
Co-authored-by: Šarūnas Nejus <snejus@protonmail.com>
2025-07-07 08:05:47 +02:00
J0J0 Todos
257991c73d playlist: Changelog for #5829 2025-07-07 08:05:45 +02:00
J0J0 Todos
dcd3a9f7f4 playlist: Support m3u8 ending in playlist plugin 2025-07-07 07:58:59 +02:00
Martin Atukunda
b96f7a5068
move changelog note to the Unreleased section 2025-07-07 08:34:12 +03:00
Šarūnas Nejus
0de27cbfb3
Merge branch 'master' into feature/add-artist-to-item-entry-template 2025-07-06 16:43:37 +01:00
Šarūnas Nejus
d5f87264e9
Rewrite and speed up query tests (#5813)
Previously:

```sh
Poe => pytest -p no:cov test/test_query.py --durations=10
=============================================================================== test session starts ===============================================================================
platform linux -- Python 3.9.20, pytest-8.3.5, pluggy-1.5.0
cachedir: /tmp/pytest_cache
rootdir: /home/sarunas/repo/beets
configfile: setup.cfg
plugins: anyio-4.9.0, xdist-3.6.1, requests-mock-1.12.1, flask-1.3.0
collected 133 items                                                                                                                                                               

test/test_query.py .....................................................................................................................................                 [133/133]

============================================================================== slowest 10 durations ===============================================================================
0.13s call     test/test_query.py::NotQueryTest::test_type_none
0.12s call     test/test_query.py::NotQueryTest::test_fast_vs_slow
0.11s call     test/test_query.py::GetTest::test_singleton_0
0.11s call     test/test_query.py::NotQueryTest::test_type_substring
0.11s call     test/test_query.py::RelatedQueriesTest::test_filter_items_by_common_field
0.11s call     test/test_query.py::RelatedQueriesTest::test_get_items_filter_by_album_field
0.11s call     test/test_query.py::NotQueryTest::test_type_boolean
0.11s call     test/test_query.py::NotQueryTest::test_type_or
0.11s call     test/test_query.py::NotQueryTest::test_type_numeric
0.11s call     test/test_query.py::NotQueryTest::test_type_true
=============================================================================== 133 passed in 9.94s ===============================================================================
```

Now:
```sh
Poe => pytest -p no:cov test/test_query.py --durations=10
=============================================================================== test session starts ================================================================================
platform linux -- Python 3.9.20, pytest-8.3.5, pluggy-1.5.0
cachedir: /tmp/pytest_cache
rootdir: /home/sarunas/repo/beets
configfile: setup.cfg
plugins: anyio-4.9.0, xdist-3.6.1, requests-mock-1.12.1, flask-1.3.0
collected 129 items                                                                                                                                                                

test/test_query.py .................................................................................................................................                      [129/129]

=============================================================================== slowest 10 durations ===============================================================================
0.10s setup    test/test_query.py::TestRelatedQueries::test_related_query[match-album-with-item-field-query]
0.09s setup    test/test_query.py::TestGet::test_get_query[''-['first', 'second', 'third']]
0.09s setup    test/test_query.py::TestPathQuery::test_explicit[exact-match]
0.09s setup    test/test_query.py::TestQuery::test_value_type[parse-true]
0.08s setup    test/test_query.py::TestDefaultSearchFields::test_search[album-match-album]
0.02s call     test/test_query.py::TestGet::test_query_logic[SubstringQuery('album', 'ba', fast=True)-{'third'}]
0.02s call     test/test_query.py::TestGet::test_query_logic[NoneQuery('rg_track_gain', True)-set()]
0.02s call     test/test_query.py::TestGet::test_query_logic[NumericQuery('year', '2001..2002', fast=True)-{'third'}]
0.02s call     test/test_query.py::TestGet::test_query_logic[RegexpQuery('artist', re.compile('^t'), fast=True)-{'first'}]
0.02s call     test/test_query.py::TestGet::test_query_logic[OrQuery([BooleanQuery('comp', 1, fast=True), NumericQuery('year', '2002', fast=True)])-{'third'}]
=============================================================================== 129 passed in 2.53s ================================================================================
```
2025-07-06 16:24:46 +01:00
Šarūnas Nejus
443ed578dc
Standardize abstract methods for coverage 2025-07-06 16:15:30 +01:00
Šarūnas Nejus
09b22949c0
Refactor test_query
And rewrite test_query.py
2025-07-06 16:15:30 +01:00
Šarūnas Nejus
2c6f314f4f
Replace assertNegationProperties 2025-07-06 16:15:29 +01:00
Šarūnas Nejus
2b306de0fe
Replace assertInResult and assertNotInResult 2025-07-06 16:15:29 +01:00
Šarūnas Nejus
7165b04a22
Move queries and types to respective modules (#5775)
This PR moves query and type definitions away from `library.py` to
`dbcore` to improve modularity and organization.

**Key Changes:**

*   **Query and Type Relocation:**
* `PathQuery` and `SingletonQuery` moved from `beets.library` to
`beets.dbcore.query`.
* `DateType`, `PathType` (and its variants `NullPathType`),
`MusicalKey`, and `DurationType` moved from `beets.library` to
`beets.dbcore.types`.
* The `BLOB_TYPE` definition was moved from `beets.library` to
`beets.dbcore.query` and then referenced in `beets.dbcore.types`.
* The `human_seconds_short` utility function was moved from `beets.ui`
to `beets.util` due to circular dependency.
*   **Test Modernization:**
* The `PathQueryTest` class in `test/test_query.py` has been rewritten
to use `pytest.mark.parametrize` for more concise and readable test
cases.
* **Import Updates:** All internal references to these moved classes and
functions have been updated across the codebase.
2025-07-06 16:14:46 +01:00
Šarūnas Nejus
9d088ab69f
Move human formatting functions under beets.util.units 2025-07-06 16:09:50 +01:00
Šarūnas Nejus
8937978d5f
Refactor PathQuery and add docs 2025-07-06 16:09:50 +01:00
Šarūnas Nejus
45f92ac641
Remove case_sensitive from PathQuery.__init__
The case_sensitive parameter was only used in tests, which now use
monkeypatch to control the behavior of util.case_sensitive() instead.
This simplifies the PathQuery initialization logic while maintaining
test coverage.
2025-07-06 16:09:50 +01:00
Šarūnas Nejus
a38918380d
Rewrite path query tests using pytest.mark.parametrize
And remove `force_implicit_query_detection` attribute from `PathQuery`
class.
2025-07-06 16:09:49 +01:00
Šarūnas Nejus
b40ce836d5
Add NullPathType and types to PathType 2025-07-06 16:09:49 +01:00
Šarūnas Nejus
1a045c9166
Copy paste query, types from library to dbcore 2025-07-06 16:03:46 +01:00
Martin Atukunda
54e76368d0
Avoid rendering extraneous separators
handling cases where the artist or album data might be missing to avoid
rendering extraneous separators. Suggested by Copilot.
2025-07-06 12:22:02 +03:00
Martin Atukunda
8ea7346575
Merge branch 'master' into feature/add-artist-to-item-entry-template 2025-07-06 12:14:48 +03:00
J0J0 Todos
2a896d48b9
Add --remove option to duplicates plugin (#5832)
The duplicates plugin currently only supports deleting files entirely,
sometimes it's desired to only fix the library and keep files in place.
This PR adds this possibility.
2025-07-06 08:56:45 +02:00
J0J0 Todos
7c22cd635c duplicates: Add changelog for --remove option 2025-07-05 07:24:26 +02:00
J0J0 Todos
47eee070ba duplicates: remove or delete options mutually exclusive
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
2025-07-05 07:22:33 +02:00
J0J0 Todos
549847bfd8 duplicates: Add docs for --remove option 2025-07-05 07:22:28 +02:00