Commit Graph

326 Commits

Author SHA1 Message Date
Šarūnas Nejus
af7a1a6ee9 typing: make is_hidden, sorted_walk and albums_in_dir generic over AnyStr 2026-07-13 18:38:53 +01:00
Ross Williams
6afc0f282a test: add importer test for fetchart plugin
Test whether fetchart is run during the import phase and, specifically,
whether the `fetch_for_asis` setting is honored. Mock boundary is
between `FetchArtPlugin` and `ArtSource`, an already-existing internal
API boundary.
2026-07-10 22:19:44 +01:00
Ross Williams
c3de685484 Add fetch_for_asis setting to FetchArt plugin
Enable fetching art for imports even when as-is is selected as the
metadata source. Allows for the case when files with good metadata
but without album art are being imported (e.g. digital download store).

Signed-off-by: Ross Williams <ross@ross-williams.net>
2026-07-10 22:15:32 +01:00
Sebastian Mohr
54a2bd20e1 Removed This file is part of beets... headers. 2026-06-29 11:20:15 +02:00
Šarūnas Nejus
e4baceae1f Add missing types to importer 2026-06-17 21:42:42 +01:00
Šarūnas Nejus
5be035f49d Enable and fix flake8-pie 2026-06-09 00:14:06 +01:00
terminalchai
874f7a5917 fetchart: catch OSError in _set_art for graceful permission error handling
When album art is being moved to the destination folder, a PermissionError (or
other OSError) can occur if the file is locked by another process (e.g. a media
player scanning the folder). Previously this caused an unhandled traceback crash.

Wrap album.set_art() in a try/except OSError block in _set_art, log a warning,
and return False so callers can handle the failure gracefully.

Fixes #6193
2026-05-29 16:49:17 +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
ea64158c6c Fixed minor typing issue as requests is now more strictly typed. 2026-04-11 11:18:43 +01:00
ShimmerGlass
3194666610 feat(fetchart): add support for webp files 2026-04-08 12:39:58 +02:00
ShimmerGlass
142e946588 fix(fetchart): sources definition
The fetchart plugin would silently drop unknown sources defined in
config, leading to hard to debug problems.
The plugin now errors when an unknown source is configured, or when no
sources are configured.
In addition, a single string is now a valid value for `sources` to
either enable all sources with an `*` or a single source.

Fixes: #6336
2026-04-07 18:55:53 +02:00
Šarūnas Nejus
a6fcb7ba0f Fix references to color utils 2026-03-14 11:57:18 +00:00
Danny Trunk
974d917df4 fix(fetchart): prevent deletion of configured fallback cover art
When `import.delete` or `import.move` is enabled, the `assign_art` method calls `task.prune(candidate.path)` unconditionally.
This incorrectly deletes the configured `fetchart.fallback` file.
Add explicit check to skip pruning when the candidate path matches the configured fallback.
2026-03-02 18:10:19 +01:00
Šarūnas Nejus
37e18fbb46 Adapt code to fully typed confuse library 2026-02-16 12:45:05 +00:00
Šarūnas Nejus
1c20e4bd4e Address RUF012 2026-01-13 20:55:40 +00:00
Šarūnas Nejus
c52656fb0a Enable RUF rules 2026-01-13 20:55:40 +00:00
Aidan Epstein
b53aff9b15 Fix fetchart colors broken by 67e668d81f 2026-01-07 10:36:08 -08:00
Danny Trunk
9ddddf4c39 fetchart: Add support for configurable fallback cover art 2025-12-30 13:45:03 +01:00
Šarūnas Nejus
d486885af3 pyupgrade Python 3.10 2025-11-08 12:09:52 +00:00
Sebastian Mohr
b2fc007480 Fixed plugin typehints: use actual logger class. 2025-09-30 13:37:51 +02:00
Šarūnas Nejus
b3d434f58f Delegate attribute access to logging 2025-08-30 23:10:21 +01:00
Šarūnas Nejus
e334e81d40 Use item.filepath instead of displayable_path in logging 2025-08-30 23:10:21 +01:00
Šarūnas Nejus
d93ddf8dd4 Do not use explicit indices for logging args when not needed 2025-08-30 23:10:21 +01:00
Šarūnas Nejus
1c16b2b308 Replace string concatenation (' + ')
- Join hardcoded strings
- Replace concatenated variables with f-strings
2025-08-30 23:10:15 +01:00
Šarūnas Nejus
9352a79e41 Replace percent formatting 2025-08-30 22:35:00 +01:00
Šarūnas Nejus
7cada1c9f8 Remove no-op decargs 2025-07-08 11:37:33 +01:00
Šarūnas Nejus
509cbdcbe4 Move sanitize_pairs/choices from plugins to util module 2025-05-31 17:55:41 +01:00
wisp3rwind
728076e97d fetchart: assert some invariants to satisfy mypy
Eventually, it would be nice to avoid this by more expressive typings.
For now, avoid such larger refactoring.
2025-05-20 10:06:11 +02:00
wisp3rwind
10d1c51a1d fetchart: consistently use lazy string formatting for debug logging 2025-05-20 09:23:34 +02:00
wisp3rwind
a6f2389aed typing: fetchart + tests 2025-05-20 08:57:30 +02:00
wisp3rwind
395aec96a3 fetchart: fixup #5244
by restoring config validation and making things more Pythonic
2025-05-20 08:57:30 +02:00
Sebastian Mohr
68acaa6470 Renamed all action occurrences with Action. 2025-05-13 13:01:46 +02:00
Šarūnas Nejus
99dc0861c2 Redact sensitive fields
Redacted fields reported by GitHub secrets scanner[1] and a couple of others.

