Skip to main content

Notice

Please note that most of the software linked on this forum is likely to be safe to use. If you are unsure, feel free to ask in the relevant topics, or send a private message to an administrator or moderator. To help curb the problems of false positives, or in the event that you do find actual malware, you can contribute through the article linked here.
Topic: %title%, %artist%, %track_artist% and %album% having fallbacks is stupid (Read 1612 times) previous topic - next topic
0 Members and 1 Guest are viewing this topic.

%title%, %artist%, %track_artist% and %album% having fallbacks is stupid

Note: crosspost from r/foobar2000 on reddit, with a few edits and left out the code part
Full title: %title%, %artist%, %track_artist% and %album% having fallbacks or dependencies is stupid for coding in Foobar2000

(Disclaimer: using v1.6.14 - because my setup)

First of all, what am I coding? Something utterly stupid. I have an Item Detail pane with in Columns UI setup that I want more tag aware than it is now. I wanted to make it check for the following tags:
- Track title
- Track artist
- Album
It would also show Date, track number with track total (if tag present), discnumber and disc total if there's more than 1 disc, etc.

And I want to look something like that:
Code: [Select]
"Track title"
Artist

Track #1 / 12 on Disc 1 of 2 from
Album

I want these to be tag aware if there's no title, it would show "No title tag" and the same for artist and album. If none of these were present, it would show "No relevant tags to show". Tracks and discs tags would only be present if one or multiple of them are present. "Album Artist" isn't meant to be used here, because this shows the currently playing track, not the current album.

