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

Modified Files:
        Makefile.am convert-flac2m4a.sh convert-flac2mp3.sh 
        convert-ogg2m4a.sh convert-ogg2mp3.sh 
Added Files:
        convert-m4a2mp3.sh convert-mp32m4a.sh convert-wav2m4a.sh 
        convert-wav2mp3.sh 
Log Message:
        * src/details.c
          gtkpod.glade: small fixes for "Edit Details Window" by Mario Rossi.

        * gtkpod.glade
          scripts/convert-flac2m4a.sh
          scripts/convert-flac2mp3.sh
          scripts/convert-ogg2m4a.sh
          scripts/convert-ogg2mp3.sh
          scripts/Makefile.am
          src/display_itdb.h
          src/file.h
          src/file_convert.c
          src/file_convert.h
          src/file_itunesdb.c
          src/prefs_window.c
          src/prefs.c: display of conversion progress and improved
          conversion scripts (receive meta tags by command line
          arguments). Thanks to Simon Naunton!

          scripts/convert-m4a2mp3.sh
          scripts/convert-mp32m4a.sh
          scripts/convert-wav2m4a.sh
          scripts/convert-wav2mp3.sh: new scripts for mp3, m4a and wav
          conversion.



--- NEW FILE: convert-m4a2mp3.sh ---
#!/bin/sh
# Simple script that converts an mp3 file into an m4a file
#
# USAGE:
#
# convert-m4a2mp3.sh [options] m4afile
#
#       -a      Artist tag
#       -A      Album tag
#       -T      Track tag
#       -t      Title tag
#       -g      Genre tag
#       -y      Year tag
#       -c      Comment tag
#
# 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 parameters
while getopts a:A:T:t:g:c: opt ; do
        case "$opt" in
                a)      artist="$OPTARG" ;;
                A)      album="$OPTARG" ;;
                T)      track="$OPTARG" ;;
                t)      title="$OPTARG" ;;
                g)      genre="$OPTARG" ;;
                y)      year="$OPTARG" ;;
                c)      comment="$OPTARG" ;;
        esac
done
shift $(($OPTIND - 1))
m4afile="$1"

# Build output file
mp3file=`basename "$m4afile"`
mp3file=${mp3file%%.m4a}
mp3file="/tmp/$mp3file.mp3"

# Default values
[ -z "$comment"] && comment="Encoded for gtkpod with lame"

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

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

# Checking output file
touch "$mp3file"
if [ "x$?" != "x0" ]; then
    exit 2
fi

# Check for the existence of faad
faac=`which faad`
if [ -z "$faad" ]; then
    exit 4
fi

# Check for the existence of lame
lame=`which lame`
if [ -z "$lame" ]; then
    exit 5
fi

# Launch command
exec "$faad" -o - "$m4afile" | "$lame" --preset standard --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-mp32m4a.sh ---
#!/bin/sh
# Simple script that converts an mp3 file into an m4a file
#
# USAGE:
#
# convert-mp32m4a.sh [options] mp3file
#
#       -a      Artist tag
#       -A      Album tag
#       -T      Track tag
#       -t      Title tag
#       -g      Genre tag
#       -y      Year tag
#       -c      Comment tag
#
# 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 parameters
while getopts a:A:T:t:g:c: opt ; do
        case "$opt" in
                a)      artist="$OPTARG" ;;
                A)      album="$OPTARG" ;;
                T)      track="$OPTARG" ;;
                t)      title="$OPTARG" ;;
                g)      genre="$OPTARG" ;;
                y)      year="$OPTARG" ;;
                c)      comment="$OPTARG" ;;
        esac
done
shift $(($OPTIND - 1))
mp3file="$1"

# Build output file
m4afile=`basename "$mp3file"`
m4afile=${m4afile%%.mp3}
m4afile="/tmp/$m4afile.m4a"

# Default values
[ -z "$comment"] && comment="Encoded for gtkpod with faac"

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

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

