Re: Cannot create MP3 with UTF-16LE tags

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 05/25/2012 11:32 PM, Ian Pilcher wrote:
> My script for creating MP3 files from FLAC files has broken in Fedora
> 17.  Specifically, tags with accented characters are getting truncated
> when I try to write them as UTF-16LE (which seems to be what most
> players expect).  The script, which I am attaching, worked fine when I
> last used it in January back in January (presumably on Fedora 16).

New, working script attached for posterity.

-- 
========================================================================
Ian Pilcher                                         arequipeno@xxxxxxxxx
"If you're going to shift my paradigm ... at least buy me dinner first."
========================================================================
#!/bin/bash

FLAC_FILE="$1"
MP3_FILE="$2"

ABSOLUTE_FLAC_FILE=`readlink -m "$FLAC_FILE"`
ART_FILE="${ABSOLUTE_FLAC_FILE%/*}/front.jpg"

TITLE=`metaflac --show-tag=title "$FLAC_FILE" | sed 's/^title=//'`
ARTIST=`metaflac --show-tag=artist "$FLAC_FILE" | sed 's/^artist=//'`
GENRE=`metaflac --show-tag=genre "$FLAC_FILE" | sed 's/^genre=//'`
ALBUM=`metaflac --show-tag=album "$FLAC_FILE" | sed 's/^album=//'`
TRACKNUMBER=`metaflac --show-tag=tracknumber "$FLAC_FILE" | sed 's/^tracknumber=//'`

# It doesn't seem to be possible to store UTF-16 strings in Bash variables, and LAME doesn't seem
# to be able to handle UTF-16 tags at all anymore.  :-(

if [ -f "$ART_FILE" ]; then
    flac -dc "$FLAC_FILE" | lame -V0 --ti "$ART_FILE" - "$MP3_FILE"
else
    flac -dc "$FLAC_FILE" | lame -V0 - "$MP3_FILE"
fi

id3v2 -t "`echo $TITLE | iconv -f UTF-8 -t UTF-16LE`" \
	-a "`echo $ARTIST | iconv -f UTF-8 -t UTF-16LE`" \
	-g "`echo $GENRE | iconv -f UTF-8 -t UTF-16LE`" \
	-A "`echo $ALBUM | iconv -f UTF-8 -t UTF-16LE`" \
	-T "$TRACKNUMBER" "$MP3_FILE"
id3v2 -s "$MP3_FILE"
-- 
users mailing list
users@xxxxxxxxxxxxxxxxxxxxxxx
To unsubscribe or change subscription options:
https://admin.fedoraproject.org/mailman/listinfo/users
Guidelines: http://fedoraproject.org/wiki/Mailing_list_guidelines
Have a question? Ask away: http://ask.fedoraproject.org
[Index of Archives]     [Older Fedora Users]     [Fedora Announce]     [Fedora Package Announce]     [EPEL Announce]     [EPEL Devel]     [Fedora Magazine]     [Fedora Summer Coding]     [Fedora Laptop]     [Fedora Cloud]     [Fedora Advisory Board]     [Fedora Education]     [Fedora Security]     [Fedora Scitech]     [Fedora Robotics]     [Fedora Infrastructure]     [Fedora Websites]     [Anaconda Devel]     [Fedora Devel Java]     [Fedora Desktop]     [Fedora Fonts]     [Fedora Marketing]     [Fedora Management Tools]     [Fedora Mentors]     [Fedora Package Review]     [Fedora R Devel]     [Fedora PHP Devel]     [Kickstart]     [Fedora Music]     [Fedora Packaging]     [Fedora SELinux]     [Fedora Legal]     [Fedora Kernel]     [Fedora OCaml]     [Coolkey]     [Virtualization Tools]     [ET Management Tools]     [Yum Users]     [Yosemite News]     [Gnome Users]     [KDE Users]     [Fedora Art]     [Fedora Docs]     [Fedora Sparc]     [Libvirt Users]     [Fedora ARM]

  Powered by Linux