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 Formatting Syntax Reference help (Read 3144 times) previous topic - next topic
0 Members and 1 Guest are viewing this topic.

Title Formatting Syntax Reference help

Hi

I've not been using Foobar2000 that long and don't understand how to convert an album into a folder the way I want, or how to put different tracks from different albums into a folder and have it set out the way I want.

I have a few tracks from different albums which I want to put into a folder called: 'Compilation'.

What I want to see is:

Compilation>Artist name - Title of track
I want to keep all tracks from the same album together so that they play one after another.

The other way I would like the folders to look, is if I was converting a number of albums from the same Artist/Group.
I would like the folders to look like this after the conversion had been done:

Artist/Group>Year (album was released)>Title of album>Tracks

I'm not sure how to achieve this?

Any help will much appreciated








Re: Title Formatting Syntax Reference help

Reply #1
Anyone?

Re: Title Formatting Syntax Reference help

Reply #2
Read the wiki:
http://wiki.hydrogenaud.io/index.php?title=Foobar2000:Title_Formatting_Reference

It wasn't clear if you are trying to reorganize your music folders on your storage device using foobar or you are trying to modify how foobar displays said folders for you.

Compilation>Artist name - Title of track
I'd suggest filling your ALBUM ARTIST tags if you don't have them yet. Multiple artists might have contributed to the same album and if you don't use ALBUM ARTIST, they will all end up in separate folders. Then you can use:
Code: [Select]
Compilation\%album artist% - %title%

The other way I would like the folders to look, is if I was converting a number of albums from the same Artist/Group.
I would like the folders to look like this after the conversion had been done:
Artist/Group>Year (album was released)>Title of album>Tracks
Code: [Select]
%album artist%\%date%\%album%\%title%



Re: Title Formatting Syntax Reference help

Reply #3
How can I get the actual value of the albumartist tag, and not fb2k's cycling through 'artist' 'albumartist', etc?

$meta(album artist) / $meta(albumartist) doesn't seem to work, or I'm doing something incorrectly.

I'm needing to display an artist's name only if there is no album artist tag. It's intended to be part of a longer formatting function that removes the album artist name if it's redundantly displayed in track artist, but so far nothing has worked.

This is what I'm currently using, sans the albumartist tag checking bit which I haven't been able to get working as adding additional ifs, or ifequals using strcmp, has only added the album artist where I want it hidden. It's quite frustrating.

Code: [Select]
$if(%title%,$if(%bonus%,$rgb(126,126,126)%title%,%title%),%filename_ext%)[$rgb(126,126,126) · $if(%track artist%,$replace($replace(%track artist%,%album artist%,'$REM$'),'$REM$, ',,', $REM$',),)]

The above replaces were added as I couldn't find a way to remove a single value from multi-field tag (ie: one artist tag from multiple artist tags) without foobar2000 adding the additional commas prior to removal.

Re: Title Formatting Syntax Reference help

Reply #4
Edit, apologies, had a few tabs open and thought this was an official title formatting thread (which would be useful actually). Feel free to delete my above post, I'll probably make a thread about it.

Re: Title Formatting Syntax Reference help

Reply #5
Again, the wiki is your friend:
http://wiki.hydrogenaud.io/index.php?title=Foobar2000:Title_Formatting_Reference

How can I get the actual value of the albumartist tag, and not fb2k's cycling through 'artist' 'albumartist', etc?
Code: [Select]
$meta(album artist)

I'm needing to display an artist's name only if there is no album artist tag. It's intended to be part of a longer formatting function that removes the album artist name if it's redundantly displayed in track artist, but so far nothing has worked.
Example:
Code: [Select]
$if($meta(album artist),,$meta(artist))
But are you sure you aren't going backwards about this? I personally always fill the ALBUM ARTIST tag and use %track artist% or similar where applicable.

I couldn't find a way to remove a single value from multi-field tag (ie: one artist tag from multiple artist tags) without foobar2000 adding the additional commas prior to removal.
Probably should be doable but the code would be really messy. Where do you want to use this exactly? There's probably a more elegant way to achieve what you want.

Re: Title Formatting Syntax Reference help

Reply #6
Been busy and have only just come back to this thread.
@Daeron: Thanks for your reply. I will try your suggestions out.

Re: Title Formatting Syntax Reference help

Reply #7
Again, the wiki is your friend:
http://wiki.hydrogenaud.io/index.php?title=Foobar2000:Title_Formatting_Reference

Example:
Code: [Select]
$if($meta(album artist),,$meta(artist))
But are you sure you aren't going backwards about this? I personally always fill the ALBUM ARTIST tag and use %track artist% or similar where applicable.

Thanks for the reply. Yeah, either had the local help file or the the wiki page open throughout.

The reason for checking if albumartist is blank is for a Various artists category, where I don't like to fill the albumartist tag if there isn't one and instead rely on a directory path with some Facets grouping headings.

I realize what caused me to think my attempts weren't working: I have a Stevie Wonder album right above a Various album, and I used it most of the time to check if the formatting was working correctly at each attempt against the Various album. Turns out the Wonder album didn't have an albumartist tag set so I incorrectly thought the formatting wasn't working!

Here's the working code:

Code: [Select]
$if($meta(album artist),$if(%track artist%,$replace($replace(%track artist%,%album artist%,'$REM$'),'$REM$, ',,', $REM$',),),$meta(artist))

This is what one Various album now looks like with the formatting appended to the end of a Title column:



And on a non-Various album:



I'm hoping sometime to find a way of removing the individual track artist(s) if one or more is already contained in the title with '(feat. )', but I haven't quite figured that one out yet. As you can see above it's a bit redundant for some releases.

Re: Title Formatting Syntax Reference help

Reply #8
I'm hoping sometime to find a way of removing the individual track artist(s) if one or more is already contained in the title with '(feat. )', but I haven't quite figured that one out yet. As you can see above it's a bit redundant for some releases.
That alone shouldn't be hard. This writes ARTIST only if that is not present in TITLE.
Code: [Select]
$if(
$strstr(%title%,%artist%)
,
,%artist%
)
You may want to consider simply hunting down these occurrences and fixing the tags in the first place which would render the script above obsolete. Library/Search with this query will show the problematic files (and most likely false positives as well):
Code: [Select]
"$strstr(%title%,%artist%)" IS 1

Note that this also works, in case you want to include 'feat. ' or something similar in your search:
Code: [Select]
$strstr(%title%,'feat. '%artist%)
If your search term contains special characters used in titleformatting, like () [] , you will want to enclose them with ' ' as I did with the example above (even though there it wasn't really necessary).

The reason for checking if albumartist is blank is for a Various artists category, where I don't like to fill the albumartist tag if there isn't one and instead rely on a directory path with some Facets grouping headings.
Is this still ultimately trying to get rid of the ARTIST string in case it's already present in TITLE? What's the point in bringing ALBUM ARTIST into this if ARTIST and TITLE seemingly has all the information you need to work with?

I realize what caused me to think my attempts weren't working: I have a Stevie Wonder album right above a Various album, and I used it most of the time to check if the formatting was working correctly at each attempt against the Various album. Turns out the Wonder album didn't have an albumartist tag set so I incorrectly thought the formatting wasn't working!
One of the reasons I personally make sure my ALBUM ARTIST tag is always filled. And have a couple checks in my columns that warn if it's missing (or any other critical tag that I'm making sure are properly maintained). Easier than wondering if ALBUM ARTIST was purposely not filled or I simply forgot.

Which playlist viewer is that by the way?

Re: Title Formatting Syntax Reference help

Reply #9
That alone shouldn't be hard. This writes ARTIST only if that is not present in TITLE.
Code: [Select]
$if(
$strstr(%title%,%artist%)
,
,%artist%
)

Tested this in Text Display but it doesn't catch the artist, maybe since mine are contained in multiple artist tags? Not exactly sure why it doesn't.

You may want to consider simply hunting down these occurrences and fixing the tags in the first place which would render the script above obsolete. Library/Search with this query will show the problematic files (and most likely false positives as well):
Code: [Select]
"$strstr(%title%,%artist%)" IS 1

The tags are correct, in that I always add multiple values for the artist tag: for the main artist(s), and the featured artists. Since I like to display track artists in the playlist panel to see who is a contributing artist (especially useful for compilation albums) the goal is to cut down on redundancy when choosing what is displayed, which is why I remove the main artist from the track artist formatting if it's the same as albumartist (no idea why foobar2000 even adds this, since the docs state it shouldn't [1]).

I also use 'feat.' for certain track titles where appropriate and similarly in such cases would ideally like to exclude in the track artist any artists mentioned in the title (worth noting sometimes only one artist is in 'feat.' while lesser artists remain solely in the track artist tags).

[1] %track artist%: "Name of the artist of the track; present only if %album artist% is different than %artist% for specific track." Yet foobar2000 still displays the album artist as a track artist when the track contains multiple artists tag. Would be nice to see omitted by default.

Tested the above filter and only two results were returned though, both which had the artist name at the very beginning of the track title and only had a single artist tag in the file.

Note that this also works, in case you want to include 'feat. ' or something similar in your search:
Code: [Select]
$strstr(%title%,'feat. '%artist%)
If your search term contains special characters used in titleformatting, like () [] , you will want to enclose them with ' ' as I did with the example above (even though there it wasn't really necessary).

Tried this as well but had the same result as the first code quoted, still displaying the artists. Wondering if foobar2000 even recognizes multiple artist tags when using $strstr().

Is this still ultimately trying to get rid of the ARTIST string in case it's already present in TITLE? What's the point in bringing ALBUM ARTIST into this if ARTIST and TITLE seemingly has all the information you need to work with?

Different intention there. The albumartist checking in that case was for 'Various' type releases where there is no sole album artist, so I intentionally leave the tag blank and since my existing formatting didn't account for it (and so didn't display any track artist in grey next to the track title) it needed updating.

