Update of /cvsroot/gtkpod/gtkpod/scripts
In directory sc8-pr-cvs2.sourceforge.net:/tmp/cvs-serv11047/scripts

Modified Files:
        convert-ogg2mp3.sh 
Log Message:
Try to use id3v2 as a fallback for setting genres that lame doesn't handle

Index: convert-ogg2mp3.sh
===================================================================
RCS file: /cvsroot/gtkpod/gtkpod/scripts/convert-ogg2mp3.sh,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -d -r1.6 -r1.7
--- convert-ogg2mp3.sh  6 Feb 2007 12:46:57 -0000       1.6
+++ convert-ogg2mp3.sh  10 Apr 2007 20:09:32 -0000      1.7
@@ -74,8 +74,25 @@
     exit 5
 fi
 
+# Check if the genre is one which lame supports
+if [ -n "$genre" ] && `$lame --genre-list | grep -qi "\b$genre\b"`; then
+    genreopt="--tg \"$genre\""
+else
+    # check for id3v2
+    id3v2=`which id3v2`
+    if [ -n "$id3v2" ]; then
+        useid3v2=1
+    fi
+fi
+
 # Launch command
-exec "$oggdec" --output - -- "$oggfile" | "$lame" --preset standard 
--add-id3v2 --tt "$title" --ta "$artist" --tl "$album" --ty "$year" --tc 
"$comment" --tn "$tracknum" --tg "$genre" - "$mp3file"
+exec "$oggdec" --output - -- "$oggfile" | "$lame" --preset standard 
--add-id3v2 --tt "$title" --ta "$artist" --tl "$album" --ty "$year" --tc 
"$comment" --tn "$tracknum" $genreopt - "$mp3file"
+
+# Try to set the genre with id3v2 if needed.  This may fail as older versions 
of
+# id3v2 did not support genre strings in place of numberic genre id's
+if [ -n "$useid3v2" ]; then
+    $id3v2 -g "$genre" "$mp3file" || :
+fi
 
 # Check result
 if [ "x$?" != "x0" ]; then


-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys-and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
gtkpod-cvs2 mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/gtkpod-cvs2

Reply via email to