Author Topic: [6097] Virtual Tag code is validated & saved but is wiped out upon restarting MB  (Read 4618 times)

theta_wave

  • Sr. Member
  • ****
  • Posts: 680
MB build 6097:

Somewhat similar to this thread: http://getmusicbee.com/forum/index.php?topic=17304.msg102345#msg102345

Code: "Virtual Tag"
$If($Contains(<URL>,"I:\0_CD")="T",Sync,)
The above virtual tag code is validated, saved and works in an autoplaylist where <Sync> is set to have no value.  However, when restarting MB, this virtual tag is empty.  Re-entering the code again, MB validates it and I save it with no warning icon in sight.  Upon re-opening preferences > Tag (1) > Define New Tag, I see there's a warning icon next to the virtualtag entry.  MB is omitting the quotation marks around "I:\0_CD" leading the code to fail eventually and, I assume, be discarded by MB upon restart.
Last Edit: September 16, 2016, 06:50:46 PM by ssri

psychoadept

  • Global Moderator
  • Sr. Member
  • *****
  • Posts: 10690
This is a bug I have run into with some virtual tags, too.
MusicBee Wiki
Use & improve MusicBee's documentation!

Latest beta patch (3.5)
(Unzip and overwrite existing program files)

Steven

  • Administrator
  • Sr. Member
  • *****
  • Posts: 34364
i have put in handling for the \ character that will work for the sort of example provided. Its still not perfect when used in combination with other characters that need escaping eg. $, (, ), ",", <, > but i dont want to put in more changes at the risk of messing something else up

theta_wave

  • Sr. Member
  • ****
  • Posts: 680
i have put in handling for the \ character that will work for the sort of example provided. Its still not perfect when used in combination with other characters that need escaping eg. $, (, ), ",", <, > but i dont want to put in more changes at the risk of messing something else up
So, a single \ is used to escape characters that need escaping?  For the directory foo I wish to include or exclude, should it be written as "\\foo\\" (without quotes)?


theta_wave

  • Sr. Member
  • ****
  • Posts: 680
Hi Steven,

Your gut instincts were correct, as the update messed up my file organization rule below; it works fine after copying and pasting it in but it fails upon running it again.  I am kindly asking for a reversion  :) .  I guess the moral of the story is to be careful what you're asking for.  As for the code in my OP, I guess "00_CD" should suffice, as nothing that I know of has that particular string in its <Path>.  Apologies in advance to other users if my report that led to this fix caused any issues to their collections.

Code: "General organization rule"
$If($Or(<Genre>="Anime",<Genre>="Game"),"Soundtrack - "<Genre>,$If(<Genre>="Soundtrack",<Genre>,$If($Or(<Album Artist>="Brian Eno",$Contains(<Album Artist>,"Brian Eno")="T"),"Brian Eno",$If($Or(<Genre>="CPop",<Genre>="CRock"),Chinese,$If($Or(<Genre>="Alternative",<Genre>="Rock"),"Alternative and Rock",$If(<Genre>="New Wave","80s, New Wave, and Synthpop",$If(<Genre>="Jazz Vocal","Jazz (Vocal)",$If($Or(<Genre>="House",<Genre>="Acid Jazz"),Dance,$If($Or(<Genre>="Gothic",<Genre>="Post-Punk"),"Gothic or Post-Punk",$If(<Genre>="Rap","Hip Hop",$If(<Genre>="Jungle","Drum & Bass",$If($Or(<Genre>="Lounge",<Genre>="Downtempo"),"Lounge & Nu-jazz",$If(<Genre>="Nu-jazz","Lounge & Nu-jazz",$If($Or(<Genre>="Instrumental Rock",<Genre>="Post-Rock"),"Post-Rock and Instrumental Rock",$If(<Genre>="Singer/Songwriter",Singer-Songwriter,$If($Or(<Genre>="Experimental",<Genre>="No Wave"),Avantgarde,$If(<Genre>="Synthpop","Synthpop (Modern Day)",$If(<Genre>="Drone",Ambient,$If(<Genre>="Darkwave","Indie Electronic",<Genre>)))))))))))))))))))\$If($Or(<Genre>="Anime",<Genre>="Game"),<Album>" ("<Year (yyyy)>")"\$If($Or(<Album Artist>="Various Artists",<Compilation>="Compilation"),<Track#>". "<Artist>" - "<Title>,<Track#>". "<Title>),$If(<Genre>="Soundtrack",<Album>" ("<Year (yyyy)>")"\$If($Or(<Album Artist>="Various Artists",<Compilation>="Compilation"),<Track#>". "<Artist>" - "<Title>,<Track#>". "<Title>),$If(<Album Artist>="Various Artists","VA - "<Album>" ("<Year>")"\<Track#>". "<Artist>" - "<Title>,$If(<Genre>="Tracker",<Album Artist>\$IsNull(<Album>,<Title>$IsNull(<Year>,," ("<Year>")"),$IsNull(<Year>,<Album>," ("<Year>$IsNull(<DateCustom>,".00.00) ",.<DateCustom>") ")<Album>)\<Track#>". "<Title>),$If($Or(<Album Artist>="Brian Eno",$Contains(<Album Artist>,"Brian Eno")="T"),$IsNull(<DateCustom>,"("<Year (yyyy)>".00.00) "<Album>\<Track#>". "<Title>,"("<Year (yyyy)>.<DateCustom>") "<Album>\<Track#>". "<Title>),$If(<Genre>="Classical",$RSplit(<Composer>," ",1)" - "<Album>" ("<Year>")"\$If($Or(<Album Artist>="Various Artists",<Compilation>="Compilation"),<Track#>". "<Artist>" - "<Title>,<Track#>". "<Title>),$If($Or($IsMatch(<Album Artist>,"^The\s")="F",<Album Artist>="The The"),<Album Artist>\$IsNull(<DateCustom>,"("<Year (yyyy)>".00.00) "<Album>\$If($Or(<Album Artist>="Various Artists",<Compilation>="Compilation"),<Track#>". "<Artist>" - "<Title>,<Track#>". "<Title>),"("<Year (yyyy)>.<DateCustom>") "<Album>\<Track#>". "<Title>),$Sort(<Album Artist>)\$IsNull(<DateCustom>,"("<Year (yyyy)>".00.00) "<Album>\$If($Or(<Album Artist>="Various Artists",<Compilation>="Compilation"),<Track#>". "<Artist>" - "<Title>,<Track#>". "<Title>),"("<Year (yyyy)>.<DateCustom>") "<Album>\$If($Or(<Album Artist>="Various Artists",<Compilation>="Compilation"),<Track#>". "<Artist>" - "<Title>,<Track#>". "<Title>)))))))))
Last Edit: September 14, 2016, 08:03:30 PM by ssri

Steven

  • Administrator
  • Sr. Member
  • *****
  • Posts: 34364

Bee-liever

  • Member
  • Sr. Member
  • *****
  • Posts: 3840
  • MB Version: 3.6.8878 P
the update messed up my file organization rule below; it works fine after copying and pasting it in but it fails upon running it again

@ssri
did the update fix this for you?
using 3.0.6101.35142 and my organisation templates are still being rejected.
MusicBee and my library - Making bee-utiful music together

theta_wave

  • Sr. Member
  • ****
  • Posts: 680
the update messed up my file organization rule below; it works fine after copying and pasting it in but it fails upon running it again

@ssri
did the update fix this for you?
using 3.0.6101.35142 and my organisation templates are still being rejected.
Hi Bee-liever,

The 6101.35142 update allowed the file organization rule in reply #5 to work, whereas it was broken in the previous update.  The problem with the previous update to 6101 was that it messed up that organization rule (truncating it among other things) and I had to re-add the rule from a text file back up I had lying around.  If you have a backup of MB's %AppData%, they are in %AppData%\MusicBee\MusicBee3Settings.ini and its bak file too (provided they were not overwritten by the previous update).  To sum it up, if you ran the previous update to 6101, then your file organizational rules (if they approach the verbosity of mine) are likely to be broken by 6101 and will have to be re-added (like Steven suggested in reply #6).  I'm sorry for making this bug report.  :(

Of course, the reversion made MB eventually reject the initial virtualcode in the OP

Code
$If($Contains(<Path>,"I:\0_CD")="T",Sync,)

However, the workaround solution for me is

Code
$If($Contains(<Path>,0_CD)="T",Sync,)
Last Edit: September 16, 2016, 03:11:12 AM by ssri

Bee-liever

  • Member
  • Sr. Member
  • *****
  • Posts: 3840
  • MB Version: 3.6.8878 P
Doh!
Don't mind me
I realised a made a change to a custom tag and then forgot to update the template  ::)  :-[
MusicBee and my library - Making bee-utiful music together

theta_wave

  • Sr. Member
  • ****
  • Posts: 680
Doh!
Don't mind me
I realised a made a change to a custom tag and then forgot to update the template  ::)  :-[
Hehe, we all have those moments.  Last week I did something similar: posted a bug report and deleting it after finding out that it was a simple mistake on my part  ;D

Good to hear that your MB setup is back to normal.

psychoadept

  • Global Moderator
  • Sr. Member
  • *****
  • Posts: 10690
This is still a problem for me in 3.1.6167.

Saving this tag strips the quote marks out of it, and when MB is restarted it's totally gone from the virtual tag field:

$If($Contains(<Path>,"Music\Music")=T,M,$If($Contains(<Path>,"Inbox")=T,I,$If($Contains(<Path>,"Audiobooks")=T,A,$If($Contains(<Path>,"Podcasts")=T,P,?))))

The backslash seems to be the problem character; if I take that out, the quotes are still stripped but the whole thing isn't deleted, at least.
MusicBee Wiki
Use & improve MusicBee's documentation!

Latest beta patch (3.5)
(Unzip and overwrite existing program files)

Steven

  • Administrator
  • Sr. Member
  • *****
  • Posts: 34364
i dont plan to fix this bug as whenever i attempt to do so, it only ends up causing problems.
I might look at creating a function $Text() or some other approach

psychoadept

  • Global Moderator
  • Sr. Member
  • *****
  • Posts: 10690
That sounds good.  Maybe in the meantime, you could set MB to not validate a formula that will be messed up?  Or give some other warning?
MusicBee Wiki
Use & improve MusicBee's documentation!

Latest beta patch (3.5)
(Unzip and overwrite existing program files)