Commit Graph
4810 Commits
Author SHA1 Message Date
Šarūnas Nejus 491eef8a8c Replace do_query with model-specific logic
This allows to define a proper return type for input_select_objects.
2026-08-18 19:50:02 +01:00
Šarūnas Nejus 7217c9dc70 typing: fix command handlers types 2026-08-18 10:46:54 +01:00
Šarūnas Nejus 10b176c866 ipfs: fix play command 2026-08-18 10:46:54 +01:00
Šarūnas Nejus a1afe5806b typing: add types to command handlers 2026-08-18 10:46:54 +01:00
Šarūnas Nejus 088d1e0311 Prefer imports from modules that provide import aliases 2026-08-18 10:46:54 +01:00
Šarūnas Nejus 5e21bd4a93 typing: remove redundant types 2026-08-18 10:46:54 +01:00
Šarūnas Nejus 66fcfe8ecd typing: fix types in beetsplug._utils.art 2026-08-18 10:46:54 +01:00
Šarūnas Nejus 4422d12326 typing: add types to beetsplug._utils.art 2026-08-18 10:46:54 +01:00
Šarūnas Nejus a66adb4c99 typing: add types to embedart 2026-08-18 10:46:54 +01:00
Šarūnas Nejus c0511526cc typing: make dbcore.db.Results a Sequence
Now we are able to type Results simply as a Sequence. This way, we can
also now use a more generic representation `Sequence[LibModel]` to refer
to *any* of the two models.
2026-08-18 10:46:53 +01:00
Šarūnas Nejus 12553051af typing: fix typing in plugins 2026-08-18 10:46:33 +01:00
Šarūnas Nejus 1969622874 typing: fix types in event handlers 2026-08-18 10:46:33 +01:00
Šarūnas Nejus 5039c8f6cf typing: add types to event handlers 2026-08-18 10:46:33 +01:00
J0J0 Todos 87633a892b lastgenre: Fix CanonTree type alias docs comment 2026-08-18 07:01:09 +02:00
J0J0 Todos c1a98e225d lastgenre: Type alias GenresWithLabel
Note that the artist stage is slightly different and GenresWithLabel does
not fit there.
2026-08-18 07:01:09 +02:00
J0J0 Todos 1059c2663d lastgenre: Rename genres to existing_genres 2026-08-18 07:01:09 +02:00
J0J0 Todos 5d651170af lastgenre: Extract original fallback stage to method 2026-08-18 07:01:09 +02:00
J0J0 Todos f202d54ea4 lastgenre: Extract complex artist stage to methods 2026-08-18 07:01:09 +02:00
J0J0 Todos d03537c0d5 lastgenre: Name vars resolved instead of result 2026-08-18 07:01:09 +02:00
J0J0 Todos e8d3143a1b lastgenre: Improve _try_resolve_stage docstring 2026-08-18 07:01:09 +02:00
J0J0 Todos 4617b08aa7 lastgenre: Extract existing genre stage
- fallback as cached property
- Leave force check in main get_genre()
- Leave fall back handling in get_genre()
2026-08-18 07:01:09 +02:00
J0J0 Todos c599cf0adf lastgenre: Conditional assign keep_genres (force mode) 2026-08-18 07:01:09 +02:00
J0J0 Todos e694f09c3f lastgenre: Move get_genre helpers to methods 2026-08-18 07:01:09 +02:00
Šarūnas Nejus d53af83386 Serialize BPD notifications per connection
- Track active notification tasks by connection so repeated dispatches do not
  send duplicate idle responses while a previous send is still draining.
- Add regression coverage for serialized notification delivery and idle command
  disconnect handling.
2026-08-17 05:05:21 +01:00
Šarūnas Nejus 9b16f67af1 Remove bluelet in favor of using asyncio in bpd plugin 2026-08-17 05:05:21 +01:00
Henry b7993d19ac fix(discogs): retry malformed search responses #6912 2026-08-15 09:53:26 -07:00
Cohen Karnell d97d78f830 Fix KeyError in Deezer track conversion when artist is missing
_get_track resolved the artist with track_data.get('contributors', [track_data['artist']]),
whose default is evaluated eagerly, so track_data['artist'] raises KeyError whenever the
artist key is absent, even when contributors is present. Guard the fallback the same way
album_for_id already does. Fixes #4339.
2026-08-14 12:02:07 -04:00
Trey Turner afd07ce5d3 fix(discogs): retry malformed search responses 2026-08-11 16:04:08 -05:00
NoDancing 5187fb31d9 tidal: restore licen[sc]e option lost in formatting 2026-08-11 00:39:31 +01:00
Sean CohanandŠarūnas Nejus 80b8c84779 tidal: comment formatting/alignment, per review
Co-authored-by: Šarūnas Nejus <snejus@protonmail.com>
2026-08-11 00:39:31 +01:00
NoDancing ecff1e7215 tidal: rework _normalize_label into a single regex
Replace the apply_transforms based pipeline with a single compiled
regex, per review.
2026-08-11 00:39:31 +01:00
NoDancing 7c139ab987 tidal: rewrite _normalize_label with regex, using apply_transforms
Return _normalize_label to regex-based logic, per review.

