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: Is it possible to sort album list by disc number without showing it? (Read 1864 times) previous topic - next topic
0 Members and 1 Guest are viewing this topic.

Is it possible to sort album list by disc number without showing it?

This is my custom album list view:

Code: [Select]
$swapprefix($directory(%path%,2))|$year(%date%) - $directory(%path%,1)| %tracknumber% - %title%

the problem is when an album has more than 1 disc the tracks get lumped together rather than showing all tracks from disc 1, then all tracks from disc 2, etc:



I can add %discnumber% in there but then the disc number gets shown in the list before the track number which is redundant for most of the albums which are single disc, & and it also shows as a blank space for albums with no disc number set (most of them) which looks bad.

is there any way to sort the album list by disc number before track number, but not actually display the disc number? thanks in advance xoxo
thank you foobar community for a great app and all your friendly & helpful support!!! ❤❤❤

Re: Is it possible to sort album list by disc number without showing it?

Reply #1
not without showing it when it _is_ present. If you don't mind having it shown when present, use this for [disc].track
Code: [Select]
$if($strcmp($num(%totaldiscs%,2),01),,$if($and(%tracknumber%,%discnumber%),$num(%discnumber%,1).))[%tracknumber%]
or put a sort string in the Sorting Script tab.

Both above methods still require clicking the column header to sort if the initial display isn't sorted as you want.
To have it sorted on initial display you would be better of putting a custom sort string in
`Prefences > Shell Integration (Sort Incoming Files By)` [<- this one also controls the order how they first appear in the playlist]

For this and the Sorting Script tab you can just use the desired fields without any '$if' logic since it's never shown anywhere

Re: Is it possible to sort album list by disc number without showing it?

Reply #2
I can add %discnumber% in there but then the disc number gets shown in the list before the track number which is redundant for most of the albums which are single disc,

Not exactly what you are asking for, but I find it very handy: you can put the disc number branching expression inside a conditional statement, in order to show it only for multiple discs. I don't know your folder structure and tagging scheme, but, for example, I use the discnumber field only for multiple discs albums, therefore I can write something like this:
Code: [Select]
[%release date% - ]%album%[|disc %discnumber%]|[%tracknumber% - %title%]
I'm late

Re: Is it possible to sort album list by disc number without showing it?

Reply #3
not without showing it when it _is_ present. If you don't mind having it shown when present, use this for [disc].track
yes, that's just fine! i should have specified that in phrasing the request, my apology.

Code: [Select]
$if($strcmp($num(%totaldiscs%,2),01),,$if($and(%tracknumber%,%discnumber%),$num(%discnumber%,1).))[%tracknumber%]
or put a sort string in the Sorting Script tab.
this works perfectly, thanks a bunch!!!

Both above methods still require clicking the column header to sort if the initial display isn't sorted as you want.
i've actually never had this problem with foobar, in my experience either selecting the album for the "Library Viewer Selection" or double clicking it to send to a playlist always maintains the order shown in the album list. maybe meticulous tagging is to thank? either way, thank you for this & the other tips! just wondering, is the Sorting Script tab default or from an add-on? i don't see it anywhere in the album list settings.

Not exactly what you are asking for, but I find it very handy: you can put the disc number branching expression inside a conditional statement, in order to show it only for multiple discs. I don't know your folder structure and tagging scheme, but, for example, I use the discnumber field only for multiple discs albums, therefore I can write something like this:
Code: [Select]
[%release date% - ]%album%[|disc %discnumber%]|[%tracknumber% - %title%]
this works great too!! so the [brackets] are a conditional to only display if the tag is present? i tested it with:

Code: [Select]
$swapprefix($directory(%path%,2))|$year(%date%) - $directory(%path%,1)| [%discnumber%.][%tracknumber%] - %title%
which seems to produce the same result as Just_Addict's code, both are like:



this is perfect & just what I was hoping for, thanks a bunch both for your great feedback & tips!!! and so fast too!
thank you foobar community for a great app and all your friendly & helpful support!!! ❤❤❤

Re: Is it possible to sort album list by disc number without showing it?

Reply #4
Shell Integration sort order is for files dragged in from Windows Explorer. The display pattern in album list is also the order for items sent to a playlist from the media library. You can sort a playlist manually, in case either of the above produced a wrong order, under Edit > Sort > Sort by (maybe assign a keyboard shortcut if used often).

Just_Addict's code handles the odd case when the disc number is populated but the track number is not. I would use a shorter expression, to save from having to clear the discnumber from single disc releases:

$ifgreater(%totaldiscs%,1,[%discnumber%.],)

Another common case to handle in the media library is albums or singles with the same title and year (remasters), which would merge unless some short tag field is added at the album level that is different for each release (remaster year, and/or catalog). I like to use $crc32() over these extra fields to avoid cluttering the display, but still take them into account. It is possible to substitute small whitespace characters to display almost nothing in place of a field, but the code is rather long.

Re: Is it possible to sort album list by disc number without showing it?

Reply #5
this works great too!! so the [brackets] are a conditional to only display if the tag is present? i tested it with:

Code: [Select]
$swapprefix($directory(%path%,2))|$year(%date%) - $directory(%path%,1)| [%discnumber%.][%tracknumber%] - %title%

Yes, that's what the square brackets notation does, but what I meant to underline is that you can put the branching notation "|" inside the conditional statement. You can create a node for the disc number, in between the album node and the track node, and display it only if you have multiple discs.
Given the %discnumber% field is empty for single disc albums, your code above would be:
Code: [Select]
$swapprefix($directory(%path%,2))|$year(%date%) - $directory(%path%,1)[|disc %discnumber%]|[%tracknumber% - ]%title%

Whether this will work for you depends on your tagging scheme. If the %discnumber% tag is always present, using @j7n suggested expression, you could try:
Code: [Select]
$swapprefix($directory(%path%,2))|$year(%date%) - $directory(%path%,1)$ifgreater(%totaldiscs%,1,[|disc %discnumber%],)|[%tracknumber% - ]%title%
I'm late