59 Commits
Author SHA1 Message Date
Maxr1998 fce53eafdf playcount: prefer exact title/artist/album matches over substring matches
Try to match the exact title and artist/album first (case-insensitive via StringQuery),
only then fall back to the previous substring matching.

This helps in cases where multiple variants of a song with distinct listen counts exist, like "Song" and "Song (inst.)" or "Song (Japanese ver.)".
This commit stops "Song" from also updating those separate variants if an exact match of "Song" exists.

Nonetheless, if the library only has an item named "Song (feat. Artist)", "Song" will still update its play count through the substring match.
2026-09-07 08:20:07 +01:00
Maxr1998 ca59ca40a3 playcount: simplify matcher queries
The query was previously written as `(title && artist) || (title && album)`, which is distributively the same as `title && (artist || album)`.
Rewriting it clarifies the intent, where the title must match and the artist or album confirms the match.
2026-09-07 08:20:07 +01:00
Maxr1998 c1abc55188 playcount: prefer an exact MBID match over title queries
Previously, all matchers were simply OR'd together, so the preference for MBID matches stated in the comments wasn't really applied.
Instead, listens with an MBID match could also update tracks with a different MBID, just because they had a substring match on their title.
For example, a listen for "Song" would also update play counts for "Song (inst.)", even though the library already contained "Song" with the listen's exact MBID and the instrumental has a different one.
2026-09-07 08:20:07 +01:00
Šarūnas Nejus 11d41aee7d typing: add missing types to plugins 2026-08-31 11:27:12 +01:00
Šarūnas Nejus 4e1fdf0bf3 typing: fix annotations in metadata source plugins 2026-08-31 10:48:16 +01:00
Šarūnas Nejus 21e045795d typing: add annotations to metadata source plugins 2026-08-31 10:48:16 +01:00
Šarūnas Nejus 27900f58fb Prefer imports from modules that provide import aliases 2026-08-18 23:20:39 +01:00
Šarūnas Nejus 4aa5aa62ac typing: fix types in beetsplug._utils.art 2026-08-18 23:20:38 +01:00
Šarūnas Nejus 6acef1d586 typing: add types to beetsplug._utils.art 2026-08-18 23:20:38 +01:00
Šarūnas Nejus 7a553aad7e typing: fix beets.dbcore.db 2026-07-15 20:23:54 +01:00
Sebastian Mohr 54a2bd20e1 Removed This file is part of beets... headers. 2026-06-29 11:20:15 +02:00
Alok Saboo 7c3566e073 fix mypy errors 2026-06-12 17:03:35 -04:00
Alok Saboo 68ed8924ef TimeoutAndRetrySession: fold in RateLimitAdapter and 429 retry 2026-06-12 09:43:23 -04:00
Šarūnas Nejus d53ee774a9 Enable and fix flake8-return 2026-06-09 00:14:06 +01:00
Šarūnas Nejus abcfd96c32 Create UnauthorizedMBError 2026-05-24 14:59:51 +01:00
Sebastian Mohr adfb73b66d Run ruff format 2026-05-20 16:53:06 +02:00
Sebastian Mohr 830c14a5bb Added retry logic to TidalSession and added RequestHandler abstraction
to api layer.
2026-04-20 20:55:47 +02:00
Sebastian Mohr cc943c3ccc Scafolded tidal source plugin:
- plugin functions currently unimplemented
- added authentication flow (pcke)
- added api layer to abstract communication with tidal (similar to spotify)
- added a general Request RateLimiter as I have seen that tidal will penalize
you pretty rough if you make more requests than expected.
2026-04-20 20:55:47 +02:00
Šarūnas Nejus bff84bbd06 Refactor parsing label info 2026-04-18 17:31:49 +01:00
Šarūnas Nejus cedf81eb22 Type musicbrainz fully 2026-04-12 16:21:30 +01:00
Šarūnas Nejus 9394f1b223 Normalize dashes to underscores in musicbrainz data fields 2026-04-12 16:21:30 +01:00
Alok Saboo 17ffd18b77 playcount: batch all store() calls in a single transaction
Each song.store() was opening and committing its own SQLite transaction.
With thousands of unique tracks the WAL grows and each successive write
becomes slower. Wrapping the loop in a single transaction makes writes
O(1) per item instead of progressively slower.
2026-04-08 09:59:41 -04:00
Alok Saboo 8c5c89a844 playcount: log progress every 250 tracks during processing 2026-04-08 09:02:51 -04:00
Šarūnas Nejus db7c753ebe Update listenbrainz accordingly 2026-03-31 01:36:08 +01:00
Šarūnas Nejus d7c9e268f9 Refactor process_tracks and add tests 2026-03-31 01:36:08 +01:00
Šarūnas Nejus 430c9db4e2 Create a function for processing a single track 2026-03-31 01:36:08 +01:00
Šarūnas Nejus cc9d86fdcf Add types 2026-03-31 01:36:08 +01:00
Šarūnas Nejus 985e0d2bdb Import query classes explicitly 2026-03-31 01:36:08 +01:00
Šarūnas Nejus 2041d2e0e7 Move process_tracks to utils 2026-03-31 01:36:08 +01:00
Brock Grassy 4cef8c4093 Address review comments 2026-03-16 06:52:35 +00:00
Brock Grassy 7027060a0b Fix lint and mypy 2026-03-16 06:52:35 +00:00
Brock Grassy 6b62380b62 Change missing plugin to allow for filtering albums by release type 2026-03-16 06:52:35 +00:00
Šarūnas Nejus 9b63985989 Migrate MusicBrainz to shared search hooks
Move MusicBrainzPlugin to SearchApiMetadataSourcePlugin hooks.

