Script to create an album genre from its various recording genres

Around holiday tasks, I’ve created an ‘album genre’ script. It’s based on the idea that if a recording genre appears in half or more of the tracks, it gets added to the ‘album genre’. It’s based on the clever routine that @rdswift provided.

$noop(___Create album genre from genre counts___)
$if(%_album_genre_processed%,,
  $foreach($get(aggregate_genre),
    $if($gte($mul($get(Genre '%_loop_value%' count),2),%totaltracks%),
      $if($not(%album_genre%),$setmulti(album_genre,%_loop_value%),
      $copymerge(album_genre,_loop_value))
    )
  )
)
$set(_album_genre_processed,1)

After this script, the album_genre result for “Suave Suave” is “Electronic; New Age”.

Next, I will be creating a genre prioritization routine to set the order of genres within the multivariable from high to low (like Rock before Folk-Rock, Electronic before Techno, Jazz before Hard Bop, etc.). It will likely be similar to @hiccup’s approach.

Once they’re prioritized & sorted, I’ll truncate a potential long list to 5 or so genres maximum.

3 Likes