Add Media field for album and test case

This commit is contained in:
Grace Coppola 2025-11-08 14:03:09 -05:00
parent beda6fc71b
commit c53e5aab7d
3 changed files with 14 additions and 1 deletions

View file

@ -7,7 +7,6 @@ statefile: state.pickle
# --------------- Plugins --------------- # --------------- Plugins ---------------
plugins: [musicbrainz] plugins: [musicbrainz]
pluginpath: [] pluginpath: []
# --------------- Import --------------- # --------------- Import ---------------

View file

@ -265,6 +265,7 @@ class Album(LibModel):
"language": types.STRING, "language": types.STRING,
"country": types.STRING, "country": types.STRING,
"albumstatus": types.STRING, "albumstatus": types.STRING,
"media": types.STRING,
"albumdisambig": types.STRING, "albumdisambig": types.STRING,
"releasegroupdisambig": types.STRING, "releasegroupdisambig": types.STRING,
"rg_album_gain": types.NULL_FLOAT, "rg_album_gain": types.NULL_FLOAT,
@ -320,6 +321,7 @@ class Album(LibModel):
"language", "language",
"country", "country",
"albumstatus", "albumstatus",
"media",
"albumdisambig", "albumdisambig",
"releasegroupdisambig", "releasegroupdisambig",
"release_group_title", "release_group_title",
@ -361,6 +363,7 @@ class Album(LibModel):
getters = plugins.album_field_getters() getters = plugins.album_field_getters()
getters["path"] = Album.item_dir getters["path"] = Album.item_dir
getters["albumtotal"] = Album._albumtotal getters["albumtotal"] = Album._albumtotal
return getters return getters
def items(self): def items(self):

11
test/test_media_field.py Normal file
View file

@ -0,0 +1,11 @@
from beets.library import Item
from beets import library
def test_album_media_field(tmp_path):
lib = library.Library(path=str(tmp_path / "library.db"),
directory=str(tmp_path / "music"))
item = Item(title="Test Song", album="Test Album", media="Vinyl")
album = lib.add_album([item])
assert album.media == "Vinyl"