Keep entity mapping and criteria in provider-specific hooks.

Update typing and tests for the candidate search path.
2026-03-08 09:00:14 +00:00
Šarūnas Nejus 1930400ab8 Set default release/recording includes in MusicBrainzAPI 2026-02-22 02:09:25 +00:00
Šarūnas Nejus df1573ce9d Make MusicBrainzAPI logs visible 2026-02-07 22:36:43 +00:00
Šarūnas Nejus 1271b711f7 Format MusicBrainz search terms and escape Lucene special chars
Add a helper to lower/strip and escape Lucene query syntax.
Use it when building search queries and add unit tests.
2026-02-07 22:26:17 +00:00
Kirill A. Korinsky 78b6d537b6 Retries with 1, 2, 4, 8, 16, 32s backoff
At least it allows me to more or less use MusicBrainz
2026-01-30 00:46:13 +00:00
Serene 39f65f6b11 Merge branch 'master' into embedart-clear-improvements 2026-01-20 08:43:30 +10:00
Eric Masseran 3c34fd25f3 Merge branch 'master' into embedart-clear-improvements
* master: (37 commits)
  importsource: Test skip, Test reimport-skip
  Fix initial importsource plugin #4748 changelog
  importsource: fix potential prevent_suggest_removal crash
  Ensure that inc are joined with a plus
  Add retries for connection errors
  Add Usage block to RequestHandler
  Refactor HTTP request handling with RequestHandler base class
  Make musicbrainzngs dependency optional and requests required
  musicbrainz: remove error handling
  musicbrainz: access the custom server directly, if configured
  musicbrainz: browse directly
  musicbrainz: search directly
  musicbrainz: lookup recordings directly
  musicbrainz: lookup release directly
  Move pseudo release lookup under the plugin
  Add missing blame ignore revs from musicbrainz plugin
  Define MusicBrainzAPI class with rate limiting
  Move TimeoutSession under beetsplug._utils
  expand tests to include check for track artists
  remove changes for lastgenre as there was an existing PR for that work
  ...
2026-01-06 22:43:47 +01:00
Šarūnas Nejus d4b00ab4f4 Add request handler utils to the docs 2026-01-06 09:54:02 +00:00
Šarūnas Nejus 59b02bc49b Type MusicBrainzAPI properly 2026-01-06 09:54:02 +00:00
Šarūnas Nejus 55b9c1c145 Retry on server errors too 2026-01-06 09:54:02 +00:00
Šarūnas Nejus 1447f49b72 Add some documentation to musicbrainz api mixins 2026-01-06 09:54:02 +00:00
Šarūnas Nejus 92352574aa Migrate mbcollection to use MusicBrainzAPI 2026-01-06 09:54:02 +00:00
Šarūnas Nejus 9349ad7551 Migrate missing to use MusicBrainzAPI 2026-01-06 00:51:50 +00:00
Šarūnas Nejus a33371b6ef Migrate parentwork to use MusicBrainzAPI 2026-01-06 00:27:36 +00:00
Šarūnas Nejus 36964e433e Migrate listenbrainz plugin to use our MusicBrainzAPI implementation 2026-01-06 00:27:36 +00:00
Šarūnas Nejus 523fa6ceaf Move MusicBrainzAPI to a shared util 2026-01-06 00:26:41 +00:00
Šarūnas Nejus d1aa45a008 Add retries for connection errors 2025-12-21 01:03:20 +00:00
Šarūnas Nejus 9dad040977 Add Usage block to RequestHandler 2025-12-21 00:40:40 +00:00