File: convert-2m4a.sh

package info (click to toggle)
gtkpod 2.1.5-10
  • links: PTS
  • area: main
  • in suites: bookworm
  • size: 19,424 kB
  • sloc: ansic: 51,604; xml: 16,135; sh: 11,916; cpp: 7,545; perl: 1,449; makefile: 1,380; lex: 638; awk: 73; python: 35
file content (44 lines) | stat: -rwxr-xr-x 1,276 bytes parent folder | download | duplicates (6)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
#!/bin/sh
# Script that converts a file into an m4a file
#
# USAGE:
#
# convert-2m4a.sh [options] inputfile
#
# For a list of allowed options please consult gtkpod-convert-common.sh
#
# 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
#   7 unknown option
#

# Constants
extension="m4a"
ENCODER_OPTS="-q 150 -c 22000"
# use the following for better quality (25% increase in file size) or simply
# specify your options with "-q ..."
#ENCODER_OPTS="-q 256 -c 44100"
ENCODER="faac"

. ${0%/*}/gtkpod-convert-common.sh

if [ $filetype = "wav" ]; then
    "$encoder" -o "$outfile" $ENCODER_OPTS -w --artist "$artist" --title "$title" --year "$year" --album "$album" --track "$track" --genre "$genre" --comment "$comment" "$infile" >> "$LOG" 2>&1
else
    "$decoder" $options "$infile" | "$encoder" -o "$outfile" $ENCODER_OPTS -w --artist "$artist" --title "$title" --year "$year" --album "$album" --track "$track" --genre "$genre" --comment "$comment" - >> "$LOG" 2>&1
fi
# Check result
if [ "x$?" != "x0" ]; then
    exit 6
fi

# Seems to be ok: display filename for gtkpod
echo $outfile
exit 0