Which playlist viewer is that by the way?

marc2003's mod of Br3tt's JSPlaylist for JScript Panel.

Re: Title Formatting Syntax Reference help

Reply #10
Tested this in Text Display but it doesn't catch the artist, maybe since mine are contained in multiple artist tags?
Involving multiple artists would complicate the script to the point where I would simply not bother personally. You can retrieve one artist at a time from your multivalue tag using '$meta(artist,0)', '$meta(artist,1)' and so on. In which case you could compare them one by one to TITLE as shown in my previous example and act accordingly.

Or you could analyze TITLE and look for '(feat. ' and the next following ')', check which positions those were at and cut the string (the artist) located between those, then use that to replace matching parts in ARTIST with nothing. Both should be doable as far as I can tell but would be really messy coding.

I'd rather just change the tags if you are not satisfied with them or live with them.

Re: Title Formatting Syntax Reference help

Reply #11
Involving multiple artists would complicate the script to the point where I would simply not bother personally. You can retrieve one artist at a time from your multivalue tag using '$meta(artist,0)', '$meta(artist,1)' and so on. In which case you could compare them one by one to TITLE as shown in my previous example and act accordingly.

Or you could analyze TITLE and look for '(feat. ' and the next following ')', check which positions those were at and cut the string (the artist) located between those, then use that to replace matching parts in ARTIST with nothing. Both should be doable as far as I can tell but would be really messy coding.

I'd rather just change the tags if you are not satisfied with them or live with them.

It really is a frustrating aspect of foobar2000's current formatting limitations. Multiple artist tags are a common, correct, and a standard way of adding multiple artists. They are supported in Windows natively, and almost every other audio program that supports metadata.

Without any regex function (like Mp3Tag has and which is incredibly useful) this results in the need for needlessly complex formatting each time the user needs to match a string in a multi-field tag.

foobar2000 needs a better way of matching such multiple tags with its functions rather than having to deal with always treating it as a single all-in-one-line tag that fails to match when compared. It not only affects string matching but the ubiquitous %track artist%, where due to fb2k's handling of multi-artist fields it displays the album artist if the album artist is also an artist in a multi-artist tag (which is a pretty standard way of tagging files since the album artist is typically an artist on each track). It makes %track artist% no different from %artist% in such cases, requiring additional formatting to clean up.

Re: Title Formatting Syntax Reference help

Reply #12
Since you have a narrow playlist, why not enable the extra line and display the artist under the title?



It might seem redundant on single artist albums but I don't care about that.

Re: Title Formatting Syntax Reference help

Reply #13
Since you have a narrow playlist, why not enable the extra line and display the artist under the title?



It might seem redundant on single artist albums but I don't care about that.

I do like the feature of the second line in JSPlaylist, though it's not something I use at the moment since each track takes up more space and with my formatting would be blank half the time... and also because it makes the padding funny on the group header :P

BTW, do you happen to know what the 'Extra Rows to Add' field does in JSPlaylist, under the Groups settings? Added various values but nothing visibly changed. Was hoping it was a way to add extra rows in the group header, since the size '4' header has unused extra space for a row.

Re: Title Formatting Syntax Reference help

Reply #14
Extra rows to add inserts rows between groups. Add 2 or more albums to a playlist to see it.

Re: Title Formatting Syntax Reference help

Reply #15
Is there a way to change nested variables multiple times?
       
I have a $puts() variable that has a single value within it. Is it possible to create a nested variable within it that changes this single value whenever I enter a new variable value?

Example: I create a variable 'match' with a nested variable containing a single value '0' and name it 'no'. Is there a way of change the 'no' value after calling 'match' each time?

Code: [Select]
$puts(no,0)
$puts(match,$if($strstr(%title%,$meta(artist,$get(no))),,$meta(artist,$get(no))))

$get(match)$puts(no,1)
$get(match)$puts(no,2)

In my tests the 'no' variable doesn't change to '1' or '2' for the next 'match'. Alright, so maybe I have to split the function into pieces?

Code: [Select]
$puts(mat,$if($strstr(%title%,$meta(artist,)
$puts(c,)),,$meta(artist,)
$puts(h,)))

$get(mat)0$get(c)0$get(h)
$get(mat)1$get(c)1$get(h)
But that doesn't work either. Tried wrapping the variable contents in single quotes as well in case fb2k was confused by the bare endings but that only output as plain text.

Is there no way to do this?