Organising compilations (with rulesets)

A leaf with multiple branching veins A common feature request for bliss is to allow the organisation of compilation albums in different ways to other albums in the collection. I recently received one such request by email, asking to organise compilation files in a different folder naming scheme to other albums.

It’s now possible to do this using a behind-the-scenes feature called rulesets, originally implemented as part of the “ignore compliance” work.

Not only that, but now all types of different rulesets can be declared for different categories of album. This is a huge step forward in the power of bliss!

Rules - a reminder

Large music collections are difficult to manage because of their size; it gets difficult to ensure consistency, completeness and correctness of the library’s metadata (the music files’ tags) the more music you have. That’s why bliss organises music with rules. Instead of simply showing all your tags and allowing you to edit them, bliss allows you to declare rules that constrain what and how tags are stored. For example, with a rule you can say you want all album artwork to have a resolution above 500x500.

This makes music library management consistent (the same rules are applied everywhere), dependable (computers don’t get tired), fast and easy (rules are conducive to automation).

In bliss, until recently, the same rules were applied to all music in your library. In many cases this is fine, but many music-library-curators who use bliss began to find limitations with this. Examples on our ideas forum include wanting to define different rules for classical albums, multi-disc releases, singles, different genres and different music folder locations. That’s quite a few different use cases!

Organising compilations

Perhaps the one I hear most about are compilations; releases that combine recordings from other different original releases. Often the tracks are by different artists, although not always. We received this question to our support inbox:

After reading other posts about compilations, and IF / THEN logic not available in bliss, I kind of assume the answer to this question is no… But is there a way to handle Various Artist names in a unique way?

Can I rename compilation folders as VA - Album Name (year) [file extension]?

My issues with conditions are alluded to in the question. Seeing expressions like <% if format<>'flac' %> [<format>]<% end if %> (that’s a very simple one) are quite common in other music tagging software. When the expression is this simple it’s fairly easy to see what’s going on, but over time “just one more thing” means extra branches are added, before what you have is an unmaintainable horror expression.

So (and to be more constructive) my solution is “rulesets”. First: select the music. Second: apply the rules.

The great news is: this is now implemented at the rule engine level inside bliss.

Well, actually, it was implemented over half a year ago. I designed “ignore compliance” to be a special case of rulesets.

The upshot is that bliss has made a gigantic stride in its power as a music library processing application. It’s now possible to associate different rules based on the properties of albums. The downside is that this is not, currently, a user facing ability. Configuring and using it must be performed on the file system by copying and editing text files.

How rulesets work

The way it works is: when each album is passed for rule processing, all rulesets are compared to the album and the ruleset that refers to the album in the most specific way ‘wins’.

Imagine a ruleset stating it applies to an album called Unknown Pleasures. When an album called Unknown Pleasures is scanned, our ruleset will be used. When Permanent is scanned, there’s no such ruleset, and so the default ruleset is applied.

The important bit here is the album selector. This is an expression that uses bliss’s internal policy language that evaluates to either “true” or “false”. For example:

name = "Unknown Pleasures"

The name here is the property of the album. There are multiple properties we can inspect. Unfortunately these are not documented right now, but hopefully you can get the gist of how this works for compilations. Specifically, if we write this selector we can select all compilation albums:

any(properties("compilation"), _ = "1")

That is: “if any compilation properties in the album equal ‘1’, return true”. We can associate this selector with an entirely different set of rules such as (as the emailer originally requested) a different file path pattern.

A walkthrough

So let’s get this working! A warning though: this is not a user facing feature. You need to be comfortable with editing text files and doing a bit of trial-and-error experimentation to get this working.

Our first step is to create the ruleset. All rulesets are stored in the same directory and should end with the .settings extension. The folder is:

Windows XP C:\Documents and Settings\[username]\.bliss
Windows Vista, 7, 8 and 10 C:\Users\[username]\.bliss
Mac OS X (see below) /Users/[username]/Library/Preferences/bliss
Linux /home/[username]/.bliss
VortexBox /root/.bliss
Synology /var/packages/bliss/target/var/.bliss
QNAP `getcfg SHARE_DEF defVolMP -f /etc/config/def_share.info`/.qpkg/bliss/.bliss

In that folder, you should be able to see a settings file. Copy that and paste with a new name: compilations.settings. Its contents will depend on your current settings, so don’t worry about that for now. Instead, add the following line so it’s after any lines prefixed with a hash “#”:

albumSelector=any(properties("compilation"), _ = "1")

In the context of the file, it should look something like:

#
#Fri Mar 11 10:16:13 GMT 2022
albumSelector=any(properties("compilation"), _ = "1")
com.elsten.bliss.music.policy.albumintegrity.AlbumIntegrityPolicy.albumTrackDuplicates=IGNORE

(But the date at the top and the line below will likely be different).

That albumSelector line is our selector.

Now you can edit the rest of the rules as you see fit. Unfortunately, the settings file is not documented. For our file path example, we should change entries mentioning FileOrgPolicy as so:

com.elsten.bliss.music.policy.fileorg.FileOrgPolicy.enabled=true
com.elsten.bliss.music.policy.fileorg.FileOrgPolicy.filenamePattern=VA - <album name> (<year>) [<fileextension>]/<tracknumber\:auto>-<track name>.<fileextension>

This is designed to move compilation albums into a different folder naming scheme, e.g VA - Now 38 (1997) [flac]/01-Tubthumping.flac (and so on).

Once this is complete, restart bliss and then rescan your albums (until they are rescanned the old rules apply). The rules you defined in your new ruleset should be used, where the albumSelector returns true.

Different music, different rules

So this means that bliss can now support different rules for compilations. In fact, bliss can support different rules for any variation of the albumSelector that you define. Different rules where GENRE is Classical? Go ahead. Different rules for albums with multiple discs? That’s possible! Different rules for Rick Astley albums? I think you can see where I’m going there….

There are caveats…

As above, this is not a user facing feature - there’s no way to build an albumSelector in the user interface other than typing it into the settings files.

There will be some UI quirks. For example, some parts of the UI work on the assumption that any given rule is enabled if it sees an album has been assessed against it. In our example above, if the file paths rule is disabled for all other albums then:

  1. You won’t see a link to the file paths detail page on the album detail page (you must get to it by clicking the assessment description on the albums list).
  2. The aforementioned assessment description will not be nicely formatted.

But this is an undeniably significant step forward. Genre-specific organisation, location specific, multi disc, release type and file format-specific rules could all be implemented with this approach.

Is this useful? Until a user interface is built for it, I’m not so sure. However, I wanted to flag this up for other power users in case it was helpful. I’d love to know what you think, and I’m always here to help people build on these capabilities. Leave me a question in the comments or via [email protected] .

Photo by Tim Johnson on Unsplash

tags: compilation hacking

The Music Library Management blog

Dan Gravell

I'm Dan, the founder and programmer of bliss. I write bliss to solve my own problems with my digital music collection.