1: https://github.com/beetbox/beets/security/secret-scanning?query=is%3Aclosed
2025-05-07 20:39:32 +01:00
Šarūnas Nejus
c490ac5810 Fix formatting 2025-05-07 10:41:01 +01:00
Šarūnas Nejus
85a17ee503 Reformat the codebase 2024-09-21 11:57:48 +01:00
Šarūnas Nejus
5785522170 fetchart: defer file removal config option evaluation (#5244)
Defer the evaluation of the source file removal options (`import.delete`
and `import.move`) to the point where the fetchart plugin is actually
called instead of only evaluating those configuration options on plugin
initialization.
This is to allow other plugins (such as the
[ytimport](https://github.com/mgoltzsche/beets-ytimport/blob/v1.8.1/beetsplug/ytimport/__init__.py#L194)
plugin) to invoke the import directly (within the same python process;
implicitly invoking the fetchart plugin) with temporarily overwritten
configuration options.

Addresses
https://github.com/beetbox/beets/issues/5167#issuecomment-2106465172
2024-09-16 11:44:46 +01:00
Max Goltzsche
00add272ce fetchart: apply review remarks
simplifying config access

Co-authored-by: Šarūnas Nejus <snejus@protonmail.com>
2024-09-13 23:09:49 +02:00
Šarūnas Nejus
1fda7b6111 fetchart, artresizer: Create art files in predictable directories
This allows to clean them up in art (1) fetching, (2) resizing and (3)
deinterlace tests.
2024-07-02 15:35:24 +01:00
Max Goltzsche
90f0ae2d93 fetchart: defer file removal config option eval
Defer the evaluation of the source file removal options (`import.delete` and `import.move`) to the point where the fetchart plugin is actually called instead of only evaluating those configuration options on plugin initialization.
This is to allow other plugins (such as the [ytimport](https://github.com/mgoltzsche/beets-ytimport/blob/v1.8.1/beetsplug/ytimport/__init__.py#L194) plugin) to invoke the import directly (within the same python process; implicitly invoking the fetchart plugin) with temporarily overwritten configuration options.

Relates to https://github.com/beetbox/beets/issues/5167#issuecomment-2106465172
2024-06-26 01:53:04 +02:00
Serene
de0742b9d6 Merge branch 'master' into bug-fetchart-resize-logic-fix 2024-06-25 14:30:39 +10:00
Šarūnas Nejus
f388ff6ec1 Replace py3_path with builtin os.fsdecode
`os.fsdecode` has only been available since Python 3.2.
2024-06-16 00:52:37 +01:00
Lev Gorodetskiy
2a4cf0d335 Codestyle 2024-05-26 11:57:24 -03:00
Lev Gorodetskiy
2130404217 Add timeout to all requests calls 2024-05-25 12:24:53 -03:00
Dr-Blank
6a27a8de3c satisfy the linter 2024-04-11 13:42:56 -04:00
Dr-Blank
66b459b8d0 Refactor Candidate class in fetchart.py to improve
validation and resizing logic
2024-03-18 09:17:33 -04:00
U-LAPTOP-4EP3DB2K\alexa
5fe19c1d1d PR feedback: fix formatting 2023-10-23 09:47:19 +08:00
U-LAPTOP-4EP3DB2K\alexa
6e88da7298 Merge branch 'master' into henges/discogs-fetchart 2023-10-22 20:48:54 +08:00
U-LAPTOP-4EP3DB2K\alexa
c31146e3f5 Discogs <-> fetchart integration 2023-10-22 20:42:45 +08:00
Serene-Arc
a6e5201ff3 Apply formatting tools to all files
This is 'the big one', which touches every file so that it all conforms
to the given standard.
2023-10-22 09:53:18 +10:00