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: tag with multiple possible values & grouping by it (Read 4769 times) previous topic - next topic
0 Members and 1 Guest are viewing this topic.

tag with multiple possible values & grouping by it

i'd like to have a tag that defines a multiple-value,
e.g.
song1:MYTAG ="classic;fast;high-pitch;funny"
song2:MYTAG ="folk;sad;fast"
song3:MYTAG ="pyschadelic;folk"

and then to be able to group by these tags (in the library, or as a dynamic playlist, or anything that works)

e.g. (by the above example) :
|
+- fast (2)
+- folk (2)
+- classic (1)
+- funny (1)
+- sad (1)
  ...

so that each song can have multiple ways to be grouped by. The groups can overlap.

How do I achieve that?

EDIT1:
I can partially achieve it now with the following steps:

for each song:
  add a tag (e.g. MYTAG) to a song,
  set that tag multiple-values with a separator (e.g. "folk;sad;fast")
  right-click that tag,
  choose "split values..."
  save changes.

I noticed that even though the comment in the edit window says "use ; character to separate multiple values",
the media library still treats it as a single value, unless i choose "split values..." like i wrote above.  (Is this a bug? how can it split values automatically?)


In foobar settings:
  preferences -> media library > album list > (add new/edit)
  add a view with that tag  (e.g. "%<mytag>%")
  save preferences.

  i learned that %<mytag>% treats the field contents as a multivalue field
  and %mytag% treats the field as a single-value field.

in the bottom of the media library tree, select the new view.

Now library shows me
  groups by tags.

I can combine songs from several groups with CTRL key - OR() operator.
but how can I select groups that contain only selected tags?  i.e. AND() operator

by "OR" operator i mean:
  foobar selects each song that belongs to EITHER of the groups. e.g. songs that are defined as "rock" or songs that are defined as "pop".

by "AND" i mean
  foobar selects each song only if it belongs to ALL of the selected groups. e.g. songs that are defined as BOTH "rock" AND "pop" simultaneously.



tag with multiple possible values & grouping by it

Reply #1
Complete re-Edit My Question

a) how to group multivalue tags in the library by AND() operator (see below)
b) how to edit multivalue faster and easier?
c) is there a bug in editing multibalues? (see end of this post)

To group the library by multivalue tags, I edit foobar settings:
1) preferences -> media library > album list > (add new/edit)
2) add a view with that tag  (e.g. "%<mytag>%")
3) save preferences.

  i learned that %<mytag>% treats the field contents as a multivalue field
  and %mytag% treats the field as a single-value field.

in the bottom of the media library tree, select the new view.

Now library shows me
  groups by tags.

I can combine songs from several groups with CTRL key - OR() operator.
but how can I select groups that contain only selected tags?  i.e. AND() operator

by "OR" operator i mean:
  foobar selects each song that belongs to EITHER of the groups. e.g. songs that are defined as "rock" or songs that are defined as "pop".

by "AND" i mean
  foobar selects each song only if it belongs to ALL of the selected groups. e.g. songs that are defined as BOTH "rock" AND "pop" simultaneously.





background information:
how to group the media library by multivalue tag fields

i'd like to have a tag that defines a multiple-value, e.g.
  song1:  MYTAG ="classic;fast;high-pitch;funny"
  song2:  MYTAG ="folk;sad;fast"
  song3:  MYTAG ="pyschadelic;folk"

and then to be able to group by these tags (in the library, or as a dynamic playlist, or anything that works)

e.g. (by the above example) :
|
+- fast (2)
+- folk (2)
+- classic (1)
+- funny (1)
+- sad (1)
  ...

so that each song can have multiple ways to be grouped by. The groups can overlap.

I use the following steps:

For each song:
1) add a tag (e.g. MYTAG) to a song,
2) set that tag multiple-values with a separator (e.g. "folk;sad;fast")
3) right-click that tag,
4) choose "split values..."
5) confirm using ";" as a separator,
6) save changes.

I noticed that even though the comment in the edit window says "use ; character to separate multiple values",
the media library still treats it as a single value, unless i choose "split values..." like i wrote above. 
(Is this a bug? how can it split values automatically?)


tag with multiple possible values & grouping by it

Reply #2
AND

Quote
$if($and($strstr(%mytag%,rock),$strstr(%mytag%,pop)),display this)

$if($and($strstr(%mytag%,rock),$strstr(%mytag%,pop)),display this,otherwise display this)

OR

Quote
$if($or($strstr(%mytag%,rock),$strstr(%mytag%,pop)),display this)

