Use python-mutagen (mid3v2) or id3v2 instead of mp3info to tag (Debian: #676478)

This avoids truncating long titles/albums/etc.

Author: Felipe Sateler <fsateler@debian.org>
Reviewed-By: Dmitry Smirnov <onlyjob@member.fsf.org>
Thanks-To: Rogério Brito.
Bug-Debian: http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=676478

 * Look for `mid3v2` first and fallback to `id3v2` according to their availability.
 * Added error message if neither of them found.
This commit is contained in:
Dmitry Smirnov
2013-07-05 15:35:16 +10:00
parent 521b7552de
commit eb9bd4ff6c

View File

@@ -93,7 +93,12 @@ vorbis()
id3() id3()
{ {
MP3INFO=mp3info MP3TAG=$(which mid3v2) \
|| MP3TAG=$(which id3v2)
if [ -z "${MP3TAG}" ]; then
echo "error: not found '(m)id3v2'."
exit 1
fi
# space seperated list of ID3 v1.1 tags # space seperated list of ID3 v1.1 tags
# see http://id3lib.sourceforge.net/id3/idev1.html # see http://id3lib.sourceforge.net/id3/idev1.html
@@ -124,25 +129,25 @@ id3()
if [ -n "$value" ]; then if [ -n "$value" ]; then
case $field in case $field in
TITLE) TITLE)
$MP3INFO -t "$value" "$2" $MP3TAG -t "$value" "$2"
;; ;;
ALBUM) ALBUM)
$MP3INFO -l "$value" "$2" $MP3TAG -A "$value" "$2"
;; ;;
ARTIST) ARTIST)
$MP3INFO -a "$value" "$2" $MP3TAG -a "$value" "$2"
;; ;;
YEAR) YEAR)
$MP3INFO -y "$value" "$2" $MP3TAG -y "$value" "$2"
;; ;;
COMMENT) COMMENT)
$MP3INFO -c "$value" "$2" $MP3TAG -c "$value" "$2"
;; ;;
GENRE) GENRE)
$MP3INFO -g "$value" "$2" $MP3TAG -g "$value" "$2"
;; ;;
TRACKNUMBER) TRACKNUMBER)
$MP3INFO -n "$value" "$2" $MP3TAG -T "$value" "$2"
;; ;;
esac esac
fi fi