Uses the apply_transforms method that was previously in lyrics.py, now
moved to new module beetsplug/_utis/func.py.
2026-08-11 00:39:31 +01:00
NoDancing f387d5bb4a tidal: rewrite _normalize_label without regex per review
Replace the regex-based function with string methods, per review
feedback.

Also fixes a potential bug with the order of the license-to and the
corporate-relationship clause.

Verified against the same copyright samples as the previous
implementation, output is identical.
2026-08-11 00:39:31 +01:00
NoDancing f6b7e1f761 tidal: Normalize copyright text into a concise label name
_parse_label() used to store Tidal's raw copyright info as the label
name. Add _normalize_label(), a helper that strips leading markers,
years, legal entities, and boilerplate clauses.

Fixes #6796
2026-08-11 00:39:31 +01:00
Šarūnas Nejus 97904e7e16 Refactor autotag to use Source abstraction
Introduce Source class to encapsulate metadata extraction logic,
replacing scattered `get_most_common_tags` calls throughout codebase.

- Add Source class in importer.tasks with artist, name, and metadata
- Simplify `distance()` to accept Source.data instead of items list
- Update display functions to use Source objects
- Cache Source creation with @cached_property on ImportTask

This centralizes metadata handling and reduces coupling between
autotag and library modules.
2026-08-05 02:06:48 +01:00
Šarūnas Nejus 5933fcad85 Refactor template evaluation to handle format strings ONLY
- Handle formats as strings ONLY and evaluate them through a shared
  cached template helper.
- This removes the need for conditional logic that acts on Template
  objects or strings.
2026-08-05 01:56:59 +01:00
Piotr Szpetkowski 681f27feb6 fix(deezer): use free text for singleton searches
Singleton searches built the query as `<title> artist:"<artist>"`. Deezer
discards unquoted free text as soon as a query contains any field:"value"
filter, so that was evaluated as `artist:"<artist>"` alone - every track by
the artist, in Deezer's own relevance order, truncated to `search_limit`
(default 5). Substituting nonsense for the title returns a byte-identical
result set. For any artist with more releases than that window, the track
being imported was simply never among the candidates offered.

Filtering on the title as well (`track:"<title>" artist:"<artist>"`) is not
a fix: `artist:` matches loosely enough to return unrelated artists, so the
two filters can intersect to nothing even for a correctly tagged file.
`track:"Get Lucky" artist:"Daft Punk"` returns zero results, while the plain
free text `Get Lucky Daft Punk` returns the right track first.

Measured over 12 tracks at the default `search_limit`, counting the wanted
track appearing anywhere in the results:

  `<title> artist:"..."`              6/12, mean rank 1.50
  `track:"..." artist:"..."`          7/12, mean rank 1.00
  free text                          10/12, mean rank 1.00

Album searches are unchanged; `album:"<name>"` has no equivalent problem.

Adds test/plugins/test_deezer.py, which did not exist.
2026-07-30 21:18:59 +02:00
Šarūnas Nejus eab29f598f beets.util: remove prefix= kwarg from syspath 2026-07-30 12:20:27 +01:00
Šarūnas Nejus 5dcc35112d Fix yoda typedefs 2026-07-27 19:33:53 +01:00
Šarūnas Nejus 73914aa8d5 Fix invariant list typedefs 2026-07-27 19:31:20 +01:00
Alok Saboo 66fa44d0fb ruff check 2026-07-24 10:22:36 -04:00
Alok Saboo d392729b64 Merge branch 'master' into spotify 2026-07-24 10:14:31 -04:00
Alok Saboo 5bdb70f34f improve 503 error handling 2026-07-24 10:07:21 -04:00
Alok Saboo 801fe8f6d9 improve 503 error handling 2026-07-24 09:56:24 -04:00
Alok Saboo cc2f665884 improve 503 error handling 2026-07-24 09:46:38 -04:00
Šarūnas Nejus c346e809c1 typing: fix models typing in beets.library.models 2026-07-16 13:11:16 +01:00
Šarūnas Nejus 3f277ad5a0 typing: feed PathLike as database path 2026-07-16 13:11:16 +01:00
Šarūnas Nejus 439a7fa75d discogs: Refactor _coalesce_tracks to make use of various tracks type_ 2026-07-16 11:57:10 +01:00
Šarūnas Nejus 8867848612 discogs: Add descriptions of each possible Tracks 2026-07-16 11:57:10 +01:00
Šarūnas Nejus 69cdd58240 discogs: remove redundant check for required fields 2026-07-16 11:50:58 +01:00