diff --git a/beets/importer.py b/beets/importer.py index ea5b1cc51..9cb77c606 100644 --- a/beets/importer.py +++ b/beets/importer.py @@ -605,7 +605,8 @@ class ImportTask(BaseImportTask): """ items = self.imported_items() for field, view in config["import"]["set_fields"].items(): - value = view.get() + value = str(view.get()) + print("EEE ", value) log.debug( "Set field {1}={2} for {0}", displayable_path(self.paths), @@ -1062,7 +1063,7 @@ class SingletonImportTask(ImportTask): values, for the singleton item. """ for field, view in config["import"]["set_fields"].items(): - value = view.get() + value = str(view.get()) log.debug( "Set field {1}={2} for {0}", displayable_path(self.paths), diff --git a/test/test_importer.py b/test/test_importer.py index 116e750e7..ad6b837f5 100644 --- a/test/test_importer.py +++ b/test/test_importer.py @@ -395,11 +395,13 @@ class ImportSingletonTest(ImportTestCase): def test_set_fields(self): genre = "\U0001f3b7 Jazz" collection = "To Listen" + disc = 0 config["import"]["set_fields"] = { "collection": collection, "genre": genre, "title": "$title - formatted", + "disc": disc, } # As-is item import. @@ -412,6 +414,7 @@ class ImportSingletonTest(ImportTestCase): assert item.genre == genre assert item.collection == collection assert item.title == "Tag Track 1 - formatted" + assert item.disc == disc # Remove item from library to test again with APPLY choice. item.remove() @@ -426,6 +429,7 @@ class ImportSingletonTest(ImportTestCase): assert item.genre == genre assert item.collection == collection assert item.title == "Applied Track 1 - formatted" + assert item.disc == disc class ImportTest(ImportTestCase): @@ -583,12 +587,14 @@ class ImportTest(ImportTestCase): genre = "\U0001f3b7 Jazz" collection = "To Listen" comments = "managed by beets" + disc = 0 config["import"]["set_fields"] = { "genre": genre, "collection": collection, "comments": comments, "album": "$album - formatted", + "disc": disc, } # As-is album import. @@ -608,6 +614,7 @@ class ImportTest(ImportTestCase): item.get("album", with_album=False) == "Tag Album - formatted" ) + assert item.disc == disc # Remove album from library to test again with APPLY choice. album.remove() @@ -629,6 +636,7 @@ class ImportTest(ImportTestCase): item.get("album", with_album=False) == "Applied Album - formatted" ) + assert item.disc == disc class ImportTracksTest(ImportTestCase):