Naming script with various media

I’ve this file renaming script:

$if2(%original_album_artist%,%albumartist%,Various Artists)/
%album% {%media%}/
Disc %discnumber%/
$num(%tracknumber%,2) - %title%

it is possible to modify it so that, if an album contains multiple media (CD, Blu-ray, DVD…), a parent folder is created with only the name of the album and the various folders with album name and media type?

This is the result I would like to achieve

Albums with multiple media:

  • Steven Wilson\Drive Home\Drive Home {CD}\Disc 02\Audio Content\01 - Drive Home
  • Steven Wilson\Drive Home\Drive Home {DVD-Video}\Disc 01\Video Content\02 - The Raven That Refused to Sing

Album with only one media:

  • Insomnium\Songs of the Dusk {CD}\Disc 01\01 - Flowers of the Night.flac