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: Filter single values from a multivalue field (Read 3922 times) previous topic - next topic
0 Members and 1 Guest are viewing this topic.

Filter single values from a multivalue field

For a multivalue field I would like to do the following things in foobar and I have not found anything by searching this forum:

In the multivalue field I have for a track as information in the PERFORMER field "performer1(lead vocals); performer1(background vocals); performer2(bass guitar)". I have split these values, so foobar recognizes that these are three performers.

By viewing the library using %<PERFORMER>% I get these three performers listed as separate entries. So far so good.

Now I would like to do the following three things:
1) Get a list of performers without their role, so that I would only have one entry for performer1.

2) Filter on performer1, but not see all the other performers for his tracks. If I use a normal Filter like "PERFORMER HAS performer1" it will also show performer2, because performer2 is also in the field.

3) Filter on (bass guitar) so that I get all the bass guitar players in my collection and only them. Here I have the same problem as under 2. By just using PERFORMER HAS one gets all the other performers in the tracks, not only the one performer playing bass guitar.

Thanks in advance for any suggestions


Filter single values from a multivalue field

Reply #1
$meta(tag,x) will return one specific value of a multivalue tag.

Mind you the index starts with 0, so $meta(performer,0) equals your lead vocals, 1 your background vocals, 2 your bass guitar. Check the wiki for more info.

If you are using query syntax you will want to put "" around the titleformatting parts. So "$meta(performer,0)" HAS performer1

Filter single values from a multivalue field

Reply #2
The filter selects tracks, not tag values. The album list will display all tag values from the selected tracks. This means the filter will not be used to display only some of the branches which belong to a track.

Filter single values from a multivalue field

Reply #3
$meta(tag,x) will return one specific value of a multivalue tag.

Mind you the index starts with 0, so $meta(performer,0) equals your lead vocals, 1 your background vocals, 2 your bass guitar. Check the wiki for more info.

If you are using query syntax you will want to put "" around the titleformatting parts. So "$meta(performer,0)" HAS performer1


Thanks for your quick reply. I tried it, but it will not solve my problem, because performer1 will not always be the first performer in all track.

Assume Track 1 has PERFORMER as: performer1(lead vocals) performer1(background vocals) performer2(bass guitar)
Assume Track 2 has PERFORMER as: performer3(electric guitar) performer1(lead vocals)

then using $meta(PERFORMER,0) will give me performer1 for the first track and performer3 for the second track. So in my list of performers I see only the first performer of a track. But this does not achieve my goals

The functions of the wiki did not solve my problem either.

Maybe to achieve my first goal I have to define a new field PERFORMER_PURE where I use a script to cut out whatever is in the '(...)' and then create a view according to that new field. But this still does not solve my problems 2 and 3 because when I filter this view by using "PERFORMER_PURE HAS performer1", it will still show me all other performers for all tracks that contain performer1.

Thanks again for your quick response.

Filter single values from a multivalue field

Reply #4
Can you further clarify what your PERFORMER tag really contains and what's its purpose?

Is it just names of the instruments each song is composed with ('vocals; piano; guitars; drums' etc.)? Or is it more like 'Person 1 playing guitar; Person 2 playing piano' etc.?

Filter single values from a multivalue field

Reply #5
Manipulating the individual values of a multi-value tag and returning all of them is only possible with Facets AFAIK.

You'll need to create a new "Column" (not a "Filter") in Facets for each of the following scripts.

This should accomplish #1
Code: [Select]
[$left($meta(performer,0),$sub($strrchr($meta(performer,0),'('),1))]|[$left($meta(performer,1),$sub($strrchr($meta(performer,1),'('),1))]|[$left($meta(performer,2),$sub($strrchr($meta(performer,2),'('),1))]|[$left($meta(performer,3),$sub($strrchr($meta(performer,3),'('),1))]|[$left($meta(performer,4),$sub($strrchr($meta(performer,4),'('),1))]|[$left($meta(performer,5),$sub($strrchr($meta(performer,5),'('),1))]|[$left($meta(performer,6),$sub($strrchr($meta(performer,6),'('),1))]|[$left($meta(performer,7),$sub($strrchr($meta(performer,7),'('),1))]|[$left($meta(performer,8),$sub($strrchr($meta(performer,8),'('),1))]|[$left($meta(performer,9),$sub($strrchr($meta(performer,9),'('),1))]

Daeron told you how to do #2.