# Checking output file
touch "$m4afile"
if [ "x$?" != "x0" ]; then
    exit 2
fi

# Check for the existence of lame
lame=`which lame`
if [ -z "$lame" ]; then
    exit 4
fi

# Check for the existence of faac
faac=`which faac`
if [ -z "$faac" ]; then
    exit 5
fi

# Launch command
exec "$lame" --decode "$mp3file" - | "$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

--- NEW FILE: convert-wav2m4a.sh ---
#!/bin/sh
# Simple script that converts a wav file into an m4a file
#
# USAGE:
#
# convert-wav2m4a.sh [options] wavfile
#
#       -a      Artist tag
#       -A      Album tag
#       -T      Track tag
#       -t      Title tag
#       -g      Genre tag
#       -y      Year tag
#       -c      Comment tag
#
# 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 parameters
while getopts a:A:T:t:g:c: opt ; do
        case "$opt" in
                a)      artist="$OPTARG" ;;
                A)      album="$OPTARG" ;;
                T)      track="$OPTARG" ;;
                t)      title="$OPTARG" ;;
                g)      genre="$OPTARG" ;;
                y)      year="$OPTARG" ;;
                c)      comment="$OPTARG" ;;
        esac
done
shift $(($OPTIND - 1))
wavfile="$1"

# Build output file
m4afile=`basename "$wavfile"`
m4afile=${m4afile%%.wav}
m4afile="/tmp/$m4afile.m4a"

# Default values
[ -z "$comment"] && comment="Encoded for gtkpod with faac"

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

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

# Checking output file
touch "$m4afile"
if [ "x$?" != "x0" ]; then
    exit 2
fi

# Check for the existence of faac
faac=`which faac`
if [ -z "$faac" ]; then
    exit 5
fi

# Launch command
"$faac" -o "$m4afile" -q 150 -c 22000 -w --artist "$artist" --title "$title" 
--year "$year" --album "$album" --track "$tracknum" --genre "$genre" --comment 
"$comment" "$wavfile"

# Check result
if [ "x$?" != "x0" ]; then
    exit 6
fi
# Seems to be ok: display filename for gtkpod
echo $m4afile
exit 0

--- NEW FILE: convert-wav2mp3.sh ---
#!/bin/sh
# Simple script that converts a wav file into an mp3 file
#
# USAGE:
#
# convert-wav2mp3.sh [options] wavfile
#
#       -a      Artist tag
#       -A      Album tag
#       -T      Track tag
#       -t      Title tag
#       -g      Genre tag
#       -y      Year tag
#       -c      Comment tag
#
# 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 parameters
while getopts a:A:T:t:g:c: opt ; do
        case "$opt" in
                a)      artist="$OPTARG" ;;
                A)      album="$OPTARG" ;;
                T)      track="$OPTARG" ;;
                t)      title="$OPTARG" ;;
                g)      genre="$OPTARG" ;;
                y)      year="$OPTARG" ;;
                c)      comment="$OPTARG" ;;
        esac
done
shift $(($OPTIND - 1))
wavfile="$1"

# Build output file
mp3file=`basename "$wavfile"`
mp3file=${mp3file%%.wav}
mp3file="/tmp/$mp3file.mp3"

# Default values
[ -z "$comment"] && comment="Encoded for gtkpod with lame"

#echo "Converting \"$wavfile\" into \"$mp3file\""

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

# Checking output file
touch "$mp3file"
if [ "x$?" != "x0" ]; then
    exit 2
fi

# Check for the existence of lame
lame=`which lame`
if [ -z "$lame" ]; then
    exit 5
fi

# Launch command
"$lame" --preset standard --add-id3v2 --tt "$title" --ta "$artist" --tl 
"$album" --ty "$year" --tc "$comment" --tn "$tracknum" --tg "$genre" "$wavfile" 
"$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.12
retrieving revision 1.13
diff -u -d -r1.12 -r1.13
--- Makefile.am 4 Feb 2007 12:49:51 -0000       1.12
+++ Makefile.am 5 Feb 2007 08:45:55 -0000       1.13
@@ -23,7 +23,13 @@
        convert-ogg2mp3.sh \
        convert-ogg2m4a.sh \
        convert-flac2mp3.sh \
