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: Album list: Show all directories before files (Read 19308 times) previous topic - next topic
0 Members and 1 Guest are viewing this topic.

Album list: Show all directories before files

Album list:

-> sorting by folder structure


say we have mainfolder = C:\Music


contents of C:\Music are

dsdff (subfolder)
trtwr (subfolder)
1.mp3 (file)
s.mp3 (file)



-> now foobar displays it as

1.mp3
dsdff
s.mp3
trtwr


(folders and files listed mixed)





Why not displaying

dsdff
trtwr
1.mp3
s.mp3


(folders before files)

?

Windows Explorer and Total Commander for example both always display the folders before files.

Album list: Show all directories before files

Reply #1
It would make some sense, however I think Album list sorts always simply by the displayed string. Another hidden sorting criteria might need complex architecture changes, so don't hold your breath.
Full-quoting makes you scroll past the same junk over and over.

Album list: Show all directories before files

Reply #2
Btw, I've tried this custom formatting for a while and it works great, only looks a bit ugly...
[font= "Courier New"]$replace($directory_path($substr(%path%,4,999)),\,|000: )|%filename_ext%[/font]
Full-quoting makes you scroll past the same junk over and over.

Album list: Show all directories before files

Reply #3
Hi, I tried this command and I confirm this sorting does look ugly lol

I think the simpler way to solve Dandruff's problem would be by counting and comparing the number of "\" : one more=one subfolder deeper.

Moreover, related issues have been posted here and here. When I had enough free time I'll try to craft a nice sorting command

Cheers

Album list: Show all directories before files

Reply #4
Any chance to get this in the next version by default in the folder structure view? Really odd in my opinion that single files get listed between folders.

Album list: Show all directories before files

Reply #5
Eh "000:"... I currently use the following pattern, it looks quite nice:
"by folder structure+", "[font= "Courier New"]$replace($directory_path($substr(%path%,4,999)),\,| $char(8226) )|%filename_ext%[/font]"
Full-quoting makes you scroll past the same junk over and over.

Album list: Show all directories before files

Reply #6
@Yirkha
just was looking for something like that. But changed it in some way:

Code: [Select]
$replace($replace($directory_path(%path%),C:\[path of your music]\,),\,|$char(8239))|[%tracknumber% - ][%track artist% - ]%title%


1. I changed the way the library shows your music (You have to paste the path of your music library)
2. I changed it not to show the full filename (just tracknumber, artist and title)
3. 8239 instead of 8226 to change the bullet to an empty space (just because the bullet doesn't seem to be nice to me  - but you have to be carefull if some files have an empty space on the first digit of their %title% - they'll probably be previous the folders)

Album list: Show all directories before files

Reply #7
I just stumbled onto this thread and it's exactly how i want to arrange my album list.

Can someone please tell me where/how to enter this code.
i don't really have time to learn anything advanced so just some simple instructions would be very helpful

Album list: Show all directories before files

Reply #8
Can someone please tell me where/how to enter this code.


Go to Files -> Preferences -> Media Library -> Album List -> Add New
Put a custom name in the first column and copy paste the code in the second.
You should then be able to select your custom view in the Album List window.

Album list: Show all directories before files

Reply #9
thankyou i got it sorted now

Album list: Show all directories before files

Reply #10
Can someone please tell me where/how i can do like this in foobar:
Attach please screenshot of how is your tune up should look like.

 

Album list: Show all directories before files

Reply #11
This feature seems to be requested for a long time now. The workarounds seem to get pretty close, but it's not so intuitive to do. And gets more complicated if your library searches various folders.

Is there a "tracked" feature request list somewhere? What do the devs have to say about this feature?

In case custom is still preferred. they could make it easier. I can think of two other features that would make path-based album listing easier:
* A string function that strips all "Music folders" set in the preferences, from the path. So you don't have to do a replace for each one individually.
* A replace function that supports regular expressions or wildcards.

I found Noxxit's solution the closest to my needs.

Album list: Show all directories before files

Reply #12
@Yirkha
just was looking for something like that. But changed it in some way:

Code: [Select]
$replace($replace($directory_path(%path%),C:\[path of your music]\,),\,|$char(8239))|[%tracknumber% - ][%track artist% - ]%title%


1. I changed the way the library shows your music (You have to paste the path of your music library)
2. I changed it not to show the full filename (just tracknumber, artist and title)
3. 8239 instead of 8226 to change the bullet to an empty space (just because the bullet doesn't seem to be nice to me  - but you have to be carefull if some files have an empty space on the first digit of their %title% - they'll probably be previous the folders)


Further changed this line, as I had some issues with it:
1. Songs which were on the base of the music library would still show the entire path. This is because the directory_path function strips the last slash and the replace wouldn't find it.
Example:
path = $directory_path = $replace
C:\Users\MyName\Music\song.mp3 = C:\Users\MyName\Music = C:\Users\MyName\Music (replace won't work)
C:\Users\MyName\Music\artist\song.mp3 = C:\Users\MyName\Music\artist = artist

And if you change the replace so it doesn't include the \ another problem occurs:
Example:
path = $directory_path = $replace
C:\Users\MyName\Music\song.mp3 = C:\Users\MyName\Music = "" (empty string)
C:\Users\MyName\Music\artist\song.mp3 = C:\Users\MyName\Music\artist = \artist (this leading slash would cause a leading collapsible entry in the listings)

So this was fixed by doing the replace first, then doing the directory_path function.

2. There's a | pipe that is always between the folder and song, even when the folder is an empty string. Which means that all songs in the base folder now show like if they were in subfolder that had no name. This pipe should only be there if there is a folder. So I added an if condition. To make it cleaner I used the puts and get function to store directory part. Another non-breaking space is needed in this case on the left of the directory string, as the replace doesn't cover this spot.

Code: [Select]
$puts(dir,$replace($directory_path($replace(%path%,C:\[path of your music]\,)),\,|$char(8239)))$if($get(dir),$char(8239)$get(dir)|)%filename_ext%
$puts(dir,$replace($directory_path($replace(%path%,C:\[path of your music]\,)),\,|$char(8239)))$if($get(dir),$char(8239)$get(dir)|)[%tracknumber% - ][%track artist% - ]%title%


Note that how the songs are shown can be either a filename or more detailed information.

Re: Album list: Show all directories before files

Reply #13
Hi guys.

I use this last sorting algorithm for the Album List window. Just to clarify, it is this one:
Code: [Select]
$puts(dir,$replace($directory_path($replace(%path%,C:\[path of your music]\,)),\,|$char(8239)))$if($get(dir),$char(8239)$get(dir)|)%filename_ext%

However, there is a problem - with the quick search - pressing the keys on the keyboard - I mean alphabetic characters.

If I use my own sorting algorithm "by folder structure (directory first)", then the quick search in the list does not work for directories, but only for files. So it only works partially and is unusable.

However, if I use the original, built-in, sorting algorithm called "by folder structure", then a quick search via keyboard characters works for both directories and files. So it generally works correctly.

Can it be fixed somehow ?

Thanks !