This should accomplish #3
Code: [Select]
[$substr($meta(performer,0),$add($strrchr($meta(performer,0),'('),1),$sub($strrchr($meta(performer,0),')'),1))]|[$substr($meta(performer,1),$add($strrchr($meta(performer,1),'('),1),$sub($strrchr($meta(performer,1),')'),1))]|[$substr($meta(performer,2),$add($strrchr($meta(performer,2),'('),1),$sub($strrchr($meta(performer,2),')'),1))]|[$substr($meta(performer,3),$add($strrchr($meta(performer,3),'('),1),$sub($strrchr($meta(performer,3),')'),1))]|[$substr($meta(performer,4),$add($strrchr($meta(performer,4),'('),1),$sub($strrchr($meta(performer,4),')'),1))]|[$substr($meta(performer,5),$add($strrchr($meta(performer,5),'('),1),$sub($strrchr($meta(performer,5),')'),1))]|[$substr($meta(performer,6),$add($strrchr($meta(performer,6),'('),1),$sub($strrchr($meta(performer,6),')'),1))]|[$substr($meta(performer,7),$add($strrchr($meta(performer,7),'('),1),$sub($strrchr($meta(performer,7),')'),1))]|[$substr($meta(performer,8),$add($strrchr($meta(performer,8),'('),1),$sub($strrchr($meta(performer,8),')'),1))]|[$substr($meta(performer,9),$add($strrchr($meta(performer,9),'('),1),$sub($strrchr($meta(performer,9),')'),1))]

The scripts allow for up to 10 performers. If your tags have more performers than that, I'm sure you can see how to extend the script.

Personally, I'd use custom tags for the individual roles instead of manipulating a single catch-all tag.

Filter single values from a multivalue field

Reply #6
Thanks for all your suggestions.

Daeron asked me to clarify the data structure:

I am using Musicbrainz to tag my music. Thus I have in the Performer tag a list of tuples of instruments and performers. I format those in a way that in foobar i have in the Performer for a track from an ABBA album:
"Mike Watson (bass guitar); Per Lindvall (drums); Åke Sundqvist (percussion); Benny Andersson (keyboard and synthesizer); Janne Schaffer (guitars); Agnetha Fältskog (background vocals vocal); Björn Ulvaeus (acoustic guitar); Anni-Frid Lyngstad (lead vocals vocal)"
Ther Performer tag for an opera looks like:
"Sächsische Staatskapelle Dresden (orchestra); Marie McLaughlin (soprano vocals); Peter Schreier (tenor vocals); Ann Murray (mezzo-soprano vocals); Hanna Schwarz (mezzo-soprano vocals); Mikael Melbye (bass vocals)"

So for my first problem in my original post, I would like to be able to define a "view" that lists on the first level all performers and on the second level all the albums/pieces of music.

So under "Peter Schreier" there would be the different operas he is singing in.
Under "Agnetha Fältskog" I would like to have all the Abba albums but also the solo albums of her.

Now according to foosion, there will be a problem, because only tracks are selected and not albums. So if I select Peter Schreier and "Aida" as the Opera and send that to the playlist, I only get those tracks of "Aida" in which Peter Schreier sings. So to listen to the whole opera, I need to switch to the compser view, select "Verdi" and then "Aida".

The third question I had was this:
Assume I want to listen to piano music. Then I want to have a view, that gives me on the first level the list of instruments, i. e. piano, violin, electric guitar etc. . On the second level I would like to see the performers that play the piano, so for piano Horowitz, Rubinstein, Richter etc. and on the third level the pieces in which they play.

Now all of this information that is needed for these views is in the Performer tag.

I have not yet tried BenB's suggestion to use Facets, but I will try.

Of course I could try to write a script, that splits up this list of instruments/musicians and creates a new tag for each instrument. But that would mean to create a lot of tags for all the different instruments (including the different human voices - bass, baritone, ...). I would like to avoid that. As I said all the info is in the Performer tag, it is just a question of how to define a "view" according to what I would like.

Thanks again for all your suggestions.


Filter single values from a multivalue field

Reply #7
BenB's suggestion does pretty much what you want then.

