Inconsisent sorting for ascending and descending track number

Issue description:

When sorting by ascending track number for tracks with no assigned track number within an album, the order displayed is seemingly random.

However, when sorted by descending track number, the tracks are then sorted by their descending track name.

Ideally, when sorting by ascending track number, it should be sorting by ascending track name as a “backup” to be consistent with how it is sorted for the descending track number.

Logs:

Upload description: hexshade

Additional information:

 

 

Reproduction steps:

 
Select an album with no track numbers assigned to any of the tracks, and then sort them by ascending and then descending track number.
 

Media provider:

Subsonic

Screenshots:

 

    

This is already the case (Except that it uses the sort title)

2025-11-09 02:11:43.851 Verbose QueryBuilder  Query: SELECT .... FROM songs LEFT JOIN albums ON (songs.album_id=albums._id) WHERE (songs.album_id=?) ORDER BY songs.album_id DESC, songs.disc DESC, songs.track DESC, songs.sort_title COLLATE NOCASE DESC ('31') [200 in 10.83ms]
2025-11-09 02:11:56.301 Verbose QueryBuilder  Query: SELECT ... WHERE (songs.album_id=?) ORDER BY songs.album_id ASC, songs.disc ASC, songs.track ASC, songs.sort_title COLLATE NOCASE ASC ('31') [200 in 10.91ms]

I can’t think of a reason for the sort to behave differently between asc and desc they are the ones shown above.

I am seeing the same as OP (local files - v13.5b)

Sorting manually by sort title works correctly

It must be something to do with the part:

FROM songs LEFT JOIN albums ON (songs.album_id=albums._id)

No? Since this is the only difference between the two

They are the same just not cut at the same place.

Hi Tolriq.

I have made a discovery that should make this easier to solve for you.

So, the situation is as follows: Album with no track numbers. Album page is set to sort by ascending Track Number. Expected result is for these tracks to be sorted by Title alphabetically, but they are sorted in no discernible order.

I have discovered today that the player only displays the wrong sort order visibly on the album page, but internally queues the album in the right order.

If you select a track, that is displayed 1st, but should be 3rd according to the correct sorting rules, it will be placed 3rd in the queue and played from there. The queue will be in the correct alphabetical order by Title.

Similarly, if you press the Play button in the album page buttons, the album will be queued in the correct order according to the desired sorting rules.

It is only visibly on the album page the tracks are displayed in the wrong order.

I will upload a video demonstrating this with the thread title and my username as the description. I have logs taken while the video was recorded.

Hopefully this should help you track down where the problem is! cheers

Almost fixed in 14.0, thanks for the effort. The problem exists to a much more minimal degree now - titles are sorted correctly except that lowercase titles are displayed after uppercase on the album page. They are still queued correctly. Logs uploaded.

Screenshots:

Notice the position of ‘green reorder techno’