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: Dumb Columns UI Playlist Sorting Question (Read 3769 times) previous topic - next topic
0 Members and 1 Guest are viewing this topic.

Dumb Columns UI Playlist Sorting Question

I expect this is a simple fix that I am just looking past, but nonetheless I've been unable to find the answer.  I'm relatively new to FB2K and thoroughly enjoying customizing the interface and splitting up tags in my live music collection into separate fields for greater filtering/sorting/display customization ability.  I've pretty much completed that task and am looking to remove data in the Album field entirely from any of my live music shows, which are otherwise treated in my library view as an album.

The issue I'm running into is the Columns UI playlist view seems to sort by album automatically, and then defaults to looking at some other fields if album doesn't exist.  Everything works fine if I only select a single show at a time in my library view, but if I select multiple shows the playlist will sort by track number automatically, but I want each show to be grouped together. 

I've tried all sorts of things under Preference > Columns UI > Playlist View > Grouping, but no combination of fields will solve this unless the criteria "album" is included and each show has a unique entry. 

Playlist grouping is set to %album%, which is automatically finding my new %venue% field somehow, and it defaults to by track order unless each show has a unique venue name.  Ultimately I would like the playlist to be grouped and sorted by a set of fields and not one master field that has to be unique to each show/show source.  This works swimmingly in Library Tree view configurations, but does not seem to work here. 

Re: Dumb Columns UI Playlist Sorting Question

Reply #1
The issue I'm running into is the Columns UI playlist view seems to sort by album automatically

Nope, It's not a playlist viewers job to sort playlist items as they are added. That is entirely the responsibility of whichever library viewer you are using to populate the playlist.

If you were using Columns UI filters, you can change the sort pattern found under File>Preferences>Display>Columns UI>Filters>Behaviour tab.

Other library viewers may have their own settings. But as an example, ReFacets does not.

Re: Dumb Columns UI Playlist Sorting Question

Reply #2
I am using a SpiderMonkey panel with Library Tree.   Everything shows up in my library view just great and I can change the view settings and filter settings of my library easily using the various tagging fields I've made for my live music collection. 

However, regardless of the order which I choose shows (i.e. albums) in the library view, the tracks group by track number in the playlist view, the only way to prevent this that I have found is to have a unique album title by show, but the whole point of breaking out all album title information into separate fields was, first, for the aforementioned ease in sorting/filtering in the library view, and second, to eventually get my live music collection to integrate more easily regular album collection, which for how I'm currently thinking of setting it up, will be easier if the live shows do not have album titles. 

I have messed around with the Behaviour settings you mention to no avail.  Not entirely sure if I'm using the settings wrong or if they do not apply when using a SpiderMonkey panel.

Re: Dumb Columns UI Playlist Sorting Question

Reply #3
Most settings in Preferences do not apply to script panels (aside from things like default colors) so you need to change settings in Library Tree. In this case click the top '...' > Options > Behavior tab and under Playlist, use 'Playlist sort order' box to enter the fields you want. (This box overrides the default sort which is the view pattern, which you may not have setup correctly)

The %album% field also checks %venue% by default as explained in Title Formatting Reference ("Remapped fields"). You can use $if2 or $if3 if you want to replicate checking of multiple fields in the same way.

Make sure you include complete string with things like %discnumber% - missing such fields is most often the cause of things being sorted incorrectly by %tracknumber% first. This is a basic example -

Code: [Select]
%album artist%|%date%|%album%|%discnumber%|%tracknumber%|%title%

I use something like this to remove artist prefixes ("The") from sorting, and include additional fields I use like %partnumber% -

Code: [Select]
$stripprefix($if2($meta(album artist,0),$meta(artist,0)))  |$if2(%date%,%genre%)|$if2(%album%,%genre%)  |%releasedate%|%discnumber%|%tracknumber%|%partnumber%|$stripprefix(%title%)  


Re: Dumb Columns UI Playlist Sorting Question

