This action determines if an album is part of a compilation based on the number of different Artist fields in the album. You control how the action operates by setting the Artist threshold in a variable. The action correctly works on multiple albums at a time. Tracks with empty Album fields are ignored.
----- Start of action 'Determine if Compilation'
- Version 1.3 -
- An action to determine if an album is a compilation. This determination is based on the number of unique artist fields that are found in a given album.
- Set the named variable 'threshold' to the number of unique artists which are required in order to assume a compilation. 'threshold' is initialized here to 3.
- Note that multiple albums are handled correctly. Tracks with empty album fields are ignored. Tracks with empty artist fields will have their 'compilation' field set but are ignored when determining the number of unique artists.
- Cancel if the current execution context does not support support Stepwise
- Initialize the threshold to 3. Change this value if you want to determine compilations based on a different number of unique artist fields.
- Set named variable 'threshold' to "3"
- Trim the Artist and Album fields to ensure that there are no leading or trailing spaces
- Trim the Album and Artist fields (SP) [Leading] [Trailing]
- Only process tracks with a non empty Album field.
- Test if the Album field is not empty (Set result and Variable 3)
- Run inline action 'Process Tracks With Non Empty Album Fields' if Variable 3 is true
- Start Process Tracks With Non Empty Album Fields
- Build Key List in named variable 'Album-Artists', keys from Album, values from Artist, custom settings
- Set field Variable 0 to the value of case insensitive per file key '\[Album]' in the list in named variable 'Album-Artists' (delimiter "⏎" separator "≔")
- Count Items in field Variable 0 string delimiter "\," save in Variable 1, per file counts
- Test if the numeric value of the Variable 1 field >= named variable 'threshold' (Set result and Variable 1)
- Set the Part of a Compilation field to "\v1"
----- End of action 'Determine if Compilation'
Actions: Determine if Compilation
2014-10-09 First release.
2015-02-09 Changed to handle multiple albums at a time.
2015-04-05 Documentation corrections.
2016-08-28 v3.14 optimizations.
2018-04-03 v4.0 optimizations.
2019-05-05 Bug fix. Counts of occurrences were not per file.
2019-05-14 v4.7 optmizations.