Skip to content
1 change: 0 additions & 1 deletion beets/config_default.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ statefile: state.pickle
# --------------- Plugins ---------------

plugins: [musicbrainz]

pluginpath: []

# --------------- Import ---------------
Expand Down
1 change: 1 addition & 0 deletions beets/library/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -361,6 +361,7 @@ def _getters(cls):
getters = plugins.album_field_getters()
getters["path"] = Album.item_dir
getters["albumtotal"] = Album._albumtotal
getters["media_types"] = lambda a: a.media_types
return getters

def items(self):
Expand Down
19 changes: 15 additions & 4 deletions beetsplug/discogs.py
Original file line number Diff line number Diff line change
Expand Up @@ -780,10 +780,21 @@ def get_track_info(
featured_list, self.config["anv"]["artist_credit"]
)
if featured:
artist += f" {self.config['featured_string']} {featured}"
artist_credit += (
f" {self.config['featured_string']} {featured_credit}"
)
featured_string = self.config["featured_string"].as_str()
token = f"{featured_string} {featured}".lower()
token_credit = f"{featured_string} {featured_credit}".lower()

# Only append if this featured artist isn't already present
if token not in artist.lower():
artist += f" {featured_string} {featured}"

if token_credit not in artist_credit.lower():
artist_credit += f" {featured_string} {featured_credit}"
# Previous code
# artist += f" {self.config['featured_string']} {featured}"
# artist_credit += (
# f" {self.config['featured_string']} {featured_credit}"
# )
return IntermediateTrackInfo(
title=title,
track_id=track_id,
Expand Down
1 change: 1 addition & 0 deletions docs/changelog.rst
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ New features:
- :doc:`plugins/mbpseudo`: Add a new `mbpseudo` plugin to proactively receive
MusicBrainz pseudo-releases as recommendations during import.
- Added support for Python 3.13.
- Added album-level `$media` field derived from items’ media metadata.
- :doc:`/plugins/convert`: ``force`` can be passed to override checks like
no_convert, never_convert_lossy_files, same format, and max_bitrate
- :doc:`plugins/titlecase`: Add the `titlecase` plugin to allow users to
Expand Down
24 changes: 24 additions & 0 deletions test/plugins/test_discogs.py
Original file line number Diff line number Diff line change
Expand Up @@ -601,6 +601,30 @@ def test_anv_album_artist():
},
"NEW ARTIST, VOCALIST Feat. SOLOIST, PERFORMER, MUSICIAN",
),
(
{
"type_": "track",
"title": "Infinite Regression",
"position": "6",
"duration": "5:00",
"artists": [
{
"name": "Filteria Feat. Ukiro",
"tracks": "",
"id": 11146,
"join": "",
}
],
"extraartists": [
{
"name": "Ukiro",
"id": 3,
"role": "Featuring",
},
],
},
"Filteria Feat. Ukiro",
),
],
)
@patch("beetsplug.discogs.DiscogsPlugin.setup", Mock())
Expand Down
48 changes: 48 additions & 0 deletions test/test_media_field.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
# import unittest

# from beets.library import Item, Library


# class MediaFieldTest(unittest.TestCase):
# def setUp(self):
# self.lib = Library(":memory:")
# self.lib.add_album = self.lib.add_album

# def add_album_with_items(self, items_data):
# items = []
# for data in items_data:
# item = Item(**data)
# items.append(item)
# album = self.lib.add_album(items)
# return album

# def test_album_media_field_multiple_types(self):
# items_data = [
# {"title": "Track 1", "artist": "Artist A", "media": "CD"},
# {"title": "Track 2", "artist": "Artist A", "media": "Vinyl"},
# ]
# album = self.add_album_with_items(items_data)
# media = album.media
# assert sorted(media) == ["CD", "Vinyl"]

# def test_album_media_field_single_type(self):
# items_data = [
# {"title": "Track 1", "artist": "Artist A", "media": "CD"},
# {"title": "Track 2", "artist": "Artist A", "media": "CD"},
# ]
# album = self.add_album_with_items(items_data)
# media = album.media
# assert media == ["CD"]

# def test_album_with_no_media(self):
# items_data = [
# {"title": "Track 1", "artist": "Artist A"},
# {"title": "Track 2", "artist": "Artist A"},
# ]
# album = self.add_album_with_items(items_data)
# media = album.media
# assert media == []


# if __name__ == "__main__":
# unittest.main()