Author Topic: separate field overrides Track Information  (Read 5710 times)

Steven

  • Administrator
  • Sr. Member
  • *****
  • Posts: 34346
It seems carrying markup over lines is too complicated so I have restricted the cases that is supported. I think it should work in your case now
https://getmusicbee.com/patches/MusicBee34_Patched.zip


Bee-liever

  • Member
  • Sr. Member
  • *****
  • Posts: 3833
  • MB Version: 3.6.8849 P
Looking fine  8)
Thank you Steven for all your work on MB throughout the year.
Merry Christmas to you and to all reading this thread.
MusicBee and my library - Making bee-utiful music together

The Incredible Boom Boom

  • Sr. Member
  • ****
  • Posts: 1269
I have updated it again as the intention was to carry the markup over the split lines which it wasnt doing in all cases
Should this work with existing scripts or do I have to format them differently?
Getting duplicates now with existing scripts

Code
{font: Segoe MDL2 Assets;Regular;9} {font: Verdana Pro Cond;Regular;8.25}$Replace($Replace(<Genre Groups>,/,"; "),"; ","; "{font: Segoe MDL2 Assets;Regular;9}{contrast: 1}" "{font: Verdana Pro Cond;Regular;8.25}{contrast: default}); {font: Segoe MDL2 Assets;Regular;9} {font: Verdana Pro Cond;Regular;8.25}$Replace($Replace(<Genres>,/,"; "),"; ","; "{font: Segoe MDL2 Assets;Regular;9}{contrast: 1}" "{font: Verdana Pro Cond;Regular;8.25}{contrast: default})

I've been experiencing this problem (I think it's the same) since this patch update and am just now getting around to sussing out how to fix it. Before this patch, I didn't have duplications with this particular Track Information code. Here's a representation. As displayed, both the track title and album name are duplicated.



Here are my Track Information settings and the problem field is the first one.



Here's the code for the tag. Splitting the tags into rows by semi-colon is what's causing the duplication. I've tried eliminating various pieces of it function-by-function and it doesn't display properly until I get down to the last components (basically meaning <LABEL> from...; <ALBUM DESCRIPTION> displays without duplication.) I've deleted functions in differing orders and there's no pattern I can discern to tell what's going wrong. I've replaced <LABEL> with <Title>, <ALBUM DESCRIPTION> with <Album> and <ORIGINAL/RELEASE> with <Year> and the incorrect result doesn't change. If explaining the code helps, I can add that if requested.

Code
$Replace($IsNull(<LABEL>,{font: Meiryo UI;Bold;10.5}$IsNull(<Work>,<ALBUM DESCRIPTION>,<WORK HEADER>),{font: Meiryo UI;Italic;10.5}$If($Or($Contains(<WORK HEADER>,$Replace(<LABEL>," in "<SONGKEY>,)),<LABEL>=<WORKSUBTITLE>),,$Replace(<LABEL​>,<EXTRA INFO>,)$IsNull(<Title>,,{font: Meiryo UI;Regular;10.5}" from")$If($Pad($Add($Len($Replace(<LABEL>,<EXTRA INFO>,)),$Len($Replace($If(<Genre>="Classical",<WORK HEADER>,<ALBUM DESCRIPTION>),<SETSUBTITLE>,))),3)>=070,...;," ")){font: Meiryo UI;Bold;10.75}$If(<Genre>="Classical",$IsNull(<Work>,<Album>,<WORK HEADER>$IsNull(<WORKSUBTITLE>,,$If($Contains(<LABEL>,<WORKSUBTITLE>)," ("<WORKSUBTITLE>")",))),$Replace(<ALBUM DESCRIPTION>,<ORIGINAL/RELEASE>,{font: Meiryo UI;Regular;7.25}<ORIGINAL/RELEASE>))),<SETSUBTITLE>,)

If I remove the semi-colon and the checkmark splitting the field into multiple rows, I get this as the result.



Removing the markup tags doesn't make any difference in either case.

The Incredible Boom Boom

  • Sr. Member
  • ****
  • Posts: 1269
I've reformatted the code so anyone can copy/paste it into their Track Information field panel and see if the results are replicated on their machine. It would be immensely helpful to know if this spacing issue is universal, or specific to my machine.

