HydrogenAudio

Hosted Forums => foobar2000 => General - (fb2k) => Topic started by: rkghadai on 2012-04-19 17:53:27

Title: I want to specify a user-defined char as splitter of multi-value field
Post by: rkghadai on 2012-04-19 17:53:27
I know this is a repeated topic, but i have not found the exact solution i want after surfing a dozen threads, hence posting.

In Multi-value tag fields like Genre and Artist, I want Foobar to recognize a use-defined character as the splitter. I know foobar can write multiple genre fields (by mass tagger or action), but that makes only the first genre visible when i see in windows explorer folder view. Is it possible to make foobar only read the tag as a string "A;B" and take as input the user-defined splitter ;, thus recognize both A and B as two different genres in Library view?? This behavior is available in mediamonkey, which has the option to both write multi-value tags and no-write-only-read-and-recognize the multi-value tags. I think some formatting (kind of $if,$trim, etc) could do the job in foobar as well. Plz help.
Title: I want to specify a user-defined char as splitter of multi-value field
Post by: Tigermess on 2012-04-20 20:25:57
Sorry not really having an answer but at least basics:
1. To write non-multi-value tags deleting all items in Preferences>Advanced>Display>Properties>Multivalue Fields should help

2. To read ;-separated single values as multivalues, did you try experimenting with $meta* functions? This is the only way I can think about; not sure if that will work. There are also hackarounds like having masstager doing duplicates of all your fields - and basic like GENRE, ARTIST etc. will be single value and copies - GENRE_MULTI, ARTIST_MULTI shall contain splitted value which foobar and other capable players will use. Not really sexy but at least might be working.

(http://img339.imageshack.us/img339/4266/metafunctions.jpg)
Title: I want to specify a user-defined char as splitter of multi-value field
Post by: rkghadai on 2012-04-21 05:51:22
To read ;-separated single values as multivalues, did you try experimenting with $meta* functions? This is the only way I can think about; not sure if that will work.



The $meta function, as the definition says in the attached image, separates existing multiple values of a tag. My case is single value tag, to be parsed into two parts. So need scripting in foobar syntax, which i can't write myself (though i can understand an already written code). Hope some foobar formatting expert could find some time for this Parsing job.
Title: I want to specify a user-defined char as splitter of multi-value field
Post by: q-stankovic on 2012-04-21 09:20:32
The library viewer facets has following feature for creating columns:
Quote
Multiple patterns

Multiple patterns can be combined with | to display values from different fields in the same column. For example, %<artist>%|%<composer>% lists both artists and composers, which might be useful to create a list of persons regardless of their actual role.


So i thought that this could work: $replace(%genre%,;,|)
But it doesn't! On the other side an expression like %genre%|<put any text string here> will work. Maybe a request for the facets component?
Title: I want to specify a user-defined char as splitter of multi-value field
Post by: rkghadai on 2012-04-21 18:18:25
Multiple patterns can be combined with | to display values from different fields in the same column. For example, %<artist>%|%<composer>% lists both artists and composers, which might be useful to create a list of persons regardless of their actual role.



I think i got it. I used the above trick and the syntax to 'Find first occurence of character X in %tag%, and return everything in front of or after X'. This is my code in preferences->medialibrary->facets->column genre:

$puts(char,;)$puts(tag,%genre%)$puts(spacer,$strchr($get(tag),$get(char)))$trim($left($get(tag),$sub($get(spacer),1)))|$puts(char,;)$puts(tag,%genre%)$puts(spacer,$strchr($get(tag),$get(char)))$trim($right($get(tag),$sub($len($get(tag)),$get(spacer))))

I am so so so happy...for having written a code :D  and having removed my biggest roadblock to shifting to foobar (the other roadblock being to make foobar recognize my 'rating mm' tag).

Thank you guys for the guidance. :)
Title: I want to specify a user-defined char as splitter of multi-value field
Post by: q-stankovic on 2012-04-21 19:00:03
I still do wonder why my simple string leads to a blank pane in facets; in album list this little "trick" works (here | means creating a tree hierarchy)

rkghadai, your code seems to work only if there aren't more than two parts of the value.

(Edit: made a note in facets thread)
Title: I want to specify a user-defined char as splitter of multi-value field
Post by: rkghadai on 2012-04-21 19:09:59
ya it wont work for more than two values. But 'Return everything between two characters' gives me hope that it would be possible write a code for more-than-two values.

Title: I want to specify a user-defined char as splitter of multi-value field
Post by: Tigermess on 2012-04-22 01:53:18
Cool string rkghadai  I have many files with genres split just by colon or slash, I will try that. Good to hear about posting facets issue further too.
Title: I want to specify a user-defined char as splitter of multi-value field
Post by: rkghadai on 2012-04-22 16:16:18
Still looking for a flexible code, not restricted to only two values in a tag. Probably for-loop or recursive function is required