Merge pull request #38 from dloeckx/master

Add cover art + improve track metadata
This commit is contained in:
KrumpetPirate 2017-10-22 21:40:38 -05:00 committed by GitHub
commit de01589b94

View File

@ -83,6 +83,10 @@ do
debug "Created ${full_file_path}." debug "Created ${full_file_path}."
cover_path="${output_directory}/cover.jpg"
debug "Extracting cover into ${cover_path}..."
</dev/null ffmpeg -loglevel error -activation_bytes "${auth_code}" -i "${path}" -an -codec:v copy "${cover_path}"
if [ "${mode}" == "chaptered" ]; then if [ "${mode}" == "chaptered" ]; then
chaptercount=$($GREP -Pc "Chapter.*start.*end" $metadata_file) chaptercount=$($GREP -Pc "Chapter.*start.*end" $metadata_file)
debug "Extracting ${chaptercount} chapter files from ${full_file_path}..." debug "Extracting ${chaptercount} chapter files from ${full_file_path}..."
@ -94,8 +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}"
</dev/null ffmpeg -loglevel error -stats -i "${full_file_path}" -ss "${start%?}" -to "${end}" -codec:a copy -metadata track="${chapter}" "${chapter_file}" 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 \
-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"
@ -103,9 +110,6 @@ do
debug "Done creating chapters. Chaptered files contained in ${output_directory}." debug "Done creating chapters. Chaptered files contained in ${output_directory}."
fi fi
cover_path="${output_directory}/cover.jpg"
debug "Extracting cover into ${cover_path}..."
</dev/null ffmpeg -loglevel error -activation_bytes "${auth_code}" -i "${path}" -an -codec:v copy "${cover_path}"
debug "Done." debug "Done."
rm "${metadata_file}" rm "${metadata_file}"
done done