Update of /cvsroot/gtkpod/gtkpod/scripts
In directory sc8-pr-cvs2.sourceforge.net:/tmp/cvs-serv30358/scripts
Modified Files:
Makefile.am
Added Files:
convert-flac2mp3.sh convert-ogg2mp3.sh
Log Message:
* scripts/convert-flac2mp3.sh
scripts/convert-ogg2mp3.sh
src/file_convert.[ch]
src/flacfile.[ch]
src/oggfile.[ch]: new files for patch mentioned below
configure.in
gtkpod.glade
scripts/Makefile.am
src/Makefile.am
src/display_itdb.h
src/display_tracks.c
src/file.c
src/file.h
src/file_itunesdb.c
src/misc.c
src/misc.h
src/misc_conversion.c
src/misc_track.c
src/prefs.c
src/prefs_window.c
src/repository.c
src/syncdir.c
src/tools.c: combined patch by Marc d[r]eadlock and Simon
Naunton for on-the fly conversion of FLAC and OGG files
during export to the iPod, plus some patches thrown in by
myself. Thanks for the contribution!
--- NEW FILE: convert-flac2mp3.sh ---
#!/bin/sh
# Simple script that converts an ogg file into an mp3 file
# STDOUT's last line is the converted filename.
# Return Codes:
# 0 ok
# 1 input file not found
# 2 output file cannot be created
# 3 cannot get info
# 4 cannot exec decoding
# 5 cannot exec encoding
# 6 conversion failed
# Get parameter
flacfile=$1
# Build output file
mp3file=`basename "$flacfile"`
mp3file=${mp3file%%.flac}
mp3file="/tmp/$mp3file.mp3"
# Default values
comment="Encoded for gtkpod with lame"
#echo "Converting \"$flacfile\" into \"$mp3file\""
# Checking input file
if [ "$flacfile" == "" ]; then
exit 1
fi
if [ ! -f "$flacfile" ]; then
exit 1
fi
# Checking output file
touch $mp3file
if [ "x$?" != "x0" ]; then
exit 2
fi
# Getting flac info
album=`metaflac --show-tag=album "$1" | cut -d \= -f 2`
title=`metaflac --show-tag=title "$1" | cut -d \= -f 2`
artist=`metaflac --show-tag=artist "$1" | cut -d \= -f 2`
year=`metaflac --show-tag=date "$1" | cut -d \= -f 2`
genre=`metaflac --show-tag=genre "$1" | cut -d \= -f 2`
tracknum=`metaflac --show-tag=tracknumber "$1" | cut -d \= -f 2`
comment_t=`metaflac --show-tag=comment "$1" | cut -d \= -f 2`
if [ "$comment_t" != "" ]; then
comment=$comment_t
fi
#Fix unrecognised genre for lame
if [ "$genre" != "" ]; then
check_genre=`lame --genre-list | cut -c5- | grep -i $genre`
if [ "x$?" != "x0" ]; then
echo "WARNING: Unrecognised genre \"$genre\". Genre cleaned."
genre=""
fi
fi
# Launch command
exec flac -d -c "$flacfile" | lame -h --add-id3v2 --tt "$title" --ta "$artist"
--tl "$album" --ty "$year" --tc "$comment" --tn "$tracknum" --tg "$genre" -
"$mp3file"
# Check result
if [ "x$?" != "x0" ]; then
exit 6
fi
# Seems to be ok: display filename for gtkpod
echo $mp3file
exit 0
--- NEW FILE: convert-ogg2mp3.sh ---
#!/bin/sh
# Simple script that converts an ogg file into an mp3 file
# STDOUT's last line is the converted filename.
# Return Codes:
# 0 ok
# 1 input file not found
# 2 output file cannot be created
# 3 cannot get info
# 4 cannot exec decoding
# 5 cannot exec encoding
# 6 conversion failed
# Get parameter
oggfile=$1
# Build output file
mp3file=`basename $oggfile`
mp3file="/tmp/$mp3file.mp3"
# Default values
comment="Encoded for gtkpod with lame"
#echo "Converting \"$oggfile\" into \"$mp3file\""
# Checking input file
if [ "$oggfile" == "" ]; then
exit 1
fi
if [ ! -f $oggfile ]; then
exit 1
fi
# Checking output file
touch $mp3file
if [ "x$?" != "x0" ]; then
exit 2
fi
# Getting ogg info
album=`ogginfo $oggfile | grep album= | cut -d = -f 2`
title=`ogginfo $oggfile | grep title= | cut -d = -f 2`
artist=`ogginfo $oggfile | grep artist= | cut -d = -f 2`
year=`ogginfo $oggfile | grep date= | cut -d = -f 2`
genre=`ogginfo $oggfile | grep genre= | cut -d = -f 2`
tracknum=`ogginfo $oggfile | grep tracknumber= | cut -d = -f 2`
comment_t=`ogginfo $oggfile | grep comment= | cut -d = -f 2`
if [ "$comment_t" != "" ]; then
comment=$comment_t
fi
#Fix unrecognised genre for lame
if [ "$genre" != "" ]; then
check_genre=`lame --genre-list | cut -c5- | grep -i $genre`
if [ "x$?" != "x0" ]; then
echo "WARNING: Unrecognised genre \"$genre\". Genre cleaned."
genre=""
fi
fi
# Launch command
exec oggdec "$oggfile" --output - | lame -h --add-id3v2 --tt "$title" --ta
"$artist" --tl "$album" --ty "$year" --tc "$comment" --tn "$tracknum" --tg
"$genre" - "$mp3file"
# Check result
if [ "x$?" != "x0" ]; then
exit 6
fi
# Seems to be ok: display filename for gtkpod
echo $mp3file
exit 0
Index: Makefile.am
===================================================================
RCS file: /cvsroot/gtkpod/gtkpod/scripts/Makefile.am,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -d -r1.9 -r1.10
--- Makefile.am 27 Apr 2006 14:53:05 -0000 1.9
+++ Makefile.am 16 Jan 2007 09:44:58 -0000 1.10
@@ -19,7 +19,9 @@
sync-tomboy.sh \
sync-webcalendar.sh \
ldif2vcf.sh \
- mab2vcard
+ mab2vcard \
+ convert-ogg2mp3.sh \
+ convert-flac2mp3.sh
# these scripts will go in the distribution. Actually, if they are to
# be installed, they should go into the .tar.gz-file automatically...
-------------------------------------------------------------------------
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