Code
$Replace($IsNull(<Title>,{font: Meiryo UI;Bold;10.5}$IsNull(<Work>,<Album>,"WORK"),{font: Meiryo UI;Italic;10.5}$If($Or($Contains("WORK",$Replace(<Title>," in ""SONGKEY",)),<Title>="WORKSUBTITLE"),,$Replace(<Title​>,"EXTRA INFO",)$IsNull(<Title>,,{font: Meiryo UI;Regular;10.5}" from")$If($Pad($Add($Len($Replace(<Title>,"EXTRA INFO",)),$Len($Replace($If(<Genre>="Classical","WORK",<Album>),"SETSUBTITLE",))),3)>=070,...;," ")){font: Meiryo UI;Bold;10.75}$If(<Genre>="Classical",$IsNull(<Work>,<Album>,"WORK"$IsNull("WORKSUBTITLE",,$If($Contains(<Title>,"WORKSUBTITLE")," (""WORKSUBTITLE"")",))),$Replace(<Album>,<Year>,{font: Meiryo UI;Regular;7.25}<Year>))),"SETSUBTITLE",)
Last Edit: March 12, 2021, 06:15:38 PM by The Incredible Boom Boom

hiccup

  • Sr. Member
  • ****
  • Posts: 7856
That code doesn't function at all on my system, it just shows the formula. But that could be because I have no <LABEL> tag, and I have no Meiryo font on my system.
Also, the formula is quite complicated and hard to decipher. Isn't there a simpler formula that narrows down the issue at hand?

The Incredible Boom Boom

  • Sr. Member
  • ****
  • Posts: 1269
That code doesn't function at all on my system, it just shows the formula. But that could be because I have no <LABEL> tag, and I have no Meiryo font on my system.
Also, the formula is quite complicated and hard to decipher. Isn't there a simpler formula that narrows down the issue at hand?

The one I posted above your response has generic tags, rather than my specific ones, so it should work anywhere. I did leave the font tags in, because they may be part of the problem, but the names can be changed to whatever one's system has available.

What makes it difficult to debug is I have to cut out pretty much everything other than <Title> from... <Album> in order for it to display properly. I've tried cutting out various different parts and it won't display correctly until pretty much just those fields are left. I guess for now, I'd just like to see if the spacing problems persist on someone else's machine.

At it's most basic form, the code is supposed to display:

<Title> from <Album>

...if the track is not a classical or operatic piece, else it displays

<Title> from <Work>

Before @Steven added the ability to give each field in the Track Information panel its own split-row values, I used the length of the title and album name + original and release years to determine whether the display needed to be split after "from." So...

<Title> from...
<Album>/<Work>
Last Edit: March 12, 2021, 05:16:32 PM by The Incredible Boom Boom

hiccup

  • Sr. Member
  • ****
  • Posts: 7856
The one I posted above your response has generic tags, rather than my specific ones, so it should work anywhere.
label is not a generic tag

The Incredible Boom Boom

  • Sr. Member
  • ****
  • Posts: 1269
The one I posted above your response has generic tags, rather than my specific ones, so it should work anywhere.
label is not a generic tag

<LABEL> isn't in this version. I replaced all the Virtual Tags before I posted it.

I've reformatted the code so anyone can copy/paste it into their Track Information field panel and see if the results are replicated on their machine. It would be immensely helpful to know if this spacing issue is universal, or specific to my machine.

Code
$Replace($IsNull(<Title>,{font: Meiryo UI;Bold;10.5}$IsNull(<Work>,<Album>,"WORK"),{font: Meiryo UI;Italic;10.5}$If($Or($Contains("WORK",$Replace(<Title>," in ""SONGKEY",)),<Title>="WORKSUBTITLE"),,$Replace(<LABEL​>,"EXTRA INFO",)$IsNull(<Title>,,{font: Meiryo UI;Regular;10.5}" from")$If($Pad($Add($Len($Replace(<Title>,"EXTRA INFO",)),$Len($Replace($If(<Genre>="Classical","WORK",<Album>),"SETSUBTITLE",))),3)>=070,...;," ")){font: Meiryo UI;Bold;10.75}$If(<Genre>="Classical",$IsNull(<Work>,<Album>,"WORK"$IsNull("WORKSUBTITLE",,$If($Contains(<Title>,"WORKSUBTITLE")," (""WORKSUBTITLE"")",))),$Replace(<Album>,<Year>,{font: Meiryo UI;Regular;7.25}<Year>))),"SETSUBTITLE",)



