[Bug]: Book file names not ordered lexicographically #649

Closed
opened 2026-04-24 23:15:39 +02:00 by adam · 4 comments
Owner

Originally created by @TaakoMagnusen on GitHub (Sep 22, 2022).

Describe the issue

When a list of books is in lexicographic order in the underlying directory structure, they are not always ordered the same way in audiobookshelf

Steps to reproduce the issue

  1. Get audiobook comprised of many files
  2. name them in the following order
    BOOKNAME_01_01_01.mp3
    BOOKNAME_01_01_02.mp3
    BOOKNAME_01_02_01.mp3
    BOOKNAME_01_02_02.mp3
  3. Import book into audiobookshelf
  4. The order of the files is imported in the following way
    BOOKNAME_01_01_01.mp3
    BOOKNAME_01_02_01.mp3
    BOOKNAME_01_01_02.mp3
    BOOKNAME_01_02_02.mp3

Audiobookshelf version

v2.1.5

How are you running audiobookshelf?

Docker

Originally created by @TaakoMagnusen on GitHub (Sep 22, 2022). ### Describe the issue When a list of books is in lexicographic order in the underlying directory structure, they are not always ordered the same way in audiobookshelf ### Steps to reproduce the issue 1. Get audiobook comprised of many files 2. name them in the following order BOOKNAME_01_01_01.mp3 BOOKNAME_01_01_02.mp3 BOOKNAME_01_02_01.mp3 BOOKNAME_01_02_02.mp3 4. Import book into audiobookshelf 5. The order of the files is imported in the following way BOOKNAME_01_01_01.mp3 BOOKNAME_01_02_01.mp3 BOOKNAME_01_01_02.mp3 BOOKNAME_01_02_02.mp3 ### Audiobookshelf version v2.1.5 ### How are you running audiobookshelf? Docker
adam added the bug label 2026-04-24 23:15:39 +02:00
adam closed this issue 2026-04-24 23:15:40 +02:00
Author
Owner

@TaakoMagnusen commented on GitHub (Sep 22, 2022):

Attaching image of this phenomena for stormlight series book 1
Screen Shot 2022-09-21 at 3 47 08 PM

In this the first number (01) indicates the first book, the middle number (01-05) indicate the way the audiobook is broken into major sections, and the final number indicates the part of that major section. It should always increase starting with the final number, not the middle one.

@TaakoMagnusen commented on GitHub (Sep 22, 2022): Attaching image of this phenomena for stormlight series book 1 <img width="886" alt="Screen Shot 2022-09-21 at 3 47 08 PM" src="https://user-images.githubusercontent.com/39819109/191624250-b190e8d4-d26f-46fd-ae92-1539a574dd04.png"> In this the first number (01) indicates the first book, the middle number (01-05) indicate the way the audiobook is broken into major sections, and the final number indicates the part of that major section. It should always increase starting with the final number, not the middle one.
Author
Owner

@advplyr commented on GitHub (Sep 22, 2022):

Press Manage Tracks and see how the filename is being parsed. The track number and disc number attempt to get parsed and that determines the order of the tracks

@advplyr commented on GitHub (Sep 22, 2022): Press Manage Tracks and see how the filename is being parsed. The track number and disc number attempt to get parsed and that determines the order of the tracks
Author
Owner

@TaakoMagnusen commented on GitHub (Sep 22, 2022):

awesome! I just went to Manage Tracks, clicked the Filename header to sort by ascending, and saved the tracklist; that was so easy!

Incredible UI, great app, very excited about this amazing new self-hosted tool!

@TaakoMagnusen commented on GitHub (Sep 22, 2022): awesome! I just went to Manage Tracks, clicked the Filename header to sort by ascending, and saved the tracklist; that was so easy! Incredible UI, great app, very excited about this amazing new self-hosted tool!
Author
Owner

@TaakoMagnusen commented on GitHub (Sep 22, 2022):

the manage tracks didn't really tell me much about how the track number and disc number were parsed from the file name, i think the file metadata must be screwy, but that's on me/the files.

@TaakoMagnusen commented on GitHub (Sep 22, 2022): the manage tracks didn't really tell me much about how the track number and disc number were parsed from the file name, i think the file metadata must be screwy, but that's on me/the files.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/audiobookshelf#649