How do I include date information in album directory names in the way I want?


#1

Here’s some pseudocode for what I want to do:

if (year != null && month != null && day != null) {
    albumPrefix = "(" + year + "-" + month + "-" + day + ")";
} else if (year != null && month != null) {
    albumPrefix = "(" + year + "-" + month + ")";
} else if (year != null) {
    albumPrefix = "(" + year + ")";
} else {
    albumPrefix = "()";
}

If beets/musicbrainz uses zeros to indicate “not known”, then I would have to check for those instead of null values.

So I want album directory names to look like:
(2017-01-04) albumName
or
(2012-10) albumName
etc

I know there are conditional naming features (http://beets.readthedocs.io/en/v1.4.3/reference/pathformat.html#template-functions), but I don’t know what the format of the conditional itself should be.

How can this be done?


#2

Take a look at the inline plugin. That will let you essentially translate this pseudocode into Python and get the functionality you want.