|
Post by GoneMAD on Apr 11, 2020 16:18:24 GMT -5
It actually looks like the $notpty() function is working, as tracks in this case that have no composer don't show anything as expected. However for tracks with a composer tag they are not being displayed with the actual data, but instead literally are displaying "%cp%" as a string now. G yeah try using $if3 (you can simply replace notempty with if3 and leave the rest as is) When adding all the new functions i had to change some things around to allow functions inside functions. I most likely didnt apply that same change to the beta 3 functions (or some of them at least), so its not evaluating the variable
|
|
|
Post by MotleyGord on Apr 13, 2020 15:47:25 GMT -5
So I tried various ways using $if3, and only had success if including at least the comma separator and a space as a minimum. Without the "else" the $if3 function seems to fail.
In the previous beta using $notempty() in a separate line in the json file would actually NOT add a line space if the field was evaluated as empty. So in my case using it as $notempty(%cp%) on a separate line, files that have a composer were displayed as expected, and those without had no extra line space added.
I'm sure this will get resolved as you get a chance to review further. Just trying to provide some clarity on the change from 3b to 4 G
|
|
|
Post by GoneMAD on Apr 13, 2020 18:51:39 GMT -5
yea looks like i forgot that i strip out empty parameters; either way i fixed $notempty
|
|
|
Post by MotleyGord on Apr 16, 2020 14:01:40 GMT -5
Updated to beta4a, thanks! Appears that $notempty is functioning as expected again.
There is something I have been trying to accomplish but seems to not work. The purpose is to avoid having a duplicate field showing up for album titles when they match the album artist, i.e. self-titled albums. I am looking to show one of two options; IF %aa% is the same as %al% then display "Album • year". However if %aa% and %al% don't match, display as "Artist • Album • year".I tried it this way; "$if($stricmp(%aa%,%al%),,%ar% • )%al% • %yr%" using the examples like on the first post here and the hydrogen site.
Ex. with %aa%=%al% should display as; Dazed And Confused Led Zeppelin • 1969
Ex. with %aa%≠%al% should display as; Kasmir Led Zeppelin • Physical Graffiti • 1975
Ideally I'd like to find a function that would confirm "true" if a string or field is found anywhere within the contents of another string or field so that this would be valid for finding say %aa% within %al%, like %aa% is "John Lennon" and %al% is "The John Lennon Collection" so I could apply the same logic as above. But for now I would be fine with an exact match of album and album artist to work.
Any suggestions?
|
|
|
Post by GoneMAD on Apr 16, 2020 15:33:53 GMT -5
Updated to beta4a, thanks! Appears that $notempty is functioning as expected again. There is something I have been trying to accomplish but seems to not work. The purpose is to avoid having a duplicate field showing up for album titles when they match the album artist, i.e. self-titled albums. I am looking to show one of two options; IF %aa% is the same as %al% then display "Album • year". However if %aa% and %al% don't match, display as "Artist • Album • year".I tried it this way; "$if($stricmp(%aa%,%al%),,%ar% • )%al% • %yr%" using the examples like on the first post here and the hydrogen site. Ex. with %aa%=%al% should display as; Dazed And Confused Led Zeppelin • 1969 Ex. with %aa%≠%al% should display as; Kasmir Led Zeppelin • Physical Graffiti • 1975 Ideally I'd like to find a function that would confirm "true" if a string or field is found anywhere within the contents of another string or field so that this would be valid for finding say %aa% within %al%, like %aa% is "John Lennon" and %al% is "The John Lennon Collection" so I could apply the same logic as above. But for now I would be fine with an exact match of album and album artist to work. Any suggestions? This is a fun one. I think this would work "$ifequal($strstr(%aa%,%al%),-1,%ar% • )%al% • %yr%" $strstr and $strchr return -1 if str1 is not found in str2 glad to see people creating some complex lines. If your stuff isnt tagged in the same case you might have to do a $lowercase on both aa and al since strstr is case sensitive
|
|
|
Post by MotleyGord on Apr 16, 2020 17:23:50 GMT -5
Updated to beta4a, thanks! Appears that $notempty is functioning as expected again. There is something I have been trying to accomplish but seems to not work. The purpose is to avoid having a duplicate field showing up for album titles when they match the album artist, i.e. self-titled albums. I am looking to show one of two options; IF %aa% is the same as %al% then display "Album • year". However if %aa% and %al% don't match, display as "Artist • Album • year".I tried it this way; "$if($stricmp(%aa%,%al%),,%ar% • )%al% • %yr%" using the examples like on the first post here and the hydrogen site. Ex. with %aa%=%al% should display as; Dazed And Confused Led Zeppelin • 1969 Ex. with %aa%≠%al% should display as; Kasmir Led Zeppelin • Physical Graffiti • 1975 Ideally I'd like to find a function that would confirm "true" if a string or field is found anywhere within the contents of another string or field so that this would be valid for finding say %aa% within %al%, like %aa% is "John Lennon" and %al% is "The John Lennon Collection" so I could apply the same logic as above. But for now I would be fine with an exact match of album and album artist to work. Any suggestions? This is a fun one. I think this would work "$ifequal($strstr(%aa%,%al%),-1,%ar% • )%al% • %yr%" $strstr and $strchr return -1 if str1 is not found in str2 glad to see people creating some complex lines. If your stuff isnt tagged in the same case you might have to do a $lowercase on both aa and al since strstr is case sensitive So far no dice. But will work through it more a little later. Thanks for the tip though! G
|
|
|
Post by MotleyGord on Apr 16, 2020 20:05:05 GMT -5
If I simply use this function as a line $strstr(%al%,%aa%) it always returns a 0 (zero) whether the string %aa% is found anywhere within %al% or not.
|
|
|
Post by GoneMAD on Apr 17, 2020 1:06:29 GMT -5
If I simply use this function as a line $strstr(%al%,%aa%) it always returns a 0 (zero) whether the string %aa% is found anywhere within %al% or not. ha.. yea thats a bug private fun cmdStrStr(metadata: MetadataText, splitContent: Array<String>): String { val str = replaceFields(splitContent.getOrNull(0), metadata) val str2 = replaceFields(splitContent.getOrNull(1), metadata)
return str.indexOf(str).toString() }
its checking itself instead of the other string. will fix..
|
|
|
Post by viper21 on Apr 17, 2020 2:36:46 GMT -5
It would be great if you could add one simple and one complex example for each of the $if, $if2, and $if3 functions on the first page of this thread. For example, each one has different terms, such as expression, condition, and argument. I am not a programmer and without the examples I can't reverse engineer the logic and figure out the nuances.
I need help with the following:
1. Also, in one of the threads, you said that %yr% cannot be empty. It'll be 0 if nothing was ever set, therefore we should use $if3 instead of $notempty for displaying the year only when it has a real value. Can you please provide the string I need to add to my json? Just "$if3(%yr%)"?
2. My other issue is with $ifgreater(%ra%,0,$rating(%ra%)). It's still displaying 5 empty stars when the track has no rating. It should not be showing any stars at all. I am I doing something wrong with the function?
|
|
|
Post by GoneMAD on Apr 17, 2020 10:35:07 GMT -5
It would be great if you could add one simple and one complex example for each of the $if, $if2, and $if3 functions on the first page of this thread. For example, each one has different terms, such as expression, condition, and argument. I am not a programmer and without the examples I can't reverse engineer the logic and figure out the nuances. I need help with the following: 1. Also, in one of the threads, you said that %yr% cannot be empty. It'll be 0 if nothing was ever set, therefore we should use $if3 instead of $notempty for displaying the year only when it has a real value. Can you please provide the string I need to add to my json? Just "$if3(%yr%)"? 2. My other issue is with $ifgreater(%ra%,0,$rating(%ra%)). It's still displaying 5 empty stars when the track has no rating. It should not be showing any stars at all. I am I doing something wrong with the function? The documentation provided is more than plenty. i am not providing detailed examples for every function. The API (and documentation) is identical to foobar2000 so you can google examples for that. for %yr% you can use $ifequal(%yr%,0,,%yr%). IF year equals 0 then show nothing else show year i get the same issue with the rating line so i'll look into that. My guess is functions inside the 'else' or 'then' parameters arent working
|
|
|
Post by GoneMAD on Apr 17, 2020 10:56:16 GMT -5
okay so it looks $ifgreater(%ra%,0,$rating(%ra%)) is not going to work for the time being. i know the issue but unfortunately i dont have a solution for the problem
|
|
|
Post by GoneMAD on Apr 17, 2020 13:04:39 GMT -5
okay so it looks $ifgreater(%ra%,0,$rating(%ra%)) is not going to work for the time being. i know the issue but unfortunately i dont have a solution for the problem nevermind i thought of something that would work. I will add an optional extra parameter to $rating that will not show anything if rating is 0 or something like that
|
|
|
Post by MotleyGord on Apr 17, 2020 14:14:07 GMT -5
If I simply use this function as a line $strstr(%al%,%aa%) it always returns a 0 (zero) whether the string %aa% is found anywhere within %al% or not. ha.. yea thats a bug private fun cmdStrStr(metadata: MetadataText, splitContent: Array<String>): String { val str = replaceFields(splitContent.getOrNull(0), metadata) val str2 = replaceFields(splitContent.getOrNull(1), metadata)
return str.indexOf(str).toString() }
its checking itself instead of the other string. will fix.. OK, for now I will go back to using the function $stricmp() to get the initial one working.
|
|
|
Post by MotleyGord on Apr 17, 2020 14:19:10 GMT -5
Here is the code I have put together to display like this [note that Artist and the following • do NOT appear if the album artist matches the album title (self titled releases)]; Track Artist • Album (Year) Composer Sample Rate Bit Rate FORMAT Here is the code; [ { "markupLines" : [ ["<align=center><typeface=sans-serif-black><size=24><wrap>%tr%"], ["<align=center><typeface=sans-serif><size=16><color=accent><wrap>$ifequal($stricmp(%al%,%aa%),0,,%ar% •) %al% (%yr%)"], ["<align=center><typeface=sans-serif><size=16><color=secondary><wrap><i>$notempty(%cp%)</i>"], ["<size=10><blank>"], ["<align=left><typeface=sans-serif><size=10><color=secondary>%sr%Hz", "<align=center><typeface=sans-serif><size=10><color=secondary>%br%kbps", "<align=right><typeface=sans-serif><size=10><color=secondary>$upper(%ext%)"] ] } ]
|
|
|
Post by MotleyGord on Apr 17, 2020 15:24:07 GMT -5
Note sure if this is by design or a bug, but any trailing spaces in IF statements that are expected to be displayed are being dropped.
I used this line where the red underscore is actually a space $ifequal($stricmp(%al%,%ar%),0,,%ar% •)_%al% (%yr%) but it adds an unnecessary space in the actual display before %al% if the IFEQUAL returns true. I would prefer to use it the following way with the space moved inside the IF statement $ifequal($stricmp(%al%,%ar%),0,,%ar% •_)%al% (%yr%) but this space is being dropped when displayed in GMMP.
Same will go for this when $strstr is fixed, so it will look like this $ifequal($strstr($lower(%al%),$lower(%ar%)),-1,%ar% •_,)%al% (%yr%) This will enhance the current display such that any album title that contains the artist name anywhere will not be duplicated, i.e. and songs from "The Beatles Greatest Hits" will not show "The Beatles" as an artist, but songs from "Abbey Road" will. I Assume there is no function like $stristr that would be case-insensitive? G
|
|