Update metadata: track number = chapternum, appended chapter number to track title

track number was eg "Chapter 03", and is now eg 3 . This fits better in most mp3 players.
track title was the book title for all tracks, now it is eg "Book Title - 01 Chapter 1" (same as filename)
This commit is contained in:
Dirk Loeckx 2017-10-22 22:54:10 +02:00
parent 1ac66d1a94
commit 972123a932

View File

@ -98,9 +98,11 @@ do
then then
read -r -u9 _ read -r -u9 _
read -r -u9 _ _ chapter read -r -u9 _ _ chapter
chapter_file="${output_directory}/${title} - $(printf %0${#chaptercount}d $chapternum) ${chapter}.${extension}" chapter_title="${title} - $(printf %0${#chaptercount}d $chapternum) ${chapter}"
chapter_file="${output_directory}/${chapter_title}.${extension}"
</dev/null ffmpeg -loglevel error -stats -i "${full_file_path}" -i "${cover_path}" -ss "${start%?}" -to "${end}" -c copy -map 0:0 -map 1:0 -id3v2_version 3 \ </dev/null ffmpeg -loglevel error -stats -i "${full_file_path}" -i "${cover_path}" -ss "${start%?}" -to "${end}" -c copy -map 0:0 -map 1:0 -id3v2_version 3 \
-metadata:s:v title="Album cover" -metadata:s:v comment="Cover (Front)" -metadata track="${chapter}" "${chapter_file}" -metadata:s:v title="Album cover" -metadata:s:v comment="Cover (Front)" -metadata track="${chapternum}" -metadata title="${chapter_title}" \
"${chapter_file}"
chapternum=$((chapternum + 1 )) chapternum=$((chapternum + 1 ))
fi fi
done 9< "$metadata_file" done 9< "$metadata_file"