Change arg name

This commit is contained in:
Jacob Danell 2025-10-20 15:22:27 +02:00
parent ca8df30ec3
commit 027b775fcd
3 changed files with 15 additions and 21 deletions

View file

@ -108,7 +108,7 @@ class FtInTitlePlugin(plugins.BeetsPlugin):
"drop": False,
"format": "feat. {}",
"keep_in_artist": False,
"skip_if_artist_and_album_artists_is_the_same": True,
"preserve_album_artist": True,
"custom_words": [],
}
)
@ -134,9 +134,9 @@ class FtInTitlePlugin(plugins.BeetsPlugin):
self.config.set_args(opts)
drop_feat = self.config["drop"].get(bool)
keep_in_artist_field = self.config["keep_in_artist"].get(bool)
skip_if_artist_and_album_artists_is_the_same = self.config[
"skip_if_artist_and_album_artists_is_the_same"
].get(bool)
preserve_album_artist = self.config["preserve_album_artist"].get(
bool
)
custom_words = self.config["custom_words"].get(list)
write = ui.should_write()
@ -145,7 +145,7 @@ class FtInTitlePlugin(plugins.BeetsPlugin):
item,
drop_feat,
keep_in_artist_field,
skip_if_artist_and_album_artists_is_the_same,
preserve_album_artist,
custom_words,
):
item.store()
@ -159,9 +159,7 @@ class FtInTitlePlugin(plugins.BeetsPlugin):
"""Import hook for moving featuring artist automatically."""
drop_feat = self.config["drop"].get(bool)
keep_in_artist_field = self.config["keep_in_artist"].get(bool)
skip_if_artist_and_album_artists_is_the_same = self.config[
"skip_if_artist_and_album_artists_is_the_same"
].get(bool)
preserve_album_artist = self.config["preserve_album_artist"].get(bool)
custom_words = self.config["custom_words"].get(list)
for item in task.imported_items():
@ -169,7 +167,7 @@ class FtInTitlePlugin(plugins.BeetsPlugin):
item,
drop_feat,
keep_in_artist_field,
skip_if_artist_and_album_artists_is_the_same,
preserve_album_artist,
custom_words,
):
item.store()
@ -219,7 +217,7 @@ class FtInTitlePlugin(plugins.BeetsPlugin):
item: Item,
drop_feat: bool,
keep_in_artist_field: bool,
skip_if_artist_and_album_artists_is_the_same: bool,
preserve_album_artist: bool,
custom_words: list[str],
) -> bool:
"""Look for featured artists in the item's artist fields and move
@ -234,11 +232,7 @@ class FtInTitlePlugin(plugins.BeetsPlugin):
# Check whether there is a featured artist on this track and the
# artist field does not exactly match the album artist field. In
# that case, we attempt to move the featured artist to the title.
if (
skip_if_artist_and_album_artists_is_the_same
and albumartist
and artist == albumartist
):
if preserve_album_artist and albumartist and artist == albumartist:
return False
_, featured = split_on_feat(artist, custom_words=custom_words)

View file

@ -28,7 +28,7 @@ file. The available options are:
- **keep_in_artist**: Keep the featuring X part in the artist field. This can be
useful if you still want to be able to search for features in the artist
field. Default: ``no``.
- **skip_if_artist_and_album_artists_is_the_same**: If the artist and the album
- **preserve_album_artist**: If the artist and the album
artist are the same, skip the ftintitle processing. Default: ``yes``.
- **custom_words**: List of additional words that will be treated as a marker
for artist features. Default: ``[]``.

View file

@ -205,11 +205,11 @@ def add_item(
("Alice med Bob", "Song 1"),
id="custom-feat-words-keep-in-artists-drop-from-title",
),
# ---- skip_if_artist_and_album_artists_is_the_same variants ----
# ---- preserve_album_artist variants ----
pytest.param(
{
"format": "feat. {}",
"skip_if_artist_and_album_artists_is_the_same": True,
"preserve_album_artist": True,
},
("ftintitle",),
("Alice feat. Bob", "Song 1", "Alice"),
@ -219,7 +219,7 @@ def add_item(
pytest.param(
{
"format": "feat. {}",
"skip_if_artist_and_album_artists_is_the_same": False,
"preserve_album_artist": False,
},
("ftintitle",),
("Alice feat. Bob", "Song 1", "Alice"),
@ -229,7 +229,7 @@ def add_item(
pytest.param(
{
"format": "feat. {}",
"skip_if_artist_and_album_artists_is_the_same": True,
"preserve_album_artist": True,
},
("ftintitle",),
("Alice feat. Bob", "Song 1", "Alice feat. Bob"),
@ -239,7 +239,7 @@ def add_item(
pytest.param(
{
"format": "feat. {}",
"skip_if_artist_and_album_artists_is_the_same": False,
"preserve_album_artist": False,
},
("ftintitle",),
("Alice feat. Bob", "Song 1", "Alice feat. Bob"),