I generally advise against excessive use of titleformatting (since it may cause slowdowns and can usually be avoided), and suggest storing tags as close as possible to the actual usage scenarios (this case separating each instrument into their own field). But if you really have that many instruments, you might indeed be better off taking the performance hit (if any) in exchange of not having to worry about constantly rewriting the tags from whatever site you pull your data from (assuming you don't have to mess with those to begin with).

Filter single values from a multivalue field

Reply #8
Hello again,

BenB's suggestion works partly. I can define a column with all the instruments and a column with all the performers regardless of their instruments.
I have also found a solution to do this in the Album List plugin creating a special view. Pictures of how this looks are below. The solution for the views is at the end.

But this still does not solve my problem. As you can see in the images in both cases when selecting acoustic guitar as the the instrument, in the second column of the Facets there are all the performers that are performing in the track regardless of their instrument. The same is true for the Album List view. What I need, is a way to script something like: if the first column (resp. the first branch of the view) is acoustic guitar, then only select the performer is the value in the brackets is acoustic guitar, i.e. from the tag "Performer : Mike Watson (bass guitar); Per Lindvall (drums); Åke Sundqvist (percussion); Benny Andersson (keyboard and synthesizer); Janne Schaffer (guitars); Agnetha Fältskog (background vocals vocal); Björn Ulvaeus (acoustic guitar); Anni-Frid Lyngstad (lead vocals vocal)" select only Björn Ulvaeus because for him the value in brackets is acoustic guitar.

I do not know, whether there is a variable/field/??? that contains this information, so that I could use it in the second selection. Has anybody got any idea?
Thanks for the help again.

Here is what I get in Facets:


Here is what I get in th eAlbum view


Here is my solution for Album List:
To get Album List to treat a string as multiple value field you have begin and end the string with $char(04) and separate all values with $char(05).

Thus my solution to get the view in the second picture is (the selection of the right string I have taken from BenB):

$char(04)
[$substr($meta(performer,0),$add($strrchr($meta(performer,0),'('),1),$sub($strrchr($meta(performer,0),')'),1))]
[$char(05)$substr($meta(performer,1),$add($strrchr($meta(performer,1),'('),1),$sub($strrchr($meta(performer,1),')'),1))]
[$char(05)$substr($meta(performer,2),$add($strrchr($meta(performer,2),'('),1),$sub($strrchr($meta(performer,2),')'),1))]
[$char(05)$substr($meta(performer,3),$add($strrchr($meta(performer,3),'('),1),$sub($strrchr($meta(performer,3),')'),1))]
[$char(05)$substr($meta(performer,4),$add($strrchr($meta(performer,4),'('),1),$sub($strrchr($meta(performer,4),')'),1))]
[$char(05)$substr($meta(performer,5),$add($strrchr($meta(performer,5),'('),1),$sub($strrchr($meta(performer,5),')'),1))]
[$char(05)$substr($meta(performer,6),$add($strrchr($meta(performer,6),'('),1),$sub($strrchr($meta(performer,6),')'),1))]
[$char(05)$substr($meta(performer,7),$add($strrchr($meta(performer,7),'('),1),$sub($strrchr($meta(performer,7),')'),1))]
[$char(05)$substr($meta(performer,8),$add($strrchr($meta(performer,8),'('),1),$sub($strrchr($meta(performer,8),')'),1))]
[$char(05)$substr($meta(performer,9),$add($strrchr($meta(performer,9),'('),1),$sub($strrchr($meta(performer,9),')'),1))]
[$char(05)$substr($meta(performer,10),$add($strrchr($meta(performer,10),'('),1),$sub($strrchr($meta(performer,10),')'),1))]
[$char(05)$substr($meta(performer,11),$add($strrchr($meta(performer,11),'('),1),$sub($strrchr($meta(performer,11),')'),1))]
[$char(05)$substr($meta(performer,12),$add($strrchr($meta(performer,12),'('),1),$sub($strrchr($meta(performer,12),')'),1))]
[$char(05)$substr($meta(performer,13),$add($strrchr($meta(performer,13),'('),1),$sub($strrchr($meta(performer,13),')'),1))]
[$char(05)$substr($meta(performer,14),$add($strrchr($meta(performer,14),'('),1),$sub($strrchr($meta(performer,14),')'),1))]
[$char(05)$substr($meta(performer,15),$add($strrchr($meta(performer,15),'('),1),$sub($strrchr($meta(performer,15),')'),1))]
[$char(05)$substr($meta(performer,16),$add($strrchr($meta(performer,16),'('),1),$sub($strrchr($meta(performer,16),')'),1))]
$char(04) |
$char(04)
[$left($meta(performer,0),$sub($strrchr($meta(performer,0),'('),1))]
[$char(05)$left($meta(performer,1),$sub($strrchr($meta(performer,1),'('),1))]
[$char(05)$left($meta(performer,2),$sub($strrchr($meta(performer,2),'('),1))]
[$char(05)$left($meta(performer,3),$sub($strrchr($meta(performer,3),'('),1))]
[$char(05)$left($meta(performer,4),$sub($strrchr($meta(performer,4),'('),1))]
[$char(05)$left($meta(performer,5),$sub($strrchr($meta(performer,5),'('),1))]
[$char(05)$left($meta(performer,6),$sub($strrchr($meta(performer,6),'('),1))]
[$char(05)$left($meta(performer,7),$sub($strrchr($meta(performer,7),'('),1))]
[$char(05)$left($meta(performer,8),$sub($strrchr($meta(performer,8),'('),1))]
[$char(05)$left($meta(performer,9),$sub($strrchr($meta(performer,9),'('),1))]
[$char(05)$left($meta(performer,10),$sub($strrchr($meta(performer,10),'('),1))]
[$char(05)$left($meta(performer,11),$sub($strrchr($meta(performer,11),'('),1))]
[$char(05)$left($meta(performer,12),$sub($strrchr($meta(performer,12),'('),1))]
[$char(05)$left($meta(performer,13),$sub($strrchr($meta(performer,13),'('),1))]
[$char(05)$left($meta(performer,14),$sub($strrchr($meta(performer,14),'('),1))]
[$char(05)$left($meta(performer,15),$sub($strrchr($meta(performer,15),'('),1))]
[$char(05)$left($meta(performer,16),$sub($strrchr($meta(performer,16),'('),1))]
$char(04) |
%album%

Re: Filter single values from a multivalue field

Reply #9
To get Album List to treat a string as multiple value field you have begin and end the string with $char(04) and separate all values with $char(05).

This is something I've been looking for so long!!!! Perhaps it does not solve your problem, but it's the answer to something I'm puzzling over since I started using foobar. I tried your sintax to merge the artist, album artist and conductor (performer) in the same level of the album list and it works perfectly, which is something up to now only facets was known to do. I have no idea how you came up with it, but at the moment you are my hydrogenaudio hero! 
Now, if only you could tell me how to achieve the same result in other library viewers, namely the esplaylist in library browse mode, you would be my hydrogenaudio super hero 8)
I'm late

