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

Modified Files:
        Makefile.am 
Added Files:
        convert-flac2m4a.sh 
Log Message:
        * scripts/convert-flac2m4a.sh: thanks to Peter Edwards.



--- NEW FILE: convert-flac2m4a.sh ---
#!/bin/sh
# Simple script that converts a flac file into an m4a 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
m4afile=`basename "$flacfile"`
m4afile=${m4afile%%.flac}
m4afile="/tmp/$m4afile.m4a"

# Default values
comment="Encoded for gtkpod with faac"

#echo "Converting \"$flacfile\" into \"$m4afile\""

# Checking input file
if [ "$flacfile" = "" ]; then
    exit 1
fi
if [ ! -f "$flacfile" ]; then
    exit 1
fi

# Checking output file
touch "$m4afile"
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`
comment_a=`metaflac --show-tag=albumcomment "$1" | cut -d \= -f 2`
if [ "$comment_t" != "" ]; then
    comment=$comment_t
fi
if [ "$comment_a" != "" ]; then
    comment="$comment_a $comment"
fi

# Launch command
exec flac -d -c -- "$flacfile" | faac -o "$m4afile" -q 150 -c 22000 -w --artist 
"$artist" --title "$title" --year "$year" --album "$album" --track "$tracknum" 
--genre "$genre" --comment "$comment" -
# Check result
if [ "x$?" != "x0" ]; then
    exit 6
fi
# Seems to be ok: display filename for gtkpod
echo $m4afile
exit 0

Index: Makefile.am
===================================================================
RCS file: /cvsroot/gtkpod/gtkpod/scripts/Makefile.am,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -d -r1.10 -r1.11
--- Makefile.am 16 Jan 2007 09:44:58 -0000      1.10
+++ Makefile.am 18 Jan 2007 16:14:09 -0000      1.11
@@ -21,8 +21,8 @@
        ldif2vcf.sh \
        mab2vcard \
        convert-ogg2mp3.sh \
-       convert-flac2mp3.sh
+       convert-flac2mp3.sh \
+       convert-flac2m4a.sh
 
-# these scripts will go in the distribution. Actually, if they are to
-# be installed, they should go into the .tar.gz-file automatically...
+# these scripts will of course also go in the distribution tarball.
 EXTRA_DIST=$(script_SCRIPTS)


-------------------------------------------------------------------------
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