$if($or($strstr(%mytag%,rock),$strstr(%mytag%,pop)),display this,otherwise display this)

Be aware that what you stipulate $strstr() to look for is case-sensitive.

Consult the Title Formatting Reference for other options.

I noticed that even though the comment in the edit window says "use ; character to separate multiple values",
the media library still treats it as a single value, unless i choose "split values..." like i wrote above. 
(Is this a bug? how can it split values automatically?)

Add MYTAG to the list at Preferences > Advanced > Display > Properties dialog > Multivalue fields.

tag with multiple possible values & grouping by it

Reply #3
I noticed that even though the comment in the edit window says "use ; character to separate multiple values",
the media library still treats it as a single value, unless i choose "split values..." like i wrote above. 
(Is this a bug? how can it split values automatically?)

Add MYTAG to the list at Preferences > Advanced > Display > Properties dialog > Multivalue fields.

Sorry for bumping, but I have the exact same problem, and this hasn't fixed it. I have added tags, ;-separated, to the comment tag, but moving comment from the multiline to the multivalue fields hasn't helped.

Playing with formatting doesn't do anything either. I found somebody write that [%<comment>%] should break it down (and for multivalue genre tags this works beautifully). Then some disagree on the separator, which I tried to change into comma, (double) forward or backward slashes, no dice. [$replace($meta(comment),'; ','; ')]

Any help would be appreaciated.

tag with multiple possible values & grouping by it

Reply #4
If you originally wrote your tags when they weren't listed as multivalue in settings/advanced, then changed the setting over, the tags will most likely remain written and interpreted as single value in my experience. Rewriting them should help. I think you might need to restart foobar whenever those advanced settings are changed as well, but I might be (and probably am) wrong on that. Can't hurt, though.

tag with multiple possible values & grouping by it

Reply #5
If you originally wrote your tags when they weren't listed as multivalue in settings/advanced, then changed the setting over, the tags will most likely remain written and interpreted as single value in my experience. Rewriting them should help. I think you might need to restart foobar whenever those advanced settings are changed as well, but I might be (and probably am) wrong on that. Can't hurt, though.

I've found a way to make it work, and that is indeed to update the tags, or to split the tags (in the properties menu). Both options result in the same, splitting the comment string and saving each entry seperately.

This is however different behaviour from when I put the exact same string in the genre-tag. Then no such action is required, and foobar knows that one single comment field with ;-seperated values must be split (using the angular brackets in [%<genre>%] if I understand correctly).

As far as I can establish, for genre the behaviour seems seperate, and not replicable with another tag.

tag with multiple possible values & grouping by it

Reply #6
No, assuming you listed the field in settings/advanced as multivalue and you freshly rewritten values as 'tag1; tag2; tag3' from the right click/properties menu, it should be identical to what genre is by default. I use multiple multivalue tags myself.

As for splitting tags, %<TAG>% is generally used as you said. If you are going rely on multivalues, I'd suggest checking out the library viewer component called Facets which should give you the best experience with them.

tag with multiple possible values & grouping by it

Reply #7
No, assuming you listed the field in settings/advanced as multivalue and you freshly rewritten values as 'tag1; tag2; tag3' from the right click/properties menu, it should be identical to what genre is by default. I use multiple multivalue tags myself.

As for splitting tags, %<TAG>% is generally used as you said. If you are going rely on multivalues, I'd suggest checking out the library viewer component called Facets which should give you the best experience with them.

Can you verify with mp3tag that setting the multivalues from foobar actually saves them in a single tag? For me that does not happen, it splits the tags in multiple entries.

I use facets too. Everything is identical too what I set for genre. It just doesn't behave the same way for me.

tag with multiple possible values & grouping by it

Reply #8
Polite bump

If somebody could confirm, or deny, that the genre-tag is a special case and that it and it alone can have multiple tags with tags in one single ;-separated field. I can't find another explanation for what I see.

tag with multiple possible values & grouping by it

Reply #9
You need to define under "Preferences -> Advanced -> Display -> Properties dialog -> Multivalue fields" which fields should be handled as multivalue fields like the genre tag.

tag with multiple possible values & grouping by it

Reply #10
You need to define under "Preferences -> Advanced -> Display -> Properties dialog -> Multivalue fields" which fields should be handled as multivalue fields like the genre tag.

Apparently I didn't write it clear enough, but in my first post in this thread I already wrote that I did.

tag with multiple possible values & grouping by it

Reply #11
If somebody could confirm, or deny, that the genre-tag is a special case and that it and it alone can have multiple tags with tags in one single ;-separated field. I can't find another explanation for what I see.


there is nothing special about genre. it works with my own custom tags. Daeron confirmed this to you in an earlier reply as well.

No, assuming you listed the field in settings/advanced as multivalue and you freshly rewritten values as 'tag1; tag2; tag3' from the right click/properties menu, it should be identical to what genre is by default. I use multiple multivalue tags myself.

tag with multiple possible values & grouping by it

Reply #12
Apparently I didn't write it clear enough, but in my first post in this thread I already wrote that I did.
Ok, I overlooked this, but is was also already explained, why you couldn't set multiple values to the comment tag initially. Your wrong observation regarding the genre tag might be caused by the default values for the multivalue field settings, which are "ARTIST;ALBUM ARTIST;PRODUCER;COMPOSER;PERFORMER;GENRE".

tag with multiple possible values & grouping by it

Reply #13
there is nothing special about genre. it works with my own custom tags. Daeron confirmed this to you in an earlier reply as well.

Please read again, because we're talking about different things. I told you this step splits the tag at the ;-point into actual multiple tags. That's not necesary if I put the exact same type of strings in the genre tag (it remains a single tag, split by the ;, which facets/foobar correctly interprets as multiple tags). I asked for him (or you) to confirm you observe this behavior as well.

Note that foobar won't give you this information, you need to use a utility like mp3tag. The foobar gui will present either a single-tag ;-separated field or multiple fields the same way. To maintain compatibility with other tools, I need steer clear of multiple fields.

Apparently I didn't write it clear enough, but in my first post in this thread I already wrote that I did.
Ok, I overlooked this, but is was also already explained, why you couldn't set multiple values to the comment tag initially. Your wrong observation regarding the genre tag might be caused by the default values for the multivalue field settings, which are "ARTIST;ALBUM ARTIST;PRODUCER;COMPOSER;PERFORMER;GENRE".

I'm not sure what you mean, but that's how I configured it (by adding COMMENT, and removing COMMENT from multiline fields).

tag with multiple possible values & grouping by it

Reply #14
I'm not sure what you mean, but that's how I configured it (by adding COMMENT, and removing COMMENT from multiline fields).

The comments that were written before this remain non-multivalue and foobar2000 reads them as a single value.



If your question is related to this...
genre tag (it remains a single tag, split by the ;, which facets/foobar correctly interprets as multiple tags).

...and the tags in question are in ID3v2 format then you are right, fb2k separates genre values by ; character.

tag with multiple possible values & grouping by it

Reply #15
I'm not sure what you mean, but that's how I configured it (by adding COMMENT, and removing COMMENT from multiline fields).


The comments that were written before this remain non-multivalue and foobar2000 reads them as a single value.

Ah. OK. That must be it then. How can I resolve this then? I tried rewriting the tag (using mp3tag, because foobar would save the tag into multiple fields) for a test file, but it's still not split up.

tag with multiple possible values & grouping by it

Reply #16
Ah. OK. That must be it then. How can I resolve this then? I tried rewriting the tag (using mp3tag, because foobar would save the tag into multiple fields) for a test file, but it's still not split up.

I added a second part to my answer just when you wrote this.

Also, foobar2000 writes other ID3v2 multivalue tags as a string separated by " / ", not by ";".

tag with multiple possible values & grouping by it

Reply #17
because foobar would save the tag into multiple fields


if you're talking about mp3, you're making a huge mistake looking at mp3tag to tell you what is actually written inside the files.

look at this example file i've tagged with foobar2000. i've tagged genre and my own custom releasetype field.



oh look, mp3tag shows genre in exactly the same way it does my releasetype field.



but actually this is misleading. id3v2 does not allow multiple fields like this. if you inspect it with something like axone.jar, you'll see they are written to a single field.



tag with multiple possible values & grouping by it

Reply #18
I see it's even more involved than I thought, thanks for the info! I'm trying to get my tool to output backslashes now, although now I'm not even sure how it 'really' writes out tags either (it's based on the Mutagen lib).

tag with multiple possible values & grouping by it

Reply #19
Whenever you try to use an id3v2.3 tag as a multi-valued tag that isn't defined as such in the standard, foobar will re-write that tag to multiple TXXX frames instead of the stipulated frame.

My advice is do not move tags around in foobar's Advanced preferences. Standard tags that can have multiple values are already stipulated as such. Any time you wish to have a multi-valued tag, create a custom tag for it and add your new field to the Multivalue fields settings.