-       convert-flac2m4a.sh
+        convert-flac2m4a.sh \
+        convert-m4a2mp3.sh \
+        convert-mp32m4a.sh \
+        convert-ogg2mp3.sh \
+        convert-ogg2m4a.sh \
+        convert-wav2mp3.sh \
+        convert-wav2m4a.sh
 
 # these scripts will of course also go in the distribution tarball.
 EXTRA_DIST=$(script_SCRIPTS)

Index: convert-flac2m4a.sh
===================================================================
RCS file: /cvsroot/gtkpod/gtkpod/scripts/convert-flac2m4a.sh,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -d -r1.1 -r1.2
--- convert-flac2m4a.sh 18 Jan 2007 16:14:09 -0000      1.1
+++ convert-flac2m4a.sh 5 Feb 2007 08:45:56 -0000       1.2
@@ -1,5 +1,18 @@
 #!/bin/sh
 # Simple script that converts a flac file into an m4a file
+#
+# USAGE:
+#
+# convert-flac2m4a.sh [options] flacfile
+#
+#      -a      Artist tag
+#      -A      Album tag
+#      -T      Track tag
+#      -t      Title tag
+#      -g      Genre tag
+#      -y      Year tag
+#      -c      Comment tag
+#
 # STDOUT's last line is the converted filename.
 # Return Codes:
 #   0 ok
@@ -10,8 +23,20 @@
 #   5 cannot exec encoding
 #   6 conversion failed
 
-# Get parameter
-flacfile=$1
+# Get parameters
+while getopts a:A:T:t:g:c: opt ; do
+       case "$opt" in
+               a)      artist="$OPTARG" ;;
+               A)      album="$OPTARG" ;;
+               T)      track="$OPTARG" ;;
+               t)      title="$OPTARG" ;;
+               g)      genre="$OPTARG" ;;
+               y)      year="$OPTARG" ;;
+               c)      comment="$OPTARG" ;;
+       esac
+done
+shift $(($OPTIND - 1))
+flacfile="$1"
 
 # Build output file
 m4afile=`basename "$flacfile"`
@@ -19,7 +44,7 @@
 m4afile="/tmp/$m4afile.m4a"
 
 # Default values
-comment="Encoded for gtkpod with faac"
+[ -z "$comment"] && comment="Encoded for gtkpod with faac"
 
 #echo "Converting \"$flacfile\" into \"$m4afile\""
 
@@ -37,24 +62,21 @@
     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
+# Check for the existence of flac
+flac=`which flac`
+if [ -z "$flac" ]; then
+    exit 4
 fi
-if [ "$comment_a" != "" ]; then
-    comment="$comment_a $comment"
+
+# Check for the existence of faac
+faac=`which faac`
+if [ -z "$faac" ]; then
+    exit 5
 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" -
+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

Index: convert-flac2mp3.sh
===================================================================
RCS file: /cvsroot/gtkpod/gtkpod/scripts/convert-flac2mp3.sh,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -d -r1.4 -r1.5
--- convert-flac2mp3.sh 24 Jan 2007 14:13:33 -0000      1.4
+++ convert-flac2mp3.sh 5 Feb 2007 08:45:56 -0000       1.5
@@ -1,17 +1,42 @@
 #!/bin/sh
-# Simple script that converts an ogg file into an mp3 file
+# Simple script that converts a flac file into an mp3 file
+#
+# USAGE:
+#
+# convert-flac2mp3.sh [options] flacfile
+#
+#      -a      Artist tag
+#      -A      Album tag
+#      -T      Track tag
+#      -t      Title tag
+#      -g      Genre tag
+#      -y      Year tag
+#      -c      Comment tag
+#
 # STDOUT's last line is the converted filename.
 # Return Codes:
 #   0 ok
 #   1 input file not found
