Commit Graph

301 Commits

Author SHA1 Message Date
Šarūnas Nejus
c346e809c1 typing: fix models typing in beets.library.models 2026-07-16 13:11:16 +01:00
Sebastian Mohr
54a2bd20e1 Removed This file is part of beets... headers. 2026-06-29 11:20:15 +02:00
Šarūnas Nejus
f0105bef73 Add missing types to beets.util.pipeline 2026-06-24 16:53:34 +01:00
Pierre Ayoub
c941a6b5c9 refactor(convert): Use cached_property for refresh option
- Fix snejus comment from 2026-06-23
2026-06-24 13:01:00 +02:00
Pierre Ayoub
1cc28d21fe refactor(convert): Merge redundant checks 2026-06-24 13:00:59 +02:00
Pierre Ayoub
9afdda5774 style(convert): Simplify logic
This is a suggestion from ruff linting: get rid of the redundant `else`
after the `return`.
2026-06-24 13:00:59 +02:00
Pierre Ayoub
f7e8dcc25e chore(convert): Format 2026-06-24 13:00:59 +02:00
Pierre Ayoub
7d178f7d48 fix(convert): Get default value for refresh from config 2026-06-24 13:00:59 +02:00
Pierre Ayoub
a4d1bbd705 fix(convert): continue -> return
This continue comes from a rebase, when the convert_item were using a
while loop. Now we just have to go out of the function!
2026-06-24 13:00:59 +02:00
Pierre Ayoub
baac0cb503 chore(convert): Poe format 2026-06-24 13:00:58 +02:00
Pierre Ayoub
2d8af30455 style(convert): Consistent usage of original vs. item.path variables
Except for the `keep_new` mechanism, it is not useful to use the `original`
variable which is equal to the `item.path` variable. Since refresh only
makes sense when `keep_new` is false, only use for the pair of `item.path`
and `dest` variables for clarity (and not `original` and `converted`
variables).
2026-06-24 13:00:58 +02:00
Pierre Ayoub
a0f144d49c refactor(convert): Better logic to handle both refresh and keep_new features
- Implement @snejus comment from the 2026-04-19
- This change the silent no-op when both refresh and keep_new are used
to proper logging messages depending on what combination of option is
used
- Also harmonize the usage of terms "target" and "destination" between
  logging messages
2026-06-24 13:00:58 +02:00
Pierre Ayoub
89cbb19662 style(convert): Harmonize logging message when using pretend for refresh feature
- Also hamonize the logging message about moving files from `keep_new`
when using `pretend`
- According to snejus comment from 2025-07-06
2026-06-24 13:00:58 +02:00
Pierre Ayoub
03f56ea889 style(convert.py): fix ruff complain 2026-06-24 13:00:58 +02:00
Pierre Ayoub
a4eaec7445 fix(convert.py): fix missing syntax + format using ruff 2026-06-24 13:00:58 +02:00
Pierre Ayoub
4cac4e5031 refactor(convert): factorize multiple logic tests
Nest and combine some logic tests by:
1. Only check for destination file existence once.
2. Use `original` instead of `item.path` in the `refresh` conditional
   such that this option will be compatible with `keep_new`.
2026-06-24 13:00:57 +02:00
Pierre Ayoub
baefd71981 refactor(convert.py): remove uneeded util.syspath() calls
- `util.syspath` is redundant because already called in `util.normpath`
  itself called in Item class
Co-authored-by: Šarūnas Nejus <snejus@protonmail.com>
2026-06-24 13:00:57 +02:00
Pierre Ayoub
17957337d2 refactor(convert.py): simplify logic and redundant function
- Logic refactoring
- `util.syspath` is redundant because already called in `util.remove`

Co-authored-by: Šarūnas Nejus <snejus@protonmail.com>
2026-06-24 13:00:57 +02:00
Pierre Ayoub
e7e07e290f style(convert.py): no newline
Co-authored-by: Šarūnas Nejus <snejus@protonmail.com>
2026-06-24 13:00:57 +02:00
Pierre Ayoub
3e9fb4ead8 [beetsplug/convert] Run ruff format 2026-06-24 13:00:57 +02:00
Pierre Ayoub
aa1e4c7ba2 [beetsplug/convert] Fix linting error trailing whitespace 2026-06-24 13:00:57 +02:00
Pierre Ayoub
04f90cd9f1 [beetsplug/convert] Fix linting error Ruff (E501) 2026-06-24 13:00:56 +02:00
Pierre Ayoub
072f469028 Implement the convert.refresh configuration option 2026-06-24 13:00:56 +02:00
Pierre Ayoub
93e3bd17ca Implement the --refresh/-r command line option for convert's new feature 2026-06-24 13:00:56 +02:00
Pierre Ayoub
e06161ffd8 Implement the refresh behavior for convert command 2026-06-24 13:00:56 +02:00
Sebastian Cao
755ca6f139 convert: skip missing album art instead of crashing 2026-06-24 16:45:23 +08:00
Šarūnas Nejus
1b9701f1ff Import pipeline directly in convert plugin
- Use an explicit pipeline import for convert pipeline setup and decorators.
- This fixes AttributeError when beets.util does not automatically expose
  pipeline.
