config parser, setup for ascii-only

This commit is contained in:
Vincent Riquer 2013-10-09 00:52:36 +02:00
parent 94c149e184
commit e16b8ff4a9
6 changed files with 59 additions and 1 deletions

1
atom
View File

@ -13,6 +13,7 @@ EFMTINVPARM=49
# config structures # config structures
declare -A \ declare -A \
destinationascii \
destinationchannels \ destinationchannels \
destinationfat32compat \ destinationfat32compat \
destinationcopymime \ destinationcopymime \

View File

@ -154,6 +154,22 @@ getConfigDestination() {
;; ;;
esac esac
;; ;;
'ascii-only')
case $value in
'true'|'on'|'yes')
destinationascii["$destination"]=1
textunidecodeneeded=1
;;
'false'|'off'|'no')
destinationascii["$destination"]=0
;;
*)
echo "ascii-only takes values:" \
"'yes' ,'true' ,'on', 'no', 'false',"\
"'off'"
;;
esac
;;
'skip_mime-type') 'skip_mime-type')
destinationskipmime[$destination]="${destinationskipmime[$destination]:+${destinationskipmime[$destination]}|}$value" destinationskipmime[$destination]="${destinationskipmime[$destination]:+${destinationskipmime[$destination]}|}$value"
;; ;;

View File

@ -42,6 +42,7 @@ printConfig() {
|Frequency|${destinationfrequency["$destination"]} |Frequency|${destinationfrequency["$destination"]}
|Higher than|${destinationmaxbps["$destination"]} |Higher than|${destinationmaxbps["$destination"]}
|Fat32 Compat.|${destinationfat32compat["$destination"]} |Fat32 Compat.|${destinationfat32compat["$destination"]}
|ASCII Compat.|${destinationascii["$destination"]}
|Path Change|${destinationrenamepath["$destination"]} |Path Change|${destinationrenamepath["$destination"]}
|File Rename|${destinationrename["$destination"]} |File Rename|${destinationrename["$destination"]}
EOF EOF

View File

@ -168,6 +168,17 @@ bitrate ${destinationquality["$destination"]}
fi fi
cat <<-EOCfg cat <<-EOCfg
# * ascii-only <yes>/<no>: Rename files for compatibility with ASCII-only
# systems.
EOCfg
if (( ${destinationascii["$destination"]} ))
then
echo $'ascii-only\t\tyes'
else
echo $'ascii-only\t\tno'
fi
cat <<-EOCfg
# * skip_mime-type <mime-type>: Files with mime-type <mime-type> will not # * skip_mime-type <mime-type>: Files with mime-type <mime-type> will not
# be included in that destination. For more than one mime-type, use multiple # be included in that destination. For more than one mime-type, use multiple
# times, as needed. The '*' character is a wildcard. # times, as needed. The '*' character is a wildcard.

View File

@ -23,5 +23,4 @@ checkDatabaseVersion() {
else else
Insert atom 1 <<<"version $currentdbversion" Insert atom 1 <<<"version $currentdbversion"
fi fi
exit
} }

View File

@ -295,6 +295,36 @@ setupDestination() {
comeagain comeagain
cat <<-EODesc cat <<-EODesc
ASCII-only filenames (boolean):
Rename files for compatibility with ASCII-only systems (most car
radios).
EODesc
case ${destinationascii["$destination"]} in
0) initialvalue=n ;;
1) initialvalue=y ;;
*) unset initialvalue ;;
esac
comeagain() {
read \
-e \
${initialvalue+-i $initialvalue}\
-p'ASCII-only filenames (y/N): '\
value
case $value in
[yY])
destinationascii["$destination"]=1
;;
''|[nN])
destinationascii["$destination"]=0
;;
*)
comeagain
;;
esac
}
comeagain
cat <<-EODesc
Skip mime-type (mime-type, string): Skip mime-type (mime-type, string):
Files with mime-type <mime-type> will not be included in that Files with mime-type <mime-type> will not be included in that
destination. The '*' character is a wildcard. destination. The '*' character is a wildcard.