sandreas / m4b-tool

m4b-tool is a command line utility to merge, split and chapterize audiobook files such as mp3, ogg, flac, m4a or m4b
MIT License
1.12k stars 78 forks source link

Cue sheets for reading metadata #243

Closed bibstha closed 8 months ago

bibstha commented 11 months ago

Is it possible to make a cue sheet parser as a way to read metadata?

I've got a cuesheet like this

TITLE "Book Name"
FILE "somefile.mp3" MP3
  TRACK 01 AUDIO
    TITLE "Introduction"
    INDEX 01 00:00
  TRACK 02 AUDIO
    TITLE "Chapter 1"
    INDEX 01 00:12
  TRACK 03 AUDIO
    TITLE "Chapter 2"
    INDEX 01 12:05

Would love to use this to extract chapter information instead of silence detection.

sandreas commented 11 months ago

m4b-tool already has a cue parser, but it currently supports only importing and splitting.

You could try to use (but backup your file before):

m4b-tool meta --import-cue-sheet="path-to-cuesheet.cue" "input.m4b"

I could integrate CueSheet into the merge command, detecting any cue files in the root dir of an audio book, should not be too much effort, here it is https://github.com/sandreas/m4b-tool/blob/ccfb548cda1bfc5f764771ca10d11ba153488476/src/library/Audio/CueSheet.php#L13

I'm not sure how long this will take, I'm totally busy atm, sorry.

sandreas commented 8 months ago

merge support will be in the next pre-release...