Commit 42f8afe3 authored by Cédric Marie's avatar Cédric Marie

tag-sieve: Add support for comment in MP3 files

When cleaning MP3 files, don't ignore the "comment" tag if it is
present (like with FLAC files).
Signed-off-by: default avatarCédric Marie <cedric@hjuvi.lautre.net>
parent eabdc505
......@@ -3,7 +3,7 @@
# tag-sieve - Clean audio tags
# This file is part of Painted Shell - Shell configuration and scripts.
#
# Written in 2014-2017 by Cédric Marie
# Written in 2014-2018 by Cédric Marie
#
# To the extent possible under law, the author(s) have dedicated all copyright
# and related and neighboring rights to this software to the public domain
......@@ -296,12 +296,17 @@ if [ "$command" = "clean" ]; then
if [ "${file%%.*}" = "1" ]; then
multi_disc=1
fi
tag_comment=`grep "^COMM " $tags_filename | tail -n 1`
tag_comment=${tag_comment#*: *: }
# Print album information
printf "\033[7m"
printf "ARTIST=$tag_artist\n"
printf "ALBUM=$tag_album\n"
printf "DATE=$tag_date\n"
if [ "$tag_comment" != "" ]; then
printf "COMMENT=$tag_comment\n"
fi
printf "\033[0m"
confirm_to_continue
......@@ -335,6 +340,9 @@ if [ "$command" = "clean" ]; then
if [ "$multi_disc" = "1" ]; then
id3v2 --id3v2-only --TPOS "$tag_discnumber" "$file"
fi
if [ "$tag_comment" != "" ]; then
id3v2 --id3v2-only --comment "$tag_comment" "$file"
fi
new_size=`stat -c %s "$file"`
printf "(saved %4d bytes) $file\n" $(($old_size - $new_size))
done
......@@ -423,6 +431,8 @@ if [ "$command" = "clean-single" ]; then
tag_title=${tag_title#*: }
tag_date=`grep "^TYER " $tags_filename`
tag_date=${tag_date#*: }
tag_comment=`grep "^COMM " $tags_filename | tail -n 1`
tag_comment=${tag_comment#*: *: }
print_header "Set tags in this file"
......@@ -435,6 +445,9 @@ if [ "$command" = "clean-single" ]; then
id3v2 --id3v2-only --artist "$tag_artist" "$file"
id3v2 --id3v2-only --song "$tag_title" "$file"
id3v2 --id3v2-only --year "$tag_date" "$file"
if [ "$tag_comment" != "" ]; then
id3v2 --id3v2-only --comment "$tag_comment" "$file"
fi
new_size=`stat -c %s "$file"`
printf "(saved %4d bytes) $file\n" $(($old_size - $new_size))
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment