IPB

Welcome Guest ( Log In | Register )

> foobar2000 General Forum Rules

This is NOT a tech support forum.
Tech support questions go to foobar2000 Tech Support forum instead.

See also: Hydrogenaudio Terms of Service.

 
Reply to this topicStart new topic
Output parentheses in foobar
spuuunit
post Apr 10 2013, 22:21
Post #1





Group: Members
Posts: 110
Joined: 19-January 11
Member No.: 87437



I want to output the albumname, then the year inside of parentheses. If the info exists. Like this:

Serpent's Egg (1988)

this is my "code":

[%album% %date%]

but I can't write "(%date%)", 'cause then the year doesn't show at all. Maybe there's a way of showing these special signs?
Go to the top of the page
+Quote Post
Heliologue
post Apr 10 2013, 22:25
Post #2





Group: Members
Posts: 110
Joined: 17-September 06
Member No.: 35303



Surround the special characters with single quotes to denote them as literal values.

CODE
[%album% '('%date%')']


Edit: I assume you're talking about the playlist view in the Default UI?

This post has been edited by Heliologue: Apr 10 2013, 22:27
Go to the top of the page
+Quote Post
spuuunit
post Apr 10 2013, 22:38
Post #3





Group: Members
Posts: 110
Joined: 19-January 11
Member No.: 87437



QUOTE (Heliologue @ Apr 10 2013, 23:25) *
Surround the special characters with single quotes to denote them as literal values.

CODE
[%album% '('%date%')']


Edit: I assume you're talking about the playlist view in the Default UI?


Yes, thank you, it works beautifully =).
Go to the top of the page
+Quote Post
db1989
post Apr 12 2013, 10:46
Post #4





Group: Super Moderator
Posts: 5275
Joined: 23-June 06
Member No.: 32180



These and other basics are explained in the title-formatting introduction available on the Knowledgebase.
Go to the top of the page
+Quote Post
Wichita
post Sep 1 2015, 11:27
Post #5





Group: Members
Posts: 6
Joined: 1-September 15
Member No.: 120343



Sorry to hijack this thread, I have been trying to find an answer in many sources including the Title Formatting reference sources but no luck so far crying.gif :

I have album names formatted this way
Albumname (Hires) or Albumname [2015 deluxe edition]
and I would like to be able to remap these names to albumname only, striping whatever is between the parenthesis or brackets,
typically to use the original albumname in foo_run or WSH panel queries.
I am sure this issue must have been raised somewhere already, but can anyone give me a clue on how I could do that ?

Thanks for your help

This post has been edited by Wichita: Sep 1 2015, 11:28
Go to the top of the page
+Quote Post
Porcus
post Sep 1 2015, 11:32
Post #6





Group: Members
Posts: 2312
Joined: 30-November 06
Member No.: 38207



QUOTE (Wichita @ Sep 1 2015, 12:27) *
I have album names formatted this way
Albumname (Hires) or Albumname [2015 deluxe edition]
and I would like to be able to remap these names to albumname only, striping whatever is between the parenthesis or brackets


Gather and select the ones with brackets. Alt+Enter for Properties. Right-click --> Automatically fill values. Source --> Other..., fill in %album%. Set Pattern as e.g. %album% [%releaseversion%]
Go to the top of the page
+Quote Post
Wichita
post Sep 1 2015, 11:40
Post #7





Group: Members
Posts: 6
Joined: 1-September 15
Member No.: 120343



QUOTE (Porcus @ Sep 1 2015, 11:32) *
QUOTE (Wichita @ Sep 1 2015, 12:27) *
I have album names formatted this way
Albumname (Hires) or Albumname [2015 deluxe edition]
and I would like to be able to remap these names to albumname only, striping whatever is between the parenthesis or brackets


Gather and select the ones with brackets. Alt+Enter for Properties. Right-click --> Automatically fill values. Source --> Other..., fill in %album%. Set Pattern as e.g. %album% [%releaseversion%]


