Commit Graph
58 Commits
Author SHA1 Message Date
Šarūnas Nejus 914441da16 typing: fix command handlers types 2026-08-21 20:56:38 +01:00
Šarūnas Nejus 6241139600 typing: define explicit optparse.Values for each command 2026-08-19 23:57:05 +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 9adcb601f8 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 23:20:38 +01:00
Šarūnas Nejus 1969622874 typing: fix types in event handlers 2026-08-18 10:46:33 +01: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
Alok Saboo 60d60eacfb Merge branch 'master' into tidal-coverart 2026-06-27 10:11:11 -04:00
Šarūnas Nejus 609f83e338 tidal: Add missing return types in TidalPlugin 2026-06-27 09:20:38 +01:00
Šarūnas Nejus ccccdef8b8 Extract shared Tidal attributes type
- Factor common album and track Tidal fields into a shared
  MediaAttributes TypedDict.
- Use the shared type in parser helpers that only need common Tidal
  metadata.
2026-06-27 09:03:36 +01:00
Sebastian Mohr 4e6e49d9c2 Removed a return. Still a bit complicated but
I don't think there is a way to further optimize.
2026-06-24 14:13:57 -04:00
Alok Saboo 01b12dca3b rename CoverArt types to Artwork to match Tidal API 2026-06-24 14:10:11 -04:00
Alok Saboo 26d90bbcfa make cover_art_by_id required and remove broken fallback URL 2026-06-24 14:10:10 -04:00
Alok Saboo d26cfdedbc fix cover art types and parsing to match API response 2026-06-24 14:03:58 -04:00
Alok Saboo 28fa210422 tidal: fix mypy docref and dict access
- Fix mypy: avoid {} default in relationships.get() that creates Never type

- Fix doc build: use :doc:\etchart\ instead of :doc:\plugins/fetchart\ from within plugins/ directory
2026-06-24 14:03:58 -04:00
Alok Saboo 23d4edc4d7 tidal: fix mypy errors in cover art parsing
- Make CoverArtAttributes.url NotRequired

- Use direct index access on TypedDict instead of .get() to avoid mypy Never-type inference
2026-06-24 14:03:58 -04:00
Alok Saboo 659ee7df0b add cover art support 2026-06-24 14:03:56 -04:00
Šarūnas Nejus 8fe9c2e576 Set albumtypes instead of albumtype 2026-06-24 16:44:10 +01:00
Šarūnas Nejus 368d2c0a6d Normalize albumtype 2026-06-24 16:44:10 +01:00
Sebastian Mohr 379bbebbf1 Reverted attributes change. Not really in scope here and needs a bit more
refactoring to be consistent.
2026-06-19 10:39:14 +02:00
Šarūnas Nejus cf73922cc6 Undo unrelated changes 2026-06-19 10:36:31 +02:00
Alok Saboo 81ce9b4481 simplify shared attribute typing 2026-06-17 14:03:53 -04:00
Alok Saboo 904839106c address reviewer comments 2026-06-17 11:47:01 -04:00
Alok Saboo 64b09c5a78 address reviewer comments 2026-06-17 10:51:14 -04:00
Alok Saboo d855dbf55b lint issues 2026-06-17 10:31:24 -04:00
Alok Saboo dcd54146d8 address reviewer comments 2026-06-17 09:45:02 -04:00
Alok Saboo ab2a9ced63 Apply ruff formatting 2026-06-15 17:24:01 -04:00
Alok Saboo 5904dc280a Fix id_field, update tests, fix flake8 2026-06-15 17:08:34 -04:00
Sebastian Mohr 7fdcffea8d Proposal: Rewrote sync logic and split command again
Replace tidalsync() with sync_item_popularity() / sync_album_popularity()
backed by a shared _sync_popularity() helper.

Split the `tidal` command into `tidal` (auth-only) and `tidalsync`
(popularity sync with --item, --album, --force, --write flags). While
I liked the tidal [auth|sync] it is currently not well supported in beets
and e.g. help pages are lacking.

Accept int IDs throughout the search pipeline to avoid unnecessary
str conversions.
2026-06-15 21:58:56 +02:00
Alok Saboo b85e5ec59d fix mypy: use explicit if-guard for album_result 2026-06-15 13:41:34 -04:00
Alok Saboo 4cd996cc0e apply ruff formatting 2026-06-15 13:18:15 -04:00
Alok Saboo 4a0b2beeef address reviewer comments: simplify _parse_popularity, fix flake8 E501 2026-06-15 13:00:59 -04:00
Alok Saboo a6bf76b232 address reviewer comments: type _parse_popularity with attributes, add album popularity to sync 2026-06-15 11:38:12 -04:00
Alok Saboo 2f434b2b93 address reviewer comments 2026-06-15 09:45:35 -04:00
Alok Saboo bed1f024b0 Fix tests and mypy error
- Use self.add_item() instead of self.lib.add_item() in tests
- Fix mypy: add isinstance(val, int) check in _popularity()
- Apply ruff formatting
2026-06-14 16:36:19 -04:00
Alok Saboo 98681406af tidal: add flexattrs and tidalsync command
- Add item_types ClassVar with tidal_track_id, tidal_album_id,
  tidal_artist_id, tidal_track_popularity, tidal_alb_popularity,
  tidal_updated fields
- Populate flexattrs during album/track import via AlbumInfo/TrackInfo
  kwargs
- Add beet tidalsync command to refresh popularity data post-import
- Add tidal fields to REIMPORT_FRESH_FIELDS_ITEM for reimport support
- Add tests for flexattr population and tidalsync behavior
- Update tidal plugin docs with attribute reference and tidalsync usage
2026-06-14 13:44:16 -04:00
Šarūnas Nejus 648f24cbc2 Enable and fix flake8-builtins 2026-06-09 00:14:06 +01:00
Šarūnas Nejus d53ee774a9 Enable and fix flake8-return 2026-06-09 00:14:06 +01:00
Šarūnas Nejus 29580d2f00 Import everything from parent beets.autotag 2026-06-02 08:57:35 +01:00
Sebastian Mohr adfb73b66d Run ruff format 2026-05-20 16:53:06 +02:00
Šarūnas Nejus 30ab81eb5b Extract UserError from beets.ui to a new beets.exceptions module.
Update all references in core, plugins, and tests to import UserError
from the new location. This centralizes exception handling and improves
code organization.
2026-05-16 11:18:51 +01:00
Sebastian Mohr eaf1f00424 warning instead of raising errors. 2026-04-20 20:55:47 +02:00
Sebastian Mohr 55da1cb5a5 Use get_json where applicable and simplified iso 8601 parsing. 2026-04-20 20:55:47 +02:00
Sebastian Mohr 815dce4b3e renamed hashmaps to *_by_id from *_lookup 2026-04-20 20:55:47 +02:00
Sebastian Mohr 2afa774126 Move auth flow to use requests-oauth. 2026-04-20 20:55:47 +02:00
Sebastian Mohr 2c24b93ca7 Another subset of review comments from @snejus:
- Renamed _extract_* methods to _parse_*
- Renamed release to date_parts
- Using .get instead of .request("GET"...)
2026-04-20 20:55:47 +02:00