Help with %album% .vs %_albumfolder%

Tags: #<Tag:0x00007f7cfccdf3e0> #<Tag:0x00007f7cfccdf2c8>

Ok tricky one here not sure if it can be done. Here is a portion of my script…

$if2($if($eq($len(%musicbrainz_albumid%),0),No MBID/$if2(%albumartist%,%artist%),)
$if($eq(%releasetype%,album; soundtrack),Soundtracks/,)
$set(_albumartistprefix,$rsearch(%albumartist%,^\(The|A\)\\s+)),
$if2(%albumartist%,%artist%),$if(%_albumartistprefix%,$rreplace(%albumartist%,^\(%_albumartistprefix%\)\(.*\),\\2 \(\\1\)),%albumartist%))/
$if($eq($is_complete(),0),
$if($lt($matchedtracks( ),%_totalalbumtracks%), _inComplete/, _DuPs/))
$if($and($lt($matchedtracks(),%totaltracks%),$lt($matchedtracks(),60)),Incomplete Releases/)
$if2(%originalyear%,$left(%originaldate%,4),$left(%date%,4),0000) -
$replace($replace($rreplace($if($not($inmulti(%releasetype%,soundtrack)),$if($eq(%albumartist%,Various Artists),VA,%albumartist%)-)%_albumfolder%,[_:*?"<>|], -),?,), ,_)

Now what this does together with my whole script is puts multiple discs in 1 folder and puts the subtitle disc name on each disc so when I open them in musicbee I can see all the different subtitle names for each disk separated. The problem occurs when I try to just save a cluster as an album the album title is blank for the folder. The offending line I found is here…

$replace($replace($rreplace($if($not($inmulti(%releasetype%,soundtrack)),$if($eq(%albumartist%,Various Artists),VA,%albumartist%)-)%_albumfolder%,[_:*?"<>|], -),?,), ,_)

%_albumfolder% works perfectly until I try to save a cluster as an album. But if I change it to just %album% then it save the folder cluster perfect but creates separate folders for each disc in a multiple set.
SOOOO my question is there a way I can have both working the way I need it to?

Where is %_albumfolder% being set? That’s not part of the code you show, but is important information to help.

1 Like

This is a screenshot of how it looks in my player see the album titles even though they are all in one dir.
Anyway here’s my entire script.

$if($gt(%_bits_per_sample%,16),-=[%_bits_per_sample%bit]=-,)/
$upper(%_extension%)/
$if2($if($eq($len(%musicbrainz_albumid%),0),No MBID/$if2(%albumartist%,%artist%),)
$if($eq(%releasetype%,album; soundtrack),Soundtracks/,)
$set(_albumartistprefix,$rsearch(%albumartist%,^\(The|A\)\\s+)),
$if2(%albumartist%,%artist%),$if(%_albumartistprefix%,$rreplace(%albumartist%,^\(%_albumartistprefix%\)\(.*\),\\2 \(\\1\)),%albumartist%))/
$if($eq($is_complete(),0),
$if($lt($matchedtracks( ),%_totalalbumtracks%), _inComplete/, _DuPs/))
$if($and($lt($matchedtracks(),%totaltracks%),$lt($matchedtracks(),60)),Incomplete Releases/)
$if2(%originalyear%,$left(%originaldate%,4),$left(%date%,4),0000) -
$replace($replace($rreplace($if($not($inmulti(%releasetype%,soundtrack)),$if($eq(%albumartist%,Various Artists),VA,%albumartist%)-)%_albumfolder%,[_:*?"<>|], -),?,), ,_)
$if($ne_all(%catalognumber%,none,[none]),$if(%catalognumber%,$upper(-\($replace($replace($replace($replace($replace($replace($replace($replace($replace($replace($replace($rsearch(%catalognumber%,\(.+?\)\(?:; |\$\)+),_,),⋅,),/,),:,),*,),?,),",),<,),>,),|,), ,)\))))
$if($eq(%label%,Mobile Fidelity Sound Lab),-\(Mobile_Fidelity_Sound_Lab\),)
$if($eq(%releasestatus%,promotion),-PROMO,)
$if($eq(%releasestatus%,bootleg),-BOOTLEG,)
$if($eq(%releasetype%,single),-\(CDMaxi\)-SINGLE,
$if($eq(%releasetype%,ep),-EP,
$if($inmulti(%releasetype%,soundtrack),-OST,
$if($inmulti(%releasetype%,live),-LIVE,))))
$if($eq(%media%,Digital Media),-WEB,)
$if($in(%media%,Vinyl),-VINYL,)
$if($in(%media%,CD),$if($gt(%totaldiscs%,1),-%totaldiscs%CD,-CD),)
$if($in(%media%,Vinyl),$if($gt(%totaldiscs%,1),-%totaldiscs%LP,),)
$if($in(%media%,Bluray),$if($gt(%totaldiscs%,1),-%totaldiscs%BD,),)
$if($in(%media%,Digital Media),$if($gt(%totaldiscs%,1),-%totaldiscs%DM,),)
$if($ne(%_extension%,mp3),$upper(-%_extension%))
$if($eq(%_bitrate%,320.0),-[320],)
$if($if2(%date%,%originalyear%,%originaldate%),-$left($if2(%date%,%originalyear%,%originaldate%),4), [0000])-NOGROUP
$if($gt(%_bits_per_sample%,16), [%_bits_per_sample%bit $div(%_sample_rate%,1000)kHz])/
/$if($in(%media%,Vinyl),%_musicbrainz_tracknumber%,$if($gt(%totaldiscs%,1),%discnumber%,)$num(%tracknumber%,2)). $if($and(%_multiartist%,$not($inmulti(%releasetype%,soundtrack))),%artist% - ,)$truncate(%title%,70)

That doesn’t include anything that sets %_albumfolder%, so I can only guess that that’s set by either a plugin or one of the scripts in Options -> Scripting. Both will only run on albums/tracks/… matched to MB data (that is, everything in the right-most pane). They’ll not run on clusters.

I think I understand what you’re trying to do: save %album% in %_albumfolder% and afterwards replace the album tag with %album% (%disambiguation%): %discsubtitle%, so Musicbee displays each disc as its own entry, is that correct?

3 Likes

@Mineo so sorry I forgot to post my scripting’s I use 3 and I’m sure these are just as important
Disc Subtitle:
$set(_albumfolder,%album%)
$if(%discsubtitle%,$set(album,%album%: %discsubtitle%))

Remove Feat from album title:
$set(album,$rreplace(%album%,\s\(feat. [^)]+\),))

Release Comment:
$set(album,$if(%_releasecomment%,%album% ($title(%_releasecomment%)),%album%))

So yes

And all the discs are in a single dir, so everything there is functioning fine. It is when I try to just save a cluster file that has no MBID the folder ends up saving everything except the album Title so it would look like this:
1982 - Aerosmith–[320]-1982-NOGROUP
When it Needs to look like this:
1982 - Aerosmith-Rock_In_A_Hard_Place-[320]-1982-NOGROUP

Thanks for replying.

As mineo wrote above this is because the scripts in Options > Scripting are only run for releases loaded on the right, that means the _albumfolder variable is not available when you save clusters.

I’d recommend to replace %_albumfolder% in your naming script with

$if2(%_albumfolder%,%album%)

That way it falls back to the album title if albumfolder is not set.

2 Likes

WOW, Was it really that simple? Thanks so much!