Thanks for the quick answer, it makes perfect sense, but is there a way to achieve the same result without actually retagging everything, typically via functions such as:

$puts(char,'()$puts(tag,%tag%)$puts(spacer,$strchr($get(tag),$get(char)))
$trim($left($get(tag),$sub($get(spacer),1)))

What I'd like to trim is always at the end of the %album% tag.
For instance, WSH panel Allmusic queries will not return anything if I use the current %album% tag, I am trying to send albumname instead without the content between parenthesis.

This post has been edited by Wichita: Sep 1 2015, 12:19
Go to the top of the page
+Quote Post
Daeron
post Sep 1 2015, 13:18
Post #8





Group: Members
Posts: 687
Joined: 9-October 08
Member No.: 59818



Why exactly do you NOT want to separate them?

Those things are not part of the ALBUM string to begin with and they are causing problems for you. Why would you want to create a last minute guesswork fix instead of actually fixing your tags? And sure, it should be doable. At the cost of a lot of pointless work which still could give false positives (as the closest approximation of cutting these would be based on whether it has ' (' or ' [' in it, which can occur in a normal album title as well).

This post has been edited by Daeron: Sep 1 2015, 13:25
Go to the top of the page
+Quote Post
Wichita
post Sep 1 2015, 14:51
Post #9





Group: Members
Posts: 6
Joined: 1-September 15
Member No.: 120343



QUOTE (Daeron @ Sep 1 2015, 13:18) *
Why exactly do you NOT want to separate them?

Those things are not part of the ALBUM string to begin with and they are causing problems for you. Why would you want to create a last minute guesswork fix instead of actually fixing your tags? And sure, it should be doable. At the cost of a lot of pointless work which still could give false positives (as the closest approximation of cutting these would be based on whether it has ' (' or ' [' in it, which can occur in a normal album title as well).



Well I guess it depends on your definition of an album, in 95% of cases, the album tag including elements on the release is the most significant way to describe the album and what I prefer to see in the playlists / album list etc, so adding a %releaseversion% tag everywhere adds complexity in most of my use cases.

In addition to that, many apps do not implement such a tag. Typicallly I am a heavy squeezebox user and I do not want to see my 5 versions of an album as a single one with each track repeated five times. So in the end, retagging everythuing might be the purist approach, but for me the remedy could well be worse than the cure crying.gif

That's the reason why I am trying to find a workaround, typically being able to build queries with the album tag stripped of the content within parenthesis whenever there is one. Finding the first parenthesis in the tag and striping what is after this character is a good approximation of what I am looking for, even though it might not work as expected in a few instances.

This post has been edited by Wichita: Sep 1 2015, 14:55
Go to the top of the page
+Quote Post
Porcus
post Sep 1 2015, 15:06
Post #10





Group: Members
Posts: 2312
Joined: 30-November 06
Member No.: 38207



QUOTE (Wichita @ Sep 1 2015, 12:40) *
is there a way to achieve the same result without actually retagging everything


Oh, you want only to display everything before first occurrence of a certain character?
Go to the top of the page
+Quote Post
marc2003
post Sep 1 2015, 15:23
Post #11





Group: Members
Posts: 5601
Joined: 27-January 05
Member No.: 19379



CODE
$puts(i,$strchr(%album%,'('))$ifgreater($get(i),0,$substr(%album%,0,$sub($get(i),2)),%album%)


that will only work for ( i'm too lazy to add in support for [ as well. tongue.gif
Go to the top of the page
+Quote Post
Wichita
post Sep 1 2015, 15:26
Post #12





Group: Members
Posts: 6
Joined: 1-September 15
Member No.: 120343



QUOTE (Porcus @ Sep 1 2015, 15:06) *
QUOTE (Wichita @ Sep 1 2015, 12:40) *
is there a way to achieve the same result without actually retagging everything


Oh, you want only to display everything before first occurrence of a certain character?


Yes, to be more specific, I'd like to be able to modify the value returned by the album tag in order to use that in WSH panel or foo run script. For instance, if I have a script that queries Last FM or All music sites, I must build the query based on the original album name "Abbey Road" and not on the actual value of the album tag "Abbey Road (2009 remaster)".

A simple way to achieve that would be to to take the album tag value, and strip it of everything after the first (
So I am looking for a title formatting expression to do that
Still, if anyone has an alternative way to do that, please chime in rolleyes.gif
Go to the top of the page
+Quote Post
Wichita
post Sep 1 2015, 15:35
Post #13





Group: Members
Posts: 6
Joined: 1-September 15
Member No.: 120343



QUOTE (marc2003 @ Sep 1 2015, 15:23) *
CODE
$puts(i,$strchr(%album%,'('))$ifgreater($get(i),0,$substr(%album%,0,$sub($get(i),2)),%album%)


that will only work for ( i'm too lazy to add in support for [ as well. tongue.gif


Thanks a lot for this,

as many of my use cases for this expression would be as input for WSH panel samples you actually designed (thanks a lot for this great work by the way, this is what makes foobar a completely different beast from the other music apps around), I might as well ask the question directly: if I input this formula in the %album% mapping parameter of WSH panel, do you think this is going to work ? I cannot test that right away, sorry...
Go to the top of the page
+Quote Post
marc2003
post Sep 1 2015, 15:57
Post #14





Group: Members
Posts: 5601
Joined: 27-January 05
Member No.: 19379



of course it will work. i thought the dialog was clear enough already... tongue.gif



edit: here's an example...

http://i.imgur.com/YkSWNPt.jpg

This post has been edited by marc2003: Sep 1 2015, 16:19
Go to the top of the page
+Quote Post
Daeron
post Sep 1 2015, 16:24
Post #15





Group: Members
Posts: 687
Joined: 9-October 08
Member No.: 59818



My way would be:
CODE
$left(%album%,$sub($strstr(%album%,' ('),1))

For () and []:
CODE
$left($left(%album%,$sub($strstr(%album%,' ('),1)),$sub($strstr(%album%,' ['),1))

I'd warn you though that there are a decent number of albums that contain these by default and will be caught as false positives.

I'm not familiar with squeezebox, but in my experience if a device is incapable of handling custom titleformatting I just won't bother relying on tags altogether (as they usually don't have support for stuff like multivalue genre tags either, to give an example). Instead I generate a folder structure using foobar and copy that over to the device. I primarily listen on PC though and have specific needs unlike most users.

This post has been edited by Daeron: Sep 1 2015, 16:49
Go to the top of the page
+Quote Post
Wichita
post Sep 1 2015, 21:45
Post #16





Group: Members
Posts: 6
Joined: 1-September 15
Member No.: 120343



QUOTE (Daeron @ Sep 1 2015, 16:24) *
My way would be:
CODE
$left(%album%,$sub($strstr(%album%,' ('),1))

For () and []:
CODE
$left($left(%album%,$sub($strstr(%album%,' ('),1)),$sub($strstr(%album%,' ['),1))

I'd warn you though that there are a decent number of albums that contain these by default and will be caught as false positives.

I'm not familiar with squeezebox, but in my experience if a device is incapable of handling custom titleformatting I just won't bother relying on tags altogether (as they usually don't have support for stuff like multivalue genre tags either, to give an example). Instead I generate a folder structure using foobar and copy that over to the device. I primarily listen on PC though and have specific needs unlike most users.


Both solutions actually work, sheer bliss emot-toot.gif
Thanks a lot to all of you!
Go to the top of the page
+Quote Post

Reply to this topicStart new topic
1 User(s) are reading this topic (1 Guests and 0 Anonymous Users)
0 Members:

 



RSS Lo-Fi Version Time is now: 4th September 2015 - 11:36