This commit is contained in:
Dmitry Voronin 2023-11-30 03:54:45 +03:00
parent abe6f6cf5f
commit e1ebfb9f0c

View file

@ -37,22 +37,23 @@ ffmpeg_mux_cover()
ffmpeg_music_meta()
{
if [[ "${1}" = "" ]]; then
echo "Usage: ffmpeg_mux_cover <FORMAT> <COVER>"
echo "Usage: ffmpeg_music_meta <FORMAT>"
return 2
fi
local format="${1}"
local artist="${PWD%/*}"; artist="${artist##*/}"
local album="${PWD##*/}"; album="${album#*_}"
local artist="${PWD%/*}"; artist="${artist##*/}"; artist="${artist//_/ }"
local album="${PWD##*/}"; album="${album#*_}"; album="${album//_/ }"
local year="${PWD##*/}"; year="${year%%_*}"
mkdir out
for file in *.${format}; do
local track="${file%%_*}"
local title="${file#*_}"; title="${title%.*}"
local track="${file%%_*}"; track=$((10#${track})); [[ "${track}" = "" ]] && track=0
local title="${file#*_}"; title="${title%.*}"; title="${title//_/ }"
# echo "${artist}; ${album}; ${year}; ${track}; ${title}"
ffmpeg -i "${file}" -c copy -metadata "artist=${artist}" -metadata "album_artist=${artist}" -metadata "album=${album}" -metadata "date=${year}" -metadata "track=${track}" -metadata "title=${title}" ./out/"${file}" || return 1
done