Reply #4
Hmmm, so this is where I'm running into the limits of my understanding of the interaction between various settings of base foobar and its components.  Though I do appreciate the clarification on why %venue% was showing up.  I do find it funny that there's a default built in like that, that I otherwise have to add manually as a default field I'm using?  Is there somewhere I can specify which fields I want to show in the properties dialogue?  Is there somewhere I can stop %album% from automatically remapping if I wanted to?

I had not found that Library Tree playlist sorting you had pointed me to, and initially it didn't seem to solve my problem.  But I found that if I leave it blank (blank = default according to the Library Tree dialogue) and then updated the Columns UI > Playlist View > Grouping to group tracks according to the criteria I want that things are working appropriately.

My view is set up as

Code: [Select]
$nodisplay{%DATE%}[%SOURCE%][ - %SHNID%][ - %TAPED BY%][ - %MATRIXED BY%][ - %TRANSFERRED BY%][ - %MASTERING BY%]|[%date%][ - %VENUE%][ - %LOCATION%]|

Library Tree "..." > Behavior > Playlist Sorting is blank

Columns UI > Playlist View > Grouping

Code: [Select]
%date% [- %source% ]- %venue% - %location%

This makes the playlist work appropriately to my desires, but if there's a more elegant solution I would love to learn something new. 

All my Library Tree panels are set to source from another Library Tree panel and I have daisy chained multiple library tree panels together.  The first panel is simply to sort the entire library by format (i.e. lossy/lossless, all music, or specific codecs).  Next is a Tab Stack, each tab contains another Library Tree Panel, sourcing from the first, filtered by artist/set of artists and which sorts by year (for live music). And finally is a third library tree panel, sourced from the second, that displays the shows (albums) as a cover flow type deal.  I suspect this could be made to be more elegant as well if anyone has any pointers.

Re: Dumb Columns UI Playlist Sorting Question

Reply #5
Is there somewhere I can specify which fields I want to show in the properties dialogue?
Yes, in Preferences > Advanced > Display > Properties dialog > Standard fields. Insert or re-arrange fields in the order you want them displayed in Properties dialog, keeping each separated by semi-colon. (Might be easier to copy the string into a text editor and paste it back again)

