Learn about Linux
Download Linux
Get Linux help
Get special offers on:
Linux Application Dev Programming Software
Email:
#
Return to How to script songs lyrics retrieval
© Copyright 1999-2008 - SourceForge, Inc., All Rights Reserved About Linux.com - Privacy Statement - Terms of Use - Advertise - Trademark - Ask Linux Questions - Write for Us - RSS Feed ThinkGeek - Slashdot - SourceForge.net - freshmeat - Surveys - Jobs
good article!
Posted by: Anonymous Coward on April 09, 2007 02:20 AMI guess some people would like to add the lyrics to the id3v2 tag of the file (at least i do)
So i changed you're script a little. Don't know if it works for everyone but it works for me at least<nobr> <wbr></nobr>:)
if [ ! -f "$1.txt" ]; then
echo $lyrics_results | xmlstarlet sel -t -v "/leoslyrics/lyric/text/text()" | xmlstarlet unesc > "$1.txt"
exec put_lyrics.py "$1" "$1.txt"
fi
put_lyrics.py:
#!/usr/bin/env python
import sys
import codecs
from mutagen.id3 import ID3, USLT,TALB
audio = ID3(sys.argv[1])
lyrics = codecs.open(sys.argv[2],'r','utf8').read()
audio<nobr>.<wbr></nobr> update_to_v24()
audio.add(USLT(encoding=3, desc="tagged by python", lang="und", text=lyrics))
audio.save()
You have to have the mutagen module installed though.
Hope it can be of help to anyone.</tt>
#