Bee-liever

  • Member
  • Sr. Member
  • *****
  • Posts: 3833
  • MB Version: 3.6.8849 P
Sorry I can't get your code to work, but I'm assuming that this is the problem part
Code
$If(<Genre>="Classical","WORK",<Album>),"SETSUBTITLE",))),3)>=070,...;," ")

Try changing the semi-colon [;] to semi-colon+space [; ]
The splitter is really that combination and maybe Steven tightened up the code for this.
MusicBee and my library - Making bee-utiful music together

The Incredible Boom Boom

  • Sr. Member
  • ****
  • Posts: 1269
Sorry I can't get your code to work, but I'm assuming that this is the problem part
Code
$If(<Genre>="Classical","WORK",<Album>),"SETSUBTITLE",))),3)>=070,...;," ")

Try changing the semi-colon [;] to semi-colon+space [; ]
The splitter is really that combination and maybe Steven tightened up the code for this.

So, your direct suggestion didn't work.  :-\
However...
This morning, I started rebuilding the code, function-by-function with copy/paste, and leaving the completed code also in the panel field as a guide. After confirmation the pasted function worked, I would remove it from the portion being used as a guide. Like below.

paragraph 1: nothing
paragraph 2: function1() function2() function3()

paragraph 1: function1()
paragraph 2: function2() function3()

paragraph 1: function1() function2()
paragraph 2: function3()

paragraph 1: function1() function2() function3()
paragraph 2: nothing

The code worked perfectly until I removed function3() from paragraph 2, it reverted to the double display. ;:(
Before removing function3() from paragraph2, I noticed what seemed to be an extra ",)" at the end of it, so I added the two characters to the end of paragraph1 and...voila... the formatting displayed correctly... but with the comma and close parenthesis at the end. 🙄

<Title> from...
<Album>,)

I removed two characters and added a space per your suggestion - but the formatting still displayed incorrectly. I added a character after the space and it displayed correctly... but with the added character.

<Title> from...
<Album>a

I've now discovered that any character, with the exception of a whitespace, I attach to the end of the code results in correct formatting, which leads me to believe there might be an unclosed statement on @Steven's end of things. The code below should hopefully work on anyone's system. If the title and album are doubled on your end, add a character to the end of the code and it displays properly.

Code
$Replace($IsNull(<Title>,{font: Meiryo UI;Bold;12.5}$IsNull(<Work>,<Album>,<Work>),{font: Meiryo UI;Italic;12.5}$If($Or($Contains(<Work>,$Replace(<Title>," in SONGKEY",)),<Title>=WORKSUBTITLE>),,$RxReplace(<Title>,"\s\[.+\]","")$IsNull(<Title>,,{font: Meiryo UI;Regular;12.5}" from")$If($Pad($Add($Len($Replace(<Title>,EXTRA INFO,)),$Len($Replace($If(<Genre>="Classical",<Work>,<Album>),SETSUBTITLE,))),3)>=020,...;," ")){font: Meiryo UI;Bold;12.75}$If(<Genre>="Classical",$IsNull(<Work>,<Album>,<Work>$IsNull(WORKSUBTITLE>,,$If($Contains(<Title>,WORKSUBTITLE>)," ("WORKSUBTITLE>")",))),$Replace(<Album>,<Year>,{font: Meiryo UI;Regular;8.25}<Year>))),SETSUBTITLE,)
Last Edit: March 14, 2021, 05:20:17 PM by The Incredible Boom Boom

hiccup

  • Sr. Member
  • ****
  • Posts: 7856
I'm sorry man, <LABEL> is still there, and you adding a specific font isn't also making it easier to test it.
Apart from the font not being present on my system, the font size contains dots, while my region settings require comma's.
I hope somebody else can help in testing this, but it's too much of a hassle for me.

The Incredible Boom Boom

  • Sr. Member
  • ****
  • Posts: 1269
I'm sorry man, <LABEL> is still there, and you adding a specific font isn't also making it easier to test it.
Apart from the font not being present on my system, the font size contains dots, while my region settings require comma's.
I hope somebody else can help in testing this, but it's too much of a hassle for me.

Pasted the wrong one. Fixed it.