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: Parenthesis characters inside names (Read 2312 times) previous topic - next topic
0 Members and 1 Guest are viewing this topic.

Parenthesis characters inside names

I can't figure out how to add "(", ")", "[", "]", "{", "}" inside file names or tags without having foobar perform some kind of function on the name.

Parenthesis characters inside names

Reply #1
Use single quotes.

Also, read the Title formatting help.
Windows 10 Pro x64 // foobar2000 1.3.10

Parenthesis characters inside names

Reply #2
Thanks a lot, now i want them to appear only if a disc number is present so i need a way to make the %discnumber% invisible. I want to turn
Code: [Select]
'('[$num(%discnumber%,2)x]$num(%tracknumber%,2)')'
into
Code: [Select]
[$num(%discnumber%)'('][$num(%discnumber%,2)x]$num(%tracknumber%,2)[$num(%discnumber%)')']
but i want the first and last
Code: [Select]
[$num(%discnumber%)'(']
to only return the parenthesis if the disc number is present but not disc number. Is there a way to make that invisible? Am i doing it the correct way? I think i'm not.

Parenthesis characters inside names

Reply #3
Try this:
Code: [Select]
$if(%discnumber%,'('$num(%discnumber%,2)')')
Windows 10 Pro x64 // foobar2000 1.3.10

Parenthesis characters inside names

Reply #4
Thanks, first i did
Code: [Select]
$if(%discnumber%,'(',[%discnumber%])[$num(%discnumber%,2)x]$num(%tracknumber%,2)$if(%discnumber%,')',[%discnumber%])
then i simplified it to
Code: [Select]
$if(%discnumber%,'('[$num(%discnumber%,2)x]$num(%tracknumber%,2)')',[%discnumber%])
  and now i'm not sure if the last
Code: [Select]
[%discnumber%]
is redundant

LE: I guess it is redundant and so are the [] because i used an actual if statement so i'll turn that into

Code: [Select]
$if(%discnumber%,'('$num(%discnumber%,2)x$num(%tracknumber%,2)')')

Parenthesis characters inside names

Reply #5
In less complex expressions, you would be able to just put square brackets around everything that you wish to be displayed only if all fields therein are present, rather than having to use an if statement.

However, yours is more complex and calls for multiple sections that are only displayed if certain fields are also present. And to complicate it further, it depends upon two fields. Using square brackets will still work for central sections that actually contain the field in question, but those elsewhere will require $if statements. So, you were getting close!

I don’t quite understand what you want, but hopefully this will be helpful:

Code: [Select]
$puts(areThereAnyNumbers,$add($meta_num(discnumber),$meta_num(tracknumber)))
$ifgreater(areThereAnyNumbers,0,'(',)
[$num(%discnumber%,2)x][$num(%tracknumber%,2)]
$ifgreater(areThereAnyNumbers,0,')',)

Examples:
File with disc and track number: 04x55
File with only track number: 55
File with only disc number: Y U DO DIS
File with neither: [nothing]

You might also want to include spaces before and after your opening and closing brackets respectively, depending upon where and how you want this optional string to be displayed.

If this is way off the mark, just say!

Parenthesis characters inside names

Reply #6
What is the point of $num(%tracknumber%,2)?

foobar2000 toolbar->Help->Title formatting help:
Quote
      Syntax:   %tracknumber%
Description:   Two-digit index of specified track within the album. Available only when “tracknumber” field is present in track’s metadata.


Regarding setup of the "discnumber/tracknumber" playlist viewer column display...

For quite a long time, I used this script:
     $if($and($or(%discnumber%,$meta(discid)),%tracknumber%),
   [$if2(%discnumber%'.',$meta(discid)'.')][%tracknumber%'.'],
   $if($or(%discnumber%,$meta(discid)),[$if2(%discnumber%'.',$meta(discid)'.')]'??',
   [%tracknumber%'.'])
   )


But recently, I changed my mind and went back to this:
     [$if2(%discnumber%'.',$meta(discid)'.')][%tracknumber%'.']

Note: I add the discnumber to the <DISCID> tag in cue sheets ... hence the reason for $meta(discid).

Adding too much code to ones Playlist Viewer columns causes foobar2000 to not be as responsive as what it can be, therefore it is important to keep this fact in mind and review all parts of the configuration occasionally ...and eliminate redundancy and unnecessary logic as much as possible ...and remove ALL rarely or never used third-party components.

I have managed to bring my own foobar2000 (v1.1.10) down to 160 MB of memory at full steam, and it runs stable and rock solid.

Parenthesis characters inside names

Reply #7
What is the point of $num(%tracknumber%,2)?

It cleans up "stupid" track numbers like 02/12 , 03/12 that can be present in ID3v2.4 tags
In theory, there is no difference between theory and practice. In practice there is.

 

Parenthesis characters inside names

Reply #8
Ah yes, I see ...

However, configuring fb2k viewers to mask "stupid" fields will NEVER give you fingertip feedback about the properties of your music collection;
it essentially keeps your music collection in a state of permanent hidden "stupidity".

In my opinion, a much better method of managing this:

A) Such unwanted things are found to exist in your music collection, so you devote an hour of your life and deal with it, for once and for all !!
B) @fb2k Toolbar    =>    Library    =>    Search (Media Library Search window pops up)
C) @fb2k Media Library Search window    =>    type:  %tracknumber% HAS /
D) @fb2k Media Library Search window populated list    =>    select all (CTRL+A)    =>    select right click context menu item: Properties
E) @fb2k Properties window    =>   double click "Track Number" metadata name
F) @fb2k Properties/Edit Value: Track Number window    =>    edit all lines of Track Number column
G) The End    =>    Amen