mirror of
https://github.com/KrumpetPirate/AAXtoMP3.git
synced 2024-11-18 03:08:57 +01:00
Applied flattening function to chapters in chaptered mode as well as single mode, to avoid issues with nested chapter structures in books.
This commit is contained in:
parent
1a45f94f3c
commit
f91008db62
6
AAXtoMP3
6
AAXtoMP3
@ -537,8 +537,10 @@ save_metadata() {
|
||||
# put a ',' after the start value, we calculate the end of each chapter
|
||||
# as start+length, and we convert (divide) the time stamps from ms to s.
|
||||
# Then we delete all ':' and '/' since they make a filename invalid.
|
||||
jq -r '.content_metadata.chapter_info.chapters[] | "Chapter # start: \(.start_offset_ms/1000), end: \((.start_offset_ms+.length_ms)/1000) \n#\n# Title: \(.title)"' "${extra_chapter_file}" \
|
||||
| $SED 's@[:/]@@g' >> "$metadata_file"
|
||||
jq -r '.content_metadata.chapter_info.chapters | reduce .[] as $c ([]; if $c.chapters? then .+[$c |
|
||||
del(.chapters)]+[$c.chapters] else .+[$c] end) | flatten | .[] |
|
||||
"Chapter # start: \(.start_offset_ms/1000), end: \((.start_offset_ms+.length_ms)/1000) \n#\n# Title: \(.title)"' \
|
||||
"${extra_chapter_file}" | $SED 's@[:/]@@g' >> "$metadata_file"
|
||||
# In case we want to use a single file m4b we need to extract the
|
||||
# chapter titles from the .json generated by audible–cli and store
|
||||
# them correctly formatted for mp4chaps in a chapter.txt
|
||||
|
Loading…
Reference in New Issue
Block a user