mirror of
https://github.com/advplyr/audiobookshelf.git
synced 2026-05-30 23:40:40 +02:00
[Enhancement] Sort by "CD From Filename" and read CD id3 tag #80
Closed
opened 2026-04-24 22:57:52 +02:00 by adam
·
10 comments
No Branch/Tag Specified
master
book_tags_genres_dedupe
episode_download_fallback
Issue-4540-SortBy-StartedDate-and-FinishedDate
episode_meta_tagging
fix_authorize_race_condition
redirect_transcode_requests
progress_updated_sort
fix_ereader_socket_event
fix_change_empty_root_password
fix_podcast_session_track_index
fix_set_token
session_modal_user
localize_durations
fix_oidc_create_user
jwt_auth_refactor
fix_scanner_deleting_single_file_books
fix_mediaprogress_updatedat_2
experimental_next_client
podcast_episode_duration
episode-timestamps-clickable
book_author_secondary_sort_title
podcast_useragents
pathexists_user_access
fix_pathexists_join
book_author_secondary_sort
clean_duplicate_mediaprogress
sanitize_html_description
trix_prevent_attachments
check_path_api_fix
fix_mediaprogress_updatedat
increase_express_json_limit
fix_dockerfile_nunicode
search_episodes
audiobook_tools_update
episode_secondary_sorts
hls_stream_url_update
new_session_track_endpoint
audiobook_tools_enhancements
watcher_rescans_update
player_track_tooltip
fix_exclude_prefixes_crash
socket_item_events
fix_podcast_episode_scanner_promise
new_stats_controller
count_cache_for_userpermissions
parsing-opf-v3
validate_migration_files
fix-quick-match-all-crash
fix-chapter-end-sleep-timer
stringify_sequelize_query
remove-col-ambiguity
fix_next_prev_edit_description
details_trim_whitespace
fix_content_url_basepath
fix_logger_fatal
progress_bar_visibility
batch-edit-populate-map-details
feed_generator_updates
bookmark-modal-updates
migrate-library-item-in-scanner
migrate-new-library-items
migrate-podcasts-new-library-item-2
migrate-podcasts-new-library-item
fix-remove-episode-from-playlist
playback-session-use-new-library-item
refactor-library-item
fix-heatmap-caption
feed-episodes-upsert
share-media-player-media-session-api
remove-old-playlist
remove_old_collection_object
plugin-implementation-demo
feed_migration
refactor-feeds-from-item
fix_remove_authors_no_books
v2.17.3-fk-constraints-migration
migrations-first-upgrade
sqlite_2
feature/nuxt-target-server
waveform
sqlite
playlists
video
v2.35.1
v2.35.0
v2.34.0
v2.33.2
v2.33.1
v2.33.0
v2.32.1
v2.32.0
v2.31.0
v2.30.0
v2.29.0
v2.28.0
v2.27.0
v2.26.3
v2.26.2
v2.26.1
v2.26.0
v2.25.1
v2.25.0
v2.24.0
v2.23.0
v2.22.0
v2.21.0
v2.20.0
v2.19.5
v2.19.4
v2.19.3
v2.19.2
v2.19.1
v2.19.0
v2.18.1
v2.18.0
v2.17.7
v2.17.6
v2.17.5
v2.17.4
v2.17.3
v2.17.2
v2.17.1
v2.17.0
v2.16.2
v2.16.1
v2.16.0
v2.15.1
v2.15.0
v2.14.0
v2.13.4
v2.13.3
v2.13.2
v2.13.1
v2.13.0
v2.12.3
v2.12.2
v2.12.1
v2.12.0
v2.11.0
v2.10.1
v2.10.0
v2.9.0
v2.8.1
v2.8.0
v2.7.2
v2.7.1
v2.7.0
v2.6.0
v2.5.0
v2.4.4
v2.4.3
v2.4.2
v2.4.1
v2.4.0
v2.3.5
v2.3.4
v2.3.3
v2.3.2
v2.3.1
v2.3.0
v2.2.23
v2.2.22
v2.2.21
v2.2.20
v2.2.19
v2.2.18
v2.2.17
v2.2.16
v2.2.15
v2.2.14
v2.2.13
v2.2.12
v2.2.11
v2.2.10
v2.2.9
v2.2.8
v2.2.7
v2.2.6
v2.2.5
v2.2.4
v2.2.3
v2.2.2
v2.2.1
v2.2.0
v2.1.5
v2.1.4
v2.1.3
v2.1.2
v2.1.1
v2.1.0
v2.0.24
v2.0.23
v2.0.22
v2.0.21
v2.0.20
v2.0.19
v2.0.18
v2.0.17
v2.0.16
v2.0.15
v2.0.14
v2.0.13
v2.0.12
v2.0.11
v2.0.10
v2.0.9
v2.0.8
v2.0.7
v2.0.6
v2.0.5
v2.0.4
v2.0.3
v2.0.2
v2.0.1
v1.7.2
v1.7.1
v1.7.0
v1.6.0
v1.5.5
v1.5.0
v1.4.11
v1.4.9
v1.4.7
v1.4.6
v1.4.4
v1.4.2
v1.4.0
v1.4.1
v1.3.4
v1.3.3
v1.3.1
v1.2.8
v1.2.6
v1.2.5
v1.2.4
v1.2.1
v1.1.15
v1.1.14
v1.1.13
v1.1.12
v1.1.11
v1.1.10
v1.1.9
v1.1.8
v1.0.0
0.9.61-beta.0
0.9.61-beta
Labels
Clear labels
authentication
backlog
bug
chapter editor
config-issue
ebooks
encoding/embedding
enhancement
help wanted
listening sessions & progress
planned
possible plugin
progress sync
pull-request
sorting/filtering/searching
unable to reproduce
upload
users & permissions
waiting
Mirrored from GitHub Pull Request
No Label
enhancement
Milestone
No items
No Milestone
Projects
Clear projects
No project
Assignees
adam (Adam Melkus)
Clear assignees
No Assignees
Notifications
Due Date
No due date set.
Dependencies
No dependencies set.
Reference: starred/audiobookshelf#80
Reference in New Issue
Block a user
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @juriroemer on GitHub (Oct 27, 2021).
Can we have the track manager auto sorting (see #128) for the "CD From Filename" column aswell? :) That way it would be possible to get the right order for books where all CDs start at 1 by first sorting by Track ID, then sorting by CD.
Also I think the "CD From Filename" is only populated by parsing the track name, if I'm not mistaken? Having it also look at the corresponding id3 tag and the folder name would be nice.
@advplyr commented on GitHub (Oct 29, 2021):
The CD is only parsed from the filename because I didn't see any ID3 tags for the CD #. Do you know which ID3 tag your audio files use for CD #?
In my audiobooks the CD is usually in the name of the album or title meta tag.
@seanap commented on GitHub (Nov 9, 2021):
I use DISCNUMBER (TPOS) for CD#

@juriroemer commented on GitHub (Nov 9, 2021):
Yes I'm not 100% sure which would be the right tag, but I've seen id3 tag editors having a CD# column...
@zombiehoffa commented on GitHub (Nov 16, 2021):
While not a permanent solution, if you just want to get it working music brainz picard https://picard.musicbrainz.org/ has decent id3 tag editing abilities (including generating id3 tags from file names). I use it to clean up my audiobooks just enough for readarr to recognize it and take it the rest of the way then mount the readarr audiobook dir in my audiobookshelf docker read only so audiobookshelf doesn't mess up readarr.
@KindOfOK commented on GitHub (Jan 3, 2022):
Yeah, I'm also having problems with how tracks are parsed upon addition to the library.
My filenames are in the format of "disc-track - title.ext" (e.g., 1-03 - Chapter 1c.mp3). Specifically, while the filenames do have leading zeroes for the track number, they (unfortunately!) do not have leading zeros for the disc number. Audiobookshelf appears to not be able to sort per this convention. In fact, the "CD from Filename" column is entirely blank. This results in all the tracks being out of order, beginning with the second disc being presented first - see screenshot (red).
Also, on a separate but related note, in the settings, I have "scanner prefer audio metadata" toggled on - in the below screenshot, you can see that the program appears to be parsing the track number from both sources: this metadata and also the filename (green). You will note that the output between these methods does not match, which suggests that the naming convention I've used for my filenames may be causing issue. In fact, if you look closely, multiple duplicate track numbers are presented, which to me, suggests that the program is interpreting the leading number of the filename as the track number, not the disc number as my naming convention follows.
When you combine these above factors, it causes problems: the disc number in the filename isn't be "correctly" recognized and the track number is not agreed upon. The result is that 'duplicate track number "[number]"' is generated (blue) and Audiobookshelf understandably doesn't know how to reconcile this.
I would argue that the resolution to the issue is to rely 100% on the metadata. If I'm understanding the conversation above, @advplyr , you're suggesting that there isn't clarity on what the ID3 tag(s) should be. It's my experience that the below tags are pretty universal and would be what I recommend. Regardless, can we pick some tag for track, total tracks, disc, and total discs, and just go with it, indicating those tags in the Documentation page on the website? As you've already indicated in the table on that Documentation, perhaps even consider a primary and a secondary (fallback) option for these tags?
If, however, ID3 tags/metadata is not to be relied upon, can the Documentation be updated to add what the expected filename naming convention is? Perhaps, as you've already done in the settings, maybe the answer is to provide both options?
At this point, I'm only an ideas man. I don't have any of the requisite programming skills to contribute there. However, I am interested in anyone's thoughts, as I have to imagine that this is a common scenario.
@MidnightSnowleopard commented on GitHub (Jan 3, 2022):
I was grappling with this myself. I've checked the code and it literally check for something along the line of "disc xx" for file name based checking. It also seems to be case sensitive in my testing with "Disc 1" not being detected but "disc 1" being detected. Once it conforms to this exact format it will detect.
Unfortunately this doesn't really fix the issue as it fills out the "CD from Filename" column correctly with information on it and then still labels all tracks with the same number as conflicting even with different disc numbers assigned to each.
advplyr has already stated in a referenced issue that this is something that intended to be supported in the future.
Originally posted by @advplyr in https://github.com/advplyr/audiobookshelf/issues/127#issuecomment-996335297
@KindOfOK commented on GitHub (Jan 7, 2022):
Ah - got it. I'm sorry I missed that posting - thanks for pointing that out, @MidnightSnowleopard !
@advplyr , I wish I could help - I'd be happy to beta test anything, but probably can't do much else! Good luck, and I look forward to any resolution!
@advplyr commented on GitHub (Jan 9, 2022):
Is your naming convention for the audio files standard? I'm not sure how the scanner would determine in your example which number is the CD and which number is the track.
Right now the CD# is parsed from the filename only if it is preceded by "cd" or "disc" case-insensitive. The CD# isn't actually used for anything yet.
I'm not sure how to handle CD #. I'm thinking it will only be useful for ordering the tracks. I have a few audiobooks with CD and the scanner doesn't do well with them because of the duplicate track #'s. Then the scanner will set an internal track number ignoring the CD's.
I'm going to add the ID3 metadata parse for CD and see about properly sorting audiobooks with CD's.
@advplyr commented on GitHub (Jan 10, 2022):
Just released
v1.6.56that also pulls the disc number from metadata.For new audiobook scans I added a new method for ordering the tracks that takes into account the disc number. It tries to use whichever value is more accurate, the filename or metadata number.
The meta tag it looks for is
discnumberordiscordiskortpos@advplyr commented on GitHub (Jan 10, 2022):
That version had issues, updated to
v1.6.57and added docs for how audio tracks are ordered: https://www.audiobookshelf.org/docs#tracks