-#   2 output file cannot be created 
+#   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
+# Get parameters
+while getopts a:A:T:t:g:c: opt ; do
+       case "$opt" in
+               a)      artist="$OPTARG" ;;
+               A)      album="$OPTARG" ;;
+               T)      track="$OPTARG" ;;
+               t)      title="$OPTARG" ;;
+               g)      genre="$OPTARG" ;;
+               y)      year="$OPTARG" ;;
+               c)      comment="$OPTARG" ;;
+       esac
+done
+shift $(($OPTIND - 1))
+flacfile="$1"
 
 # Build output file
 mp3file=`basename "$flacfile"`
@@ -19,12 +44,12 @@
 mp3file="/tmp/$mp3file.mp3"
 
 # Default values
-comment="Encoded for gtkpod with lame"
+[ -z "$comment"] && comment="Encoded for gtkpod with lame"
 
 #echo "Converting \"$flacfile\" into \"$mp3file\""
 
 # Checking input file
-if [ "$flacfile" = "" ]; then 
+if [ "$flacfile" = "" ]; then
     exit 1
 fi
 if [ ! -f "$flacfile" ]; then
@@ -37,29 +62,21 @@
     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
+# Check for the existence of flac
+flac=`which flac`
+if [ -z "$flac" ]; then
+    exit 4
 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
+# Check for the existence of lame
+lame=`which lame`
+if [ -z "$lame" ]; then
+    exit 5
 fi
 
 # Launch command
-exec flac -d -c -- "$flacfile" | lame --preset standard --add-id3v2 --tt 
"$title" --ta "$artist" --tl "$album" --ty "$year" --tc "$comment" --tn 
"$tracknum" --tg "$genre" - "$mp3file"
+exec "$flac" -d -c -- "$flacfile" | "$lame" --preset standard --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

Index: convert-ogg2m4a.sh
===================================================================
RCS file: /cvsroot/gtkpod/gtkpod/scripts/convert-ogg2m4a.sh,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -d -r1.1 -r1.2
--- convert-ogg2m4a.sh  24 Jan 2007 14:27:06 -0000      1.1
+++ convert-ogg2m4a.sh  5 Feb 2007 08:45:56 -0000       1.2
@@ -1,5 +1,18 @@
 #!/bin/sh
-# Simple script that converts an ogg file into an m4a file
+# Simple script that converts a ogg file into an m4a file
+#
+# USAGE:
+#
+# convert-ogg2m4a.sh [options] oggfile
+#
+#      -a      Artist tag
+#      -A      Album tag
+#      -T      Track tag
+#      -t      Title tag
+#      -g      Genre tag
+#      -y      Year tag
+#      -c      Comment tag
+#
 # STDOUT's last line is the converted filename.
 # Return Codes:
 #   0 ok
@@ -10,8 +23,20 @@
 #   5 cannot exec encoding
 #   6 conversion failed
 
-# Get parameter
-oggfile=$1
+# Get parameters
+while getopts a:A:T:t:g:c: opt ; do
+       case "$opt" in
+               a)      artist="$OPTARG" ;;
+               A)      album="$OPTARG" ;;
+               T)      track="$OPTARG" ;;
+               t)      title="$OPTARG" ;;
+               g)      genre="$OPTARG" ;;
+               y)      year="$OPTARG" ;;
+               c)      comment="$OPTARG" ;;
+       esac
+done
+shift $(($OPTIND - 1))
+oggfile="$1"
 
 # Build output file
 m4afile=`basename "$oggfile"`
@@ -19,7 +44,7 @@
 m4afile="/tmp/$m4afile.m4a"
 
 # Default values
-comment="Encoded for gtkpod with faac"
+[ -z "$comment"] && comment="Encoded for gtkpod with faac"
 
 #echo "Converting \"$oggfile\" into \"$m4afile\""
 
