![]() |
Sort Logic for Playlists - Printable Version +- Moode Forum (https://moodeaudio.org/forum) +-- Forum: moOde audio player (https://moodeaudio.org/forum/forumdisplay.php?fid=3) +--- Forum: Support (https://moodeaudio.org/forum/forumdisplay.php?fid=7) +--- Thread: Sort Logic for Playlists (/showthread.php?tid=350) Pages:
1
2
|
Sort Logic for Playlists - FizzyTea - 07-25-2018 Is there a logic to the display order of playlists in the browse panel? It doesn't appear to be alphabetical or by modification time. I can't see a logic to it. It is the same order given by mpc lsplaylists so it is probably a MPD thing rather than a moOde thing but I wondered if anybody here has an idea how it works? RE: Sort Logic for Playlists - philrandal - 07-25-2018 I'd love to be able to sort listings into date, reverse date order, or alphabetical order in the browse panel RE: Sort Logic for Playlists - Tim Curtis - 07-25-2018 Sort the entire list or would directories still be listed at the top as they currently are? moOde just uses the list generated by MPD as-is, example below. It appears to be an alpha sort till you get to the Default Playlist entry which should be below the Aaa entry but instead is above it. Very odd. directory: NAS directory: RADIO directory: SDCARD playlist: Default Playlist playlist: Aaa playlist: Eee playlist: Favorites playlist: Test Code: pi@rp3:~ $ telnet localhost 6600 I'll have to play around with this a bit and see whats possible as far as sorts go. -Tim RE: Sort Logic for Playlists - FizzyTea - 07-25-2018 I would say directories should stay at top like now. My list is clearly neither sorted alphabetically or by time if I compare output from Code: mpc playlists Even just knowing why they are ordered the way they are would be helpful. But I can't figure out what's going on tbh. RE: Sort Logic for Playlists - duke.g - 07-25-2018 The order is given by the natural directory order as can be seen by: ls -lU /var/lib/mpd/playlists/ As far as I know that can not be rearranged easily. For FAT filesystem there is a utility fatsort. See for example: https://superuser.com/questions/368623/how-to-reorder-folders-as-displayed-in-ls-u Additionally see last post in: https://serverfault.com/questions/406229/ensuring-a-repeatable-directory-ordering-in-linux Quote: Modern Linux (ext4) adds a B-tree index for file lists. One of his effect is default files order depends on a hash of their names. To disable this feature use : Quote:tune2fs -O^dir_indexBut I don't know, what this really does. Perhaps someone knows. Regards Duke.g RE: Sort Logic for Playlists - TheOldPresbyope - 07-25-2018 (07-25-2018, 06:12 PM)duke.g Wrote: The order is given by the natural directory order as can be seen by: Good observation about the "natural" order. The man page for tune2fs says that setting the dir_index parameter means "Use hashed b-trees to speed up lookups for large directories". Apparently, the ext4 filesystem is the first in which this parameter is enabled by default. What qualifies as a large directory? Don't know. Will unsetting the parameter result in an ordering you like? Don't know. Will it result in a noticeable slowdown using the filesystem? Don't know. Does unsetting it mean the filesystem has to be forceably reindexed before it can be used? Don't know. Regards, Kent RE: Sort Logic for Playlists - Tim Curtis - 07-25-2018 Interesting and thanks @duke.g :-) For Browse panel output I should be able to do a simple array sort in the JS. -Tim RE: Sort Logic for Playlists - duke.g - 07-25-2018 Well I just made a copy of my SD-Card and tried it. The playlist are now alphabetically ordered and for me it makes no performance difference while using the (small) local library of my player. Small means: Artists: 873 Albums: 856 Songs: 4301 You first have to find out your device: I used lsblk Output: NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT sda 8:0 0 238.5G 0 disk sda1 8:1 0 238.5G 0 part /media/M_MUSIC mmcblk0 179:0 0 14.9G 0 disk mmcblk0p1 179:1 0 43.2M 0 part /boot mmcblk0p2 179:2 0 14.4G 0 part / -> This is my SD-Card where the playlists reside! I issued: sudo tune2fs -O ^dir_index /dev/mmcblk0p2 Then I rebooted. After that the playlists are in the "correct" order. Regards Duke.g RE: Sort Logic for Playlists - TheOldPresbyope - 07-25-2018 (07-25-2018, 09:15 PM)duke.g Wrote: Well I just made a copy of my SD-Card and tried it. There ya go! Not eager to try it on my NAS, however. RE: Sort Logic for Playlists - Tim Curtis - 07-25-2018 Thats cool but probably not necessary once the sorts are done in code. The advantage of using PHP/JS code and array sorting is: 1. Directories can easily be separated from files 2. The removeArticles() and ToLowerCase() functions can be used to yield an optimal sort 3. Additional array elements can be added to produce any sort order -Tim |