mirror of
https://github.com/beetbox/beets.git
synced 2025-12-06 08:39:17 +01:00
Change arg name
This commit is contained in:
parent
ca8df30ec3
commit
027b775fcd
3 changed files with 15 additions and 21 deletions
|
|
@ -108,7 +108,7 @@ class FtInTitlePlugin(plugins.BeetsPlugin):
|
||||||
"drop": False,
|
"drop": False,
|
||||||
"format": "feat. {}",
|
"format": "feat. {}",
|
||||||
"keep_in_artist": False,
|
"keep_in_artist": False,
|
||||||
"skip_if_artist_and_album_artists_is_the_same": True,
|
"preserve_album_artist": True,
|
||||||
"custom_words": [],
|
"custom_words": [],
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
|
@ -134,9 +134,9 @@ class FtInTitlePlugin(plugins.BeetsPlugin):
|
||||||
self.config.set_args(opts)
|
self.config.set_args(opts)
|
||||||
drop_feat = self.config["drop"].get(bool)
|
drop_feat = self.config["drop"].get(bool)
|
||||||
keep_in_artist_field = self.config["keep_in_artist"].get(bool)
|
keep_in_artist_field = self.config["keep_in_artist"].get(bool)
|
||||||
skip_if_artist_and_album_artists_is_the_same = self.config[
|
preserve_album_artist = self.config["preserve_album_artist"].get(
|
||||||
"skip_if_artist_and_album_artists_is_the_same"
|
bool
|
||||||
].get(bool)
|
)
|
||||||
custom_words = self.config["custom_words"].get(list)
|
custom_words = self.config["custom_words"].get(list)
|
||||||
write = ui.should_write()
|
write = ui.should_write()
|
||||||
|
|
||||||
|
|
@ -145,7 +145,7 @@ class FtInTitlePlugin(plugins.BeetsPlugin):
|
||||||
item,
|
item,
|
||||||
drop_feat,
|
drop_feat,
|
||||||
keep_in_artist_field,
|
keep_in_artist_field,
|
||||||
skip_if_artist_and_album_artists_is_the_same,
|
preserve_album_artist,
|
||||||
custom_words,
|
custom_words,
|
||||||
):
|
):
|
||||||
item.store()
|
item.store()
|
||||||
|
|
@ -159,9 +159,7 @@ class FtInTitlePlugin(plugins.BeetsPlugin):
|
||||||
"""Import hook for moving featuring artist automatically."""
|
"""Import hook for moving featuring artist automatically."""
|
||||||
drop_feat = self.config["drop"].get(bool)
|
drop_feat = self.config["drop"].get(bool)
|
||||||
keep_in_artist_field = self.config["keep_in_artist"].get(bool)
|
keep_in_artist_field = self.config["keep_in_artist"].get(bool)
|
||||||
skip_if_artist_and_album_artists_is_the_same = self.config[
|
preserve_album_artist = self.config["preserve_album_artist"].get(bool)
|
||||||
"skip_if_artist_and_album_artists_is_the_same"
|
|
||||||
].get(bool)
|
|
||||||
custom_words = self.config["custom_words"].get(list)
|
custom_words = self.config["custom_words"].get(list)
|
||||||
|
|
||||||
for item in task.imported_items():
|
for item in task.imported_items():
|
||||||
|
|
@ -169,7 +167,7 @@ class FtInTitlePlugin(plugins.BeetsPlugin):
|
||||||
item,
|
item,
|
||||||
drop_feat,
|
drop_feat,
|
||||||
keep_in_artist_field,
|
keep_in_artist_field,
|
||||||
skip_if_artist_and_album_artists_is_the_same,
|
preserve_album_artist,
|
||||||
custom_words,
|
custom_words,
|
||||||
):
|
):
|
||||||
item.store()
|
item.store()
|
||||||
|
|
@ -219,7 +217,7 @@ class FtInTitlePlugin(plugins.BeetsPlugin):
|
||||||
item: Item,
|
item: Item,
|
||||||
drop_feat: bool,
|
drop_feat: bool,
|
||||||
keep_in_artist_field: bool,
|
keep_in_artist_field: bool,
|
||||||
skip_if_artist_and_album_artists_is_the_same: bool,
|
preserve_album_artist: bool,
|
||||||
custom_words: list[str],
|
custom_words: list[str],
|
||||||
) -> bool:
|
) -> bool:
|
||||||
"""Look for featured artists in the item's artist fields and move
|
"""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
|
# Check whether there is a featured artist on this track and the
|
||||||
# artist field does not exactly match the album artist field. In
|
# artist field does not exactly match the album artist field. In
|
||||||
# that case, we attempt to move the featured artist to the title.
|
# that case, we attempt to move the featured artist to the title.
|
||||||
if (
|
if preserve_album_artist and albumartist and artist == albumartist:
|
||||||
skip_if_artist_and_album_artists_is_the_same
|
|
||||||
and albumartist
|
|
||||||
and artist == albumartist
|
|
||||||
):
|
|
||||||
return False
|
return False
|
||||||
|
|
||||||
_, featured = split_on_feat(artist, custom_words=custom_words)
|
_, featured = split_on_feat(artist, custom_words=custom_words)
|
||||||
|
|
|
||||||
|
|
@ -28,7 +28,7 @@ file. The available options are:
|
||||||
- **keep_in_artist**: Keep the featuring X part in the artist field. This can be
|
- **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
|
useful if you still want to be able to search for features in the artist
|
||||||
field. Default: ``no``.
|
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``.
|
artist are the same, skip the ftintitle processing. Default: ``yes``.
|
||||||
- **custom_words**: List of additional words that will be treated as a marker
|
- **custom_words**: List of additional words that will be treated as a marker
|
||||||
for artist features. Default: ``[]``.
|
for artist features. Default: ``[]``.
|
||||||
|
|
|
||||||
|
|
@ -205,11 +205,11 @@ def add_item(
|
||||||
("Alice med Bob", "Song 1"),
|
("Alice med Bob", "Song 1"),
|
||||||
id="custom-feat-words-keep-in-artists-drop-from-title",
|
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(
|
pytest.param(
|
||||||
{
|
{
|
||||||
"format": "feat. {}",
|
"format": "feat. {}",
|
||||||
"skip_if_artist_and_album_artists_is_the_same": True,
|
"preserve_album_artist": True,
|
||||||
},
|
},
|
||||||
("ftintitle",),
|
("ftintitle",),
|
||||||
("Alice feat. Bob", "Song 1", "Alice"),
|
("Alice feat. Bob", "Song 1", "Alice"),
|
||||||
|
|
@ -219,7 +219,7 @@ def add_item(
|
||||||
pytest.param(
|
pytest.param(
|
||||||
{
|
{
|
||||||
"format": "feat. {}",
|
"format": "feat. {}",
|
||||||
"skip_if_artist_and_album_artists_is_the_same": False,
|
"preserve_album_artist": False,
|
||||||
},
|
},
|
||||||
("ftintitle",),
|
("ftintitle",),
|
||||||
("Alice feat. Bob", "Song 1", "Alice"),
|
("Alice feat. Bob", "Song 1", "Alice"),
|
||||||
|
|
@ -229,7 +229,7 @@ def add_item(
|
||||||
pytest.param(
|
pytest.param(
|
||||||
{
|
{
|
||||||
"format": "feat. {}",
|
"format": "feat. {}",
|
||||||
"skip_if_artist_and_album_artists_is_the_same": True,
|
"preserve_album_artist": True,
|
||||||
},
|
},
|
||||||
("ftintitle",),
|
("ftintitle",),
|
||||||
("Alice feat. Bob", "Song 1", "Alice feat. Bob"),
|
("Alice feat. Bob", "Song 1", "Alice feat. Bob"),
|
||||||
|
|
@ -239,7 +239,7 @@ def add_item(
|
||||||
pytest.param(
|
pytest.param(
|
||||||
{
|
{
|
||||||
"format": "feat. {}",
|
"format": "feat. {}",
|
||||||
"skip_if_artist_and_album_artists_is_the_same": False,
|
"preserve_album_artist": False,
|
||||||
},
|
},
|
||||||
("ftintitle",),
|
("ftintitle",),
|
||||||
("Alice feat. Bob", "Song 1", "Alice feat. Bob"),
|
("Alice feat. Bob", "Song 1", "Alice feat. Bob"),
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue