diff --git a/beetsplug/albumtypes.py b/beetsplug/albumtypes.py index cb9eeb0bb..a73d41b4e 100644 --- a/beetsplug/albumtypes.py +++ b/beetsplug/albumtypes.py @@ -31,9 +31,16 @@ class AlbumTypesPlugin(BeetsPlugin): super(AlbumTypesPlugin, self).__init__() self.album_template_fields['atypes'] = self._atypes self.config.add({ - 'types': [], - 'ignore_va': [], - 'brackets': '[]' + 'types': [ + ('ep', 'EP'), + ('single', 'Single'), + ('soundtrack', 'OST'), + ('live', 'Live'), + ('compilation', 'Anthology'), + ('remix', 'Remix') + ], + 'ignore_va': ['compilation'], + 'bracket': '[]' }) def _atypes(self, item: Album): diff --git a/docs/plugins/albumtypes.rst b/docs/plugins/albumtypes.rst index f97a11a71..4a9f67c4a 100644 --- a/docs/plugins/albumtypes.rst +++ b/docs/plugins/albumtypes.rst @@ -20,17 +20,12 @@ file. The available options are: - **types**: An ordered list of album type to format mappings. The order of the mappings determines their order in the output. If a mapping is missing or blank, it will not be in the output. - Default: ``[]``. - **ignore_va**: A list of types that should not be output for Various Artists albums. Useful for not adding redundant information - various artist albums are often compilations. - Default: ``[]``. - **bracket**: Defines the brackets to enclose each album type in the output. - Default: ``'[]'`` -Examples --------- -Example config:: +The default configuration looks like this:: albumtypes: types: @@ -41,16 +36,22 @@ Example config:: - compilation: 'Anthology' - remix: 'Remix' ignore_va: compilation - bracket: '()' + bracket: '[]' + +Examples +-------- +With path formats configured like:: paths: - default: $albumartist/($year)$atypes $album/... - albumtype:soundtrack Various Artists/$album ($year)$atypes)/... - comp: Various Artists/$album ($year)$atypes/... + default: $albumartist/[$year]$atypes $album/... + albumtype:soundtrack Various Artists/$album [$year]$atypes)/... + comp: Various Artists/$album [$year]$atypes/... -This configuration generates paths that look like this, for example:: - Aphex Twin/(1993)(EP)(Remix) On Remixes - Pink Flow/(1995)(Live) p·u·l·s·e - Various Artists/20th Century Lullabies (1999) - Various Artists/Ocean's Eleven (2001)(OST) +The default plugin configuration generates paths that look like this, for example:: + + Aphex Twin/[1993][EP][Remix] On Remixes + Pink Flow/[1995][Live] p·u·l·s·e + Various Artists/20th Century Lullabies [1999] + Various Artists/Ocean's Eleven [2001][OST] + diff --git a/test/test_albumtypes.py b/test/test_albumtypes.py index f69edbb8b..a9db12c30 100644 --- a/test/test_albumtypes.py +++ b/test/test_albumtypes.py @@ -90,6 +90,17 @@ class AlbumTypesPluginTest(unittest.TestCase, TestHelper): result = subject._atypes(album) self.assertEqual('(OST)', result) + def test_respects_defaults(self): + """Tests if the plugin uses the default values if config not given.""" + album = self._create_album( + album_types=['ep', 'single', 'soundtrack', 'live', 'compilation', + 'remix'], + artist_id=VARIOUS_ARTISTS_ID + ) + subject = AlbumTypesPlugin() + result = subject._atypes(album) + self.assertEqual('[EP][Single][OST][Live][Remix]', result) + def _set_config(self, types: [(str, str)], ignore_va: [str], bracket: str): self.config['albumtypes']['types'] = types self.config['albumtypes']['ignore_va'] = ignore_va