Quote
Is there somewhere I can stop %album% from automatically remapping if I wanted to?
Yes, anywhere you use %album%, use $meta(album) instead. Same goes for the other remapped fields. (I'm sure this must be noted somewhere in the wiki pages but who knows where)

Quote
I had not found that Library Tree playlist sorting you had pointed me to, and initially it didn't seem to solve my problem.
Maybe because I forgot to say there is a bug with 'Playlist sort order' box in Library Tree. Seems like sometimes you have to either restart foobar or reload the panel for the change to take effect. So after entering anything in that box and clicking OK, then hold SHIFT+WIN keys over panel > right-click > Reload.

Quote
  But I found that if I leave it blank (blank = default according to the Library Tree dialogue) and then updated the Columns UI > Playlist View > Grouping to group tracks according to the criteria I want that things are working appropriately.
Interesting...

Quote
My view is set up as

Code: [Select]
$nodisplay{%DATE%}[%SOURCE%][ - %SHNID%][ - %TAPED BY%][ - %MATRIXED BY%][ - %TRANSFERRED BY%][ - %MASTERING BY%]|[%date%][ - %VENUE%][ - %LOCATION%]|

This is what I was saying though, you need to include for example [%discnumber% ]%tracknumber% %title% at the end there (after | to create the last branch), because the tree view pattern is also how tracks are sorted when sent to playlist. The same is true in default Album List tree - if you remove them sorting is messed up. Note though unlike other viewers Library Tree has an option to NOT show tracks in the view if you wish - in Options > Display tab > under Show > Tracks (tree). So with that option your view should not actually look any different and sort correctly. (If I'm correct that was the issue in the first place)

Quote
All my Library Tree panels are set to source from another Library Tree panel and I have daisy chained multiple library tree panels together.  The first panel is simply to sort the entire library by format (i.e. lossy/lossless, all music, or specific codecs).  Next is a Tab Stack, each tab contains another Library Tree Panel, sourcing from the first, filtered by artist/set of artists and which sorts by year (for live music). And finally is a third library tree panel, sourced from the second, that displays the shows (albums) as a cover flow type deal.  I suspect this could be made to be more elegant as well if anyone has any pointers.
Sounds fine. My setup is similar...

Just note that each panel is a separate instance with its own settings, so when it comes to things like sorting, you have to change the settings for each panel individually. (For this reason I just copy/paste my sort pattern to the 'Playlist sort order' box for quick consistency)

Re: Dumb Columns UI Playlist Sorting Question

Reply #6
Awesome, thank you for the continued help!  Everything is working out nicely, though I've got an slightly unrelated question now. 

I'm using the below code (stolen from the Titleformat Examples wiki) to sort my live music my month, it works great.

Code: [Select]
($puts(char1,-)$puts(char2,-)$puts(tag,%date%)$puts(spacer1,$strchr($get(tag),$get(char1)))$puts(spacer2,$strrchr($get(tag),$get(char2)))$trim($substr($get(tag),$add($get(spacer1),1),$sub($get(spacer2),1)))

However, since this is isolating the month from a date formatted yyyy-mm-dd, it returns a numerical value.  This isn't a huge deal, but I thought I would write a very long if statement to replace "01" with "January" & "02" with "February" & so on.  However, the if statement does not work, it appears to always evaluate the above code as true no matter what value I specify.

For example, the below is resulting in all the music sorting to January and none to February.

Code: [Select]
$if(($puts(char1,-)$puts(char2,-)$puts(tag,%date%)$puts(spacer1,$strchr($get(tag),$get(char1)))$puts(spacer2,$strrchr($get(tag),$get(char2)))$trim($substr($get(tag),$add($get(spacer1),1),$sub($get(spacer2),1))))=01, January, February)

Any ideas?

On a similar note I was messing around with some other if statement sorting patterns in the form of:

Code: [Select]
$if(<field> MISSING, sort this way, sort that way)

Which also wasn't working similarly to the above, the statement was always resulting in a "sort this way" even if criteria for "sort that way" is met.  What am I missing here regarding Foobar ifs?

Re: Dumb Columns UI Playlist Sorting Question

Reply #7
Code: [Select]
($puts(char1,-)$puts(char2,-)$puts(tag,%date%)$puts(spacer1,$strchr($get(tag),$get(char1)))$puts(spacer2,$strrchr($get(tag),$get(char2)))$trim($substr($get(tag),$add($get(spacer1),1),$sub($get(spacer2),1)))
However, since this is isolating the month from a date formatted yyyy-mm-dd, it returns a numerical value.

No need for any of that. Just use $month(%date%) - (see "time and date functions")


Quote
I thought I would write a very long if statement to replace "01" with "January" & "02" with "February" & so on.

And for this you can use $select - this function takes a number, in this case $month, and returns the corresponding value from the string you specify -

Code: [Select]
$select($month(%date%),January,February,March,April,May,June,July,August,September,October,November,December)

^ So if the $month number is 7, it returns "July". Then combine that with the other date functions -

Code: [Select]
[$day_of_month(%date%) $select($month(%date%),January,February,March,April,May,June,July,August,September,October,November,December) $year(%date%)]

^ And it returns a date in the form of "25 July 2024".


Quote
However, the if statement does not work, it appears to always evaluate the above code as true no matter what value I specify. For example, the below is resulting in all the music sorting to January and none to February.
Code: [Select]
$if(($puts(char1,-)$puts(char2,-)$puts(tag,%date%)$puts(spacer1,$strchr($get(tag),$get(char1)))$puts(spacer2,$strrchr($get(tag),$get(char2)))$trim($substr($get(tag),$add($get(spacer1),1),$sub($get(spacer2),1))))=01, January, February)

Not the right syntax. Ignoring all that mish-mash for the moment, $if does not use symbols (=,> etc) for determining if something is equal or any other comparisons, rather it uses other functions. Use $if together with string compare functions like $strstr (partial match) or $strcmp (exact match) or $stricmp (exact match, only not case sensitive). There are also other forms such as $ifequal and $ifgreater that compare numbers.

The string compare stuff returns a true/false, so it goes immediately after $if in the condition part - "$if (condition is true?, then return this, else return that)". So for a quick example -

Code: [Select]
$if($strcmp(%album artist%,Various),true,false)
$if($strstr(%album artist%,Various),true,false)

^ If the %album artist% tag in this case had exactly the letters "Various Artists" (without quotes) and nothing else, the $strcmp would return false (not an exact match), and the $strstr would return true (partial match).

Code: [Select]
$ifequal($month(%date%),7,true,false)

^ If the month equals 7, the true part is returned, otherwise false.


Quote
On a similar note I was messing around with some other if statement sorting patterns in the form of:
Code: [Select]
$if(<field> MISSING, sort this way, sort that way)

You cannot mix "query syntax" (used for library searches) in with "title formatting" (used to display and format tags) - they are two different languages. (Though you can the other way around, use title formatting in query syntax)

Having said that, I think title formatting will usually ignore any extraneous words in the condition part. The field itself returns a true/false if it is tagged or not, so just use -

Code: [Select]
$if(%field%,true,false)

Although whether it works for sorting might depend where exactly you are entering it, and Library Tree (being a javascript that has to parse things over and over) might not support every type of usage.

If you're on 32-bit foobar and want to learn title formatting by seeing exactly what each part of a script is evaluating to, I suggest install Title Formatting Sandbox. Select a track in playlist with tags you want to test, open it in View menu > Title Formatting Sandbox, and enter or paste any scripts there, and you can click on each part of the script to see what it returns from the selected track. Using this you can end up writing some complex stuff and see exactly what is happening at each step.

Re: Dumb Columns UI Playlist Sorting Question

Reply #8
@anamorphic While very belated, I appreciate the explanations very much and your latest reply has helped me greatly, my library is coming along really nicely!  I left for a month long vacation at the end of July and have just the past couple weeks been putting more work into my Foobar setup and library organization. 

I have a new question not quite related to the original intent of this thread, but figured I'd keep it all compiled here ¯\_(ツ)_/¯

I have set up Performer as a multi-value field and am using it to track band members in my various live recordings.  It might be Joe Henderson's name on the bill, but who was playing with him?  Now that I've populated many of my various live recordings with the performers, being able to sort my library by that value is so extremely cool!  The next puzzle to solve is whether or not I would be able to get library tree to show the artist art by %artist% when in my "View by Artist" view, and by %performer% when in my "View by Performer" view. 

Re: Dumb Columns UI Playlist Sorting Question

Reply #9
^ Without knowing for certain, the way foobar looks for art, I would say probably not. Because foobar displays only the first image found (in Preferences > Display > Artist tab for example), I think this presents a problem with assigning the correct artist image from a multi-value tag. The "first image found" thing means that a single track can only ever have one of each type of image assigned to it - one front cover, one artist, etc, per track.

I ran into the same issue using Facets back in the day, trying to make it display correct artist + featured artist images from multi-value tags. (The trouble is I cannot really remember if my solution worked :D, besides I eventually gave up on having column images at all)

It could be possible / feature request for Library Tree if it did some script trickery to look for art without using foobar defaults, if the author WilB ever reappears one day. Like a way to make Library Tree use a specific search pattern or different art thread (like the Disc tab) for a specific view. Even then it would need a way to assign the correct image to the correct multi-value (assuming you are splitting values to list individuals, i.e. %<performer>%) - probably take quite a bit of work though.

 

Re: Dumb Columns UI Playlist Sorting Question

Reply #10
Ok yeah, that makes sense.  I suppose I'll just do a tab stack to switch between Artist sorting and Performer sorting, that way I can have Artist thumbnails in Artist sorting and no thumbnails in Performer performer sorting.

I'm currently attempting to string a bunch of ifs together for my playlist grouping in an attempt to only use the discnumber field at certain times.  The easier way to do this would be to just make sure that tag is utilized at the correct times instead of trying to ignore it in certain situations, but I thought it would be fun to see if I could title format my way out of the problem.  I'm not making any headway haha. 

Kind of the driving impetus here is less hassle when I backup my hard drives, libarary-wide bulk changing of metadata makes periodic backups take forever.