After coding some custom tags checking into the box (since that's working, not going into it), I spent several hours writing and debugging to find out that:

%title% defaults to %filename% if it's empty with no workaround but to compare the damn string and to declare %title% empty if it returns the same string as %filename%.

%artist% can be multiple things it seems. First, it's the track artist. Oh, it's not there? Then, the album artist. Oh that's not there either? Then you must mean the Composer right? Not that? What about Performer? No... ok, then, it's empty for real. JFC!!

But then, why not just use %track artist%? Well, the issue is it's dependant to %album artist% being tagged and if they have the same value, %track artist% does not work, it returns an empty string!

Bonus: %album% also checks if a tag called "venue" is present as well... WHY? DO YOU HATE US THAT MUCH? That one isn't as common but still (unless you are a live or classical music affectionado)

Yes, everything I've said here is in the Title Formatting Syntax document easily available in the Help menu. Knowing about it is just half the battle. Then, you literally have 50 extra lines of code to check if a single f'ing field is empty or not! If %track artist% wasn't dependant on %album artist% having a different value, I would have been done already after spending 2-3 more hours banging my head at why my check of %title% and %filename% return a IF SYNTAX error. Now, I have to use %artist% and check EVERY. SINGLE. F'ING. FALLBACK. TAGS. For what? to check if a single field is actually empty.

@Peter , FOR THE LOVE OF GOD, for future v2 versions and even backport it to 1.6... introduce tags that just check the existence of ONE tag with no fallback whatsoever. If I want to know if the artist of a track exist, I should just use
Code: [Select]
$if(%artist%,do this,else do that)
without it returning a million other value if the first one is empty. People dev'ing their UI will thank you a whole damn lot.

Re: %title%, %artist%, %track_artist% and %album% having fallbacks is stupid

Reply #1
Nice to hear you have a strong opinion about how someone should write FREE software.

BTW. what's wrong with the $meta_ function family?

Re: %title%, %artist%, %track_artist% and %album% having fallbacks is stupid

Reply #2
After coding some custom tags checking into the box (since that's working, not going into it), I spent several hours writing and debugging to find out that:
https://wiki.hydrogenaud.io/index.php?title=Foobar2000:Title_Formatting_Reference#Remapped_metadata_fields , there you go. For queries you are also free to search for
artist HAS Sabbath
rather than
%artist% HAS Sabbath
if that better matches what you want.

Re: %title%, %artist%, %track_artist% and %album% having fallbacks is stupid

Reply #3
Nice to hear you have a strong opinion about how someone should write FREE software.

BTW. what's wrong with the $meta_ function family?
I can't express my frustration?

The Meta family, from my testing, has the same issue than the non-meta. $meta(artist) returns the same thing as %artist% if the field is empty. It follows the same hierarchy if one is empty: artist > album artist > composer > performer.

From the reddit thread, the person who replied posted this:
Code: [Select]
$if($and($meta(album artist),$not($strcmp($meta(artist),$meta(album artist)))),[$meta(artist)],)
If the original artist field is empty, it just goes into the "else" of the if.

After coding some custom tags checking into the box (since that's working, not going into it), I spent several hours writing and debugging to find out that:
https://wiki.hydrogenaud.io/index.php?title=Foobar2000:Title_Formatting_Reference#Remapped_metadata_fields , there you go. For queries you are also free to search for
artist HAS Sabbath
rather than
%artist% HAS Sabbath
if that better matches what you want.
If you read further, I mention this:
Yes, everything I've said here is in the Title Formatting Syntax document easily available in the Help menu.
I didn't mention it but I *did* try to search for solution but found absolutely nothing. And those "remapped" fields are just the same as those found in the help menu...

So, basically, for the artist it's...
Code: [Select]
$puts(artist-check,$meta(artist)) //put the value foobar finds for "artist" into variable)
$if($stricmp($get(artist-check),%performer%),Artist Field Empty Found Performer, //Check to see if we found performer in variable, otherwise, proceed to next check.
$if($stricmp($get(artist-check),%composer%),Artist Field Empty Found Composer, //Check to see if we found composer in variable, otherwise, proceed to next check
$if($stricmp($get(artist-check),%album artist%),Artist Field Empty Found Album Artist, //Check to see if we found Album Artist in variable, proceed to next check
$if($stricmp($get(artist-check),%artist%),Actual Track Artist Found And Exists,Error)))) //Finally, we are sure we have the artist of the track after checking all the fallbacks
Why do we have to check all that?? I just want to know the track's artist is present or not, not the album artist, the composer or the performer. That's my point. I repeat: both %artist% and $meta(artist) return the same value for me.
And this code only checks what the variable has, there's no code for my textbox in it which increase difficulty of understanding what I'm doing...

Re: %title%, %artist%, %track_artist% and %album% having fallbacks is stupid

Reply #4
Code: [Select]
$meta(artist)
returns only what is in the artist tag. If there is nothing in the artist tag, it will be blank, even if there is something in the Album Artist tag. I just verified for myself in the newest v2.1 beta, and it has always been like this since I started using foobar2000 in 2007. I don't know what else to tell you.
Think millionaire, but with cannons.

Re: %title%, %artist%, %track_artist% and %album% having fallbacks is stupid

Reply #5
Code: [Select]
$meta(artist)
returns only what is in the artist tag. If there is nothing in the artist tag, it will be blank, even if there is something in the Album Artist tag. I just verified for myself in the newest v2.1 beta, and it has always been like this since I started using foobar2000 in 2007. I don't know what else to tell you.
I swear to f'ing god, that I tried several times, just to get %album artist% every damn time when it was empty. I swear the universe is against me.

Somebody delete this thread outright.

Re: %title%, %artist%, %track_artist% and %album% having fallbacks is stupid

Reply #6
Sorry, but sounds like user error.

$meta(tag) always returns TAG and only that. No remappings.

Can you post a full list of components you are using?

Re: %title%, %artist%, %track_artist% and %album% having fallbacks is stupid

Reply #7
This thread is embarrassing, doesn't seem to know how to use $meta().

Re: %title%, %artist%, %track_artist% and %album% having fallbacks is stupid

Reply #8
That's why it is better to ask a question with the risk of being thought a fool, than make absolute statements and remove all doubt.

(OK, so I paraphrase!)
It's your privilege to disagree, but that doesn't make you right and me wrong.