Re: Filter single values from a multivalue field

Reply #10
This is something I've been looking for so long!!!! Perhaps it does not solve your problem, but it's the answer to something I'm puzzling over since I started using foobar.

It would be a good idea to post an update in the thread in that case, for others who may find it via a search.

Re: Filter single values from a multivalue field

Reply #11
It would be a good idea to post an update in the thread in that case, for others who may find it via a search.

I will
I'm late

Re: Filter single values from a multivalue field

Reply #12
Hi davideleo, thanks for calling me a hero. Sorry for not responding earlier, but I thought this thread was dead, so <i did not check it.
You achieved your goal: I installed esplaylist and tried to do what you wanted. But i did not succeed. I  think esplaylist does not support multivalue fields. I tried with the genre field. So I have one track with two genres let us say genre1 and genre2 if you are in he DUI or clumns UI you can define genre as a multivalue field and then using split values the two genres will be split. I could not do that within esplaylist, there it always displayed the track as having the one  genre: "genre2 , genre3". But that maybe because I do not know enough about esplaylist. If you can get esplaylist to treet genre as a multivalue field, I will have another go at it.

Re: Filter single values from a multivalue field

Reply #13
Hi davideleo, thanks for calling me a hero. Sorry for not responding earlier, but I thought this thread was dead, so <i did not check it.
You achieved your goal: I installed esplaylist and tried to do what you wanted. But i did not succeed. I  think esplaylist does not support multivalue fields. I tried with the genre field. So I have one track with two genres let us say genre1 and genre2 if you are in he DUI or clumns UI you can define genre as a multivalue field and then using split values the two genres will be split. I could not do that within esplaylist, there it always displayed the track as having the one  genre: "genre2 , genre3". But that maybe because I do not know enough about esplaylist. If you can get esplaylist to treet genre as a multivalue field, I will have another go at it.


Glad to hear from you   :))

I'm using esPlaylist 0.1.3.9 which I think is the latest. I use it in a CUI configuration and it does support multivalue fields in browse library mode only. In my config the genre is a single value field, but I split the artist and album artist fields. You just need to use the %<field>% syntax in the group settings like this:




This is what's written in the readme:
Quote
* Note *
         Multivalue fields, %<xxx>% are available in "Grouping", "Title" and "SideInfo"  for Browse Library mode (with Force-Sorted=off).
         %<xxx>% fields always return "?" in Playlist mode.


P.S.: Make sure the fore-sorted option is unchecked, that might be the reason it didn't work for you.
I'm late