@@ -37,24 +62,21 @@
     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`
-comment_a=`ogginfo $oggfile | grep albumcomment= | cut -d = -f 2`
-if [ "$comment_t" != "" ]; then
-    comment=$comment_t
+# Check for the existence of oggdec
+oggdec=`which oggdec`
+if [ -z "$oggdec" ]; then
+    exit 4
 fi
-if [ "$comment_a" != "" ]; then
-    comment="$comment_a $comment"
+
+# Check for the existence of faac
+faac=`which faac`
+if [ -z "$faac" ]; then
+    exit 5
 fi
 
 # Launch command
-exec oggdec --output - -- "$oggfile" | faac -o "$m4afile" -q 150 -c 22000 -w 
--artist "$artist" --title "$title" --year "$year" --album "$album" --track 
"$tracknum" --genre "$genre" --comment "$comment" -
+exec "$oggdec" --output - -- "$oggfile" | "$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

Index: convert-ogg2mp3.sh
===================================================================
RCS file: /cvsroot/gtkpod/gtkpod/scripts/convert-ogg2mp3.sh,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -d -r1.4 -r1.5
--- convert-ogg2mp3.sh  24 Jan 2007 14:24:52 -0000      1.4
+++ convert-ogg2mp3.sh  5 Feb 2007 08:45:56 -0000       1.5
@@ -1,66 +1,82 @@
 #!/bin/sh
-# Simple script that converts an ogg file into an mp3 file
+# Simple script that converts a ogg file into an mp3 file
+#
+# USAGE:
+#
+# convert-ogg2mp3.sh [options] oggfile
+#
+#      -a      Artist tag
+#      -A      Album tag
+#      -T      Track tag
+#      -t      Title tag
+#      -g      Genre tag
+#      -y      Year tag
+#      -c      Comment tag
+#
 # STDOUT's last line is the converted filename.
 # Return Codes:
 #   0 ok
 #   1 input file not found
-#   2 output file cannot be created 
+#   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
+# Get parameters
+while getopts a:A:T:t:g:c: opt ; do
+       case "$opt" in
+               a)      artist="$OPTARG" ;;
+               A)      album="$OPTARG" ;;
+               T)      track="$OPTARG" ;;
+               t)      title="$OPTARG" ;;
+               g)      genre="$OPTARG" ;;
+               y)      year="$OPTARG" ;;
+               c)      comment="$OPTARG" ;;
+       esac
+done
+shift $(($OPTIND - 1))
+oggfile="$1"
+
 # Build output file
-mp3file=`basename $oggfile`
+mp3file=`basename "$oggfile"`
 mp3file=${mp3file%%.ogg}
 mp3file="/tmp/$mp3file.mp3"
 
 # Default values
-comment="Encoded for gtkpod with lame"
+[ -z "$comment"] && comment="Encoded for gtkpod with lame"
 
 #echo "Converting \"$oggfile\" into \"$mp3file\""
 
 # Checking input file
-if [ "$oggfile" = "" ]; then 
+if [ "$oggfile" = "" ]; then
     exit 1
 fi
-if [ ! -f $oggfile ]; then
+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`
-comment_a=`ogginfo $oggfile | grep albumcomment= | cut -d = -f 2`
-if [ "$comment_t" != "" ]; then
-    comment=$comment_t
-fi
-if [ "$comment_a" != "" ]; then
-    comment="$comment_a $comment"
+
+# Check for the existence of oggdec
+oggdec=`which oggdec`
+if [ -z "$oggdec" ]; then
+    exit 4
 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
+# Check for the existence of lame
+lame=`which lame`
+if [ -z "$lame" ]; then
+    exit 5
 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" --tg "$genre" - "$mp3file"
+
 # Check result
 if [ "x$?" != "x0" ]; then
     exit 6


-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier.
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
gtkpod-cvs2 mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/gtkpod-cvs2

Reply via email to