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: Display filename instead of title tag in specific cases (Read 1811 times) previous topic - next topic
0 Members and 1 Guest are viewing this topic.

Display filename instead of title tag in specific cases

Hi guys.

I have a very specific file formatting question that someone here can probably answer. I've been looking at title formatting syntax reference, but I can't for the life of me wrap my head around the functions.

How would I go about modifying this string to make it so that if the file is midi, display filename with extension, and for everything else display title (as it is now).
Code: [Select]
$get(head)Title: $get(info)[%title%]$char(10)
made of radiation

Display filename instead of title tag in specific cases

Reply #1
Maybe something like this:

Quote
$if($strstr(%filename_ext%,'.mid'),%filename_ext%,$get(head)Title: $get(info)[%title%]$char(10))
Windows 10 Pro x64 // foobar2000 1.3.10

Display filename instead of title tag in specific cases

Reply #2
Thanks very much. It was almost perfect, I needed to modify it a little though. Turns out the $get(info) was used to fetch colors for the text, so I had to cut&paste that in the right place.

This ended up being perfect.
Code: [Select]
$get(head)Title: $get(info)$if($strstr(%filename_ext%,'.mid'),%filename_ext%,[%title%])$char(10)


Thanks again.
made of radiation

Display filename instead of title tag in specific cases

Reply #3
I don't think there's any need for the square brackets around %title% since it falls back to the file name. It might also be better to use the codec instead of the file name since there are a number of different extensions for midi files.

Code: [Select]
$get(head)Title: $get(info)%title%$if($stricmp(%codec%,mid),.$ext(%filename_ext%),)$char(10)

 

Display filename instead of title tag in specific cases

Reply #4
That's a good point about the different extensions. I ended up combining the two into this. Seems to be working splendidly for midis and hasn't broken anything else I've thrown at it.

Code: [Select]
$get(head)Title: $get(info)$if($stricmp(%codec%,mid),%filename_ext%,%title%)$char(10)
made of radiation