Re: Filter single values from a multivalue field

Reply #14
Hi, I got it to work with multivalue fields. It showed my genres as multivalues. But I still think what you want will not work. With album view it was the question of generating a string that would be used for displaying the hierarchical view. For esplaylist fiddling with the output would be like rewriting the plugin because of its flexible and complex output ( by output I do not mean the text, that gets displayed as the title or sidebar, but the whole structured album view). fiddling with the input seems impossible also, because it expects field names and not strings. It then works through the content of the fields. If you give it a string it will just display the string, but it will not try to work with the string and analyze its content to use it for displaying the grouping.

 

Re: Filter single values from a multivalue field

Reply #15
I'm asking for help with the following title formatting, which is gathering data from custom tags (composer-iso3166, composer-iso3166-b, artist-iso3166, artist-iso3166-b) each with two values (three letter ISO code for Regor's World-Map; plain name for facets). My script concatenates what I intend to be different branches, and I guess it's because I'm mixing the order of $char(04) and $char(05), or of |s and ¦s. So I tried to turn those into harmless §s and ¶s, and then $replace these in due time, but I keep on failing.

_________________________________
Album List version:

$char(04)
$if($meta_test(composer-iso3166),$meta(composer-iso3166,1)|Composers & Lyricists|By Their Homeland,'[Mainstream/Not Tagged]')|%composer%|$year(%date%)': '%album%' (by '%album artist%')'|[%discnumber%-]%tracknumber% %title%[' (by '%track artist%')']

$char(05)
$if($meta_test(composer-iso3166-b),$meta(composer-iso3166-b,1)|Composers & Lyricists|By Their Background,'[Mainstream/Not Tagged]')|%composer%|$year(%date%)': '%album%' (by '%album artist%')'|[%discnumber%-]%tracknumber% %title%[' (by '%track artist%')']

$char(05)
$if($meta_test(artist-iso3166),$meta(artist-iso3166,1)|Performers & Producers|By Their Homeland,'[Mainstream/Not Tagged]')|%artist-main%|$year(%date%)': '%album%' (by '%album artist%')'|[%discnumber%-]%tracknumber% %title%[' (by '%track artist%')']

$char(05)
$if($meta_test(artist-iso3166-b),$meta(artist-iso3166-b,1)|Performers & Producers|By Their Background,'[Mainstream/Not Tagged]')|%artist-main%|$year(%date%)': '%album%' (by '%album artist%')'|[%discnumber%-]%tracknumber% %title%[' (by '%track artist%')']
$char(04)

_________________________________
WilB's Library Tree view upon TheQuertiest's Spider Monkey Panel version:

$if($meta_test(composer-iso3166),$meta(composer-iso3166,1)|Composers & Lyricists|By Their Homeland,$nodisplay{ﬡ}'[Mainstream/Not Tagged]')|%composer%|$nodisplay{$mod(3000,$year(%date%)) %album% %album artist%}[$year(%date%)': '][%album%][' (by '%album artist%')']|$nodisplay{[%discnumber%-]%tracknumber%}• %title%[' (by '%track artist%')']

¦$if($meta_test(composer-iso3166-b),$meta(composer-iso3166-b,1)|Composers & Lyricists|By Their Background,$nodisplay{ﬡ}'[Mainstream/Not Tagged]')|%composer%|$nodisplay{$mod(3000,$year(%date%)) %album% %album artist%}[$year(%date%)': '][%album%][' (by '%album artist%')']|$nodisplay{[%discnumber%-]%tracknumber%}• %title%[' (by '%track artist%')']

¦$if($meta_test(artist-iso3166),$meta(artist-iso3166,1)|Performers & Producers|By Their Homeland,$nodisplay{ﬡ}'[Mainstream/Not Tagged]')|%artist-main%|$nodisplay{$mod(3000,$year(%date%)) %album% %album artist%}[$year(%date%)': '][%album%][' (by '%album artist%')']'|'$nodisplay{[%discnumber%-]%tracknumber%}• %title%[' (by '%track artist%')']

¦$if($meta_test(artist-iso3166-b),$meta(artist-iso3166-b,1)|Performers & Producers|By Their Background,$nodisplay{ﬡ}'[Mainstream/Not Tagged]')|%artist-main%|$nodisplay{$mod(3000,$year(%date%)) %album% %album artist%}[$year(%date%)': '][%album%][' (by '%album artist%')']'|'$nodisplay{[%discnumber%-]%tracknumber%}• %title%[' (by '%track artist%')']

_________________________________