2026-06-14 13:21:28 +01:00
Šarūnas Nejus
d53ee774a9 Enable and fix flake8-return 2026-06-09 00:14:06 +01:00
Šarūnas Nejus
e36922a46e Tidy convert playlist help text
- Reformat the playlist option help to avoid awkward indentation while preserving
  the existing wording.
2026-06-04 11:41:54 +01:00
Šarūnas Nejus
0c227e9453 Define Library.path_formats property 2026-05-24 15:09:58 +01:00
Šarūnas Nejus
74021ee6b5 Define ConvertPlugin.get_item_destination to centralize the args 2026-05-24 15:09:58 +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
Šarūnas Nejus
86813678d7 Use pipeline.mutator_stage instead of a Generator 2026-05-06 15:30:51 +01:00
Šarūnas Nejus
ec940e8b61 Remove redundant param provision to encode 2026-05-06 15:30:51 +01:00
Šarūnas Nejus
dd33fef52e Remove redundant param provision to should_transcode 2026-05-06 15:30:51 +01:00
Šarūnas Nejus
e574e86887 Replace get_format with command attribute 2026-05-06 15:30:51 +01:00
Šarūnas Nejus
34772d2684 Replace _get_opts_and_config with attributes 2026-05-06 15:30:50 +01:00
Šarūnas Nejus
ee895efd2d Handle opts using the config 2026-05-06 15:30:10 +01:00
Šarūnas Nejus
b15006ca11 Remove dependency on global config 2026-05-06 15:30:10 +01:00
Šarūnas Nejus
241eb6db09 Fix typing issues 2026-05-06 15:30:10 +01:00
Šarūnas Nejus
33efc2bd19 Add types 2026-05-06 15:30:10 +01:00
Šarūnas Nejus
a5a9775930 convert: generate playlist entries from effective output paths
Build playlist paths using the selected format (`--format`/config), and only
replace extensions when the destination file is actually transcoded.

Precompute playlist entries before conversion runs so `--keep-new` does not
pick up mutated item paths and produce mismatched extensions.

Add/expand convert CLI tests to cover:
- config format playlist extension
- `--format` override playlist extension
- no-transcode (`no_convert`) playlist extension
- `--keep-new` destination playlist path behavior
2026-03-04 15:38:33 +00:00
Šarūnas Nejus
c46f99a82b Merge branch 'master' into pr-fix-convert-ext 2026-03-04 15:22:40 +00:00
frigginbrownie
1ff254215a Update convert.py 2026-01-15 15:46:01 +00:00
Šarūnas Nejus
c52656fb0a Enable RUF rules 2026-01-13 20:55:40 +00:00
Guy Bloom
2bd77b9895 Fix convert --format with never_convert_lossy_files (#6171)
## Description

Fixes #5625 

When `convert.never_convert_lossy_files` is enabled, `beet convert` was
ignoring the explicit `--format` option and just copying the lossy files
without
transcoding them. For example:

- `beet convert format:mp3 --format opus`

would still produce MP3 files instead of OPUS.

Change:

- Allows to override options `never_convert_lossy_files`, `max_bitrate`
or `no_convert` for `beet convert` as well as trying to convert to the
same format as existing already with a new option `--force`. That way,
for example lossy files selected by the query are transcoded to the
requested format anyway.
- Keeps existing behavior for automatic conversion on import (no CLI
override there).
- Adds tests to cover checking whether `--force` correctly overrides
settings or CLI options.
- Documents the behavior in the convert plugin docs

Co-authored-by: J0J0 Todos <jojo@peek-a-boo.at>
2025-12-03 22:48:41 +01:00
Finn
61b632f2b4 Add option to not write metadata 2025-09-24 21:52:57 -04:00
Sebastian Mohr
a796d6d799 New import location for art.py 2025-09-20 14:01:38 +02:00
Šarūnas Nejus
b3d434f58f Delegate attribute access to logging 2025-08-30 23:10:21 +01:00