Read configuration from file on ~/.ks-tools/
This commit is contained in:
parent
27656677d3
commit
72c83f80e5
34
src/ks-mp3
34
src/ks-mp3
|
@ -13,6 +13,8 @@ M_DATE="030521"
|
|||
dirTemp="/tmp"
|
||||
listTemp="ks-tools.list"
|
||||
ksToolsTempFolder="/tmp/ks-tools"
|
||||
configFolder=${HOME}/.ks-tools
|
||||
configFile=${configFolder}/ks-mp3
|
||||
|
||||
# Basic parameters
|
||||
acodec="libmp3lame"
|
||||
|
@ -20,6 +22,36 @@ b_acodec="128k"
|
|||
v_ext="mp3"
|
||||
default_lang_audio="spa"
|
||||
|
||||
# Create inicial config file
|
||||
mkdir -p ${configFolder}
|
||||
if [ -f ${configFile} ] ; then
|
||||
exist_acodec=$(cat ${configFile} | grep "acodec" | cut -c2 | cut -d "_" -f 1)
|
||||
exist_b_acodec=$(cat ${configFile} | grep "b_acodec=")
|
||||
exist_default_lang_audio=$(cat ${configFile} | grep "default_lang_audio=")
|
||||
exist_v_ext=$(cat ${configFile} | grep "v_ext=")
|
||||
if [ -z ${exist_acodec} ] ; then
|
||||
echo "acodec=${acodec}" >> ${configFile}
|
||||
fi
|
||||
if [ -z ${exist_b_acodec} ] ; then
|
||||
echo "b_acodec=${b_acodec}" >> ${configFile}
|
||||
fi
|
||||
if [ -z ${exist_default_lang_audio} ] ; then
|
||||
echo "default_lang_audio=${default_lang_audio}" >> ${configFile}
|
||||
fi
|
||||
if [ -z ${exist_v_ext} ] ; then
|
||||
echo "v_ext=${v_ext}" >> ${configFile}
|
||||
fi
|
||||
source ${configFile}
|
||||
else
|
||||
echo "#!/bin/bash" > ${configFile}
|
||||
echo "" >> ${configFile}
|
||||
echo "acodec=${acodec}" >> ${configFile}
|
||||
echo "b_acodec=${b_acodec}" >> ${configFile}
|
||||
echo "default_lang_audio=${default_lang_audio}" >> ${configFile}
|
||||
echo "v_ext=${v_ext}" >> ${configFile}
|
||||
source ${configFile}
|
||||
fi
|
||||
|
||||
# Check cygwin alias (for Windows)
|
||||
if [ -f "/usr/bin/cygwin-alias.sh" ] ; then
|
||||
shopt -s expand_aliases
|
||||
|
@ -122,7 +154,7 @@ if [ -z "${1}" ] ; then
|
|||
echo ""
|
||||
echo "- Convert video/audio file(s) to MP3 (Audio) Format"
|
||||
echo ""
|
||||
echo "+ Config:"
|
||||
echo "+ Config: ${configFile}"
|
||||
echo ""
|
||||
echo " - Audio codec: ${acodec}"
|
||||
echo " - Bitrate audio: ${b_acodec}"
|
||||
|
|
|
@ -18,6 +18,8 @@ formatFiles="mp4 avi mpg mpeg mov wmv mkv ogv webm rm flv vob ogg oga mp3 mp2 aa
|
|||
dirTemp="/tmp"
|
||||
listTemp="ks-tools.list"
|
||||
ksToolsTempFolder="/tmp/ks-tools"
|
||||
configFolder=${HOME}/.ks-tools
|
||||
configFile=${configFolder}/ks-mp3
|
||||
|
||||
# Basic parameters
|
||||
acodec="libmp3lame"
|
||||
|
@ -27,6 +29,36 @@ track_init="1"
|
|||
artist_init="Artist"
|
||||
default_lang_audio="spa"
|
||||
|
||||
# Create inicial config file
|
||||
mkdir -p ${configFolder}
|
||||
if [ -f ${configFile} ] ; then
|
||||
exist_acodec=$(cat ${configFile} | grep "acodec" | cut -c2 | cut -d "_" -f 1)
|
||||
exist_b_acodec=$(cat ${configFile} | grep "b_acodec=")
|
||||
exist_default_lang_audio=$(cat ${configFile} | grep "default_lang_audio=")
|
||||
exist_v_ext=$(cat ${configFile} | grep "v_ext=")
|
||||
if [ -z ${exist_acodec} ] ; then
|
||||
echo "acodec=${acodec}" >> ${configFile}
|
||||
fi
|
||||
if [ -z ${exist_b_acodec} ] ; then
|
||||
echo "b_acodec=${b_acodec}" >> ${configFile}
|
||||
fi
|
||||
if [ -z ${exist_default_lang_audio} ] ; then
|
||||
echo "default_lang_audio=${default_lang_audio}" >> ${configFile}
|
||||
fi
|
||||
if [ -z ${exist_v_ext} ] ; then
|
||||
echo "v_ext=${v_ext}" >> ${configFile}
|
||||
fi
|
||||
source ${configFile}
|
||||
else
|
||||
echo "#!/bin/bash" > ${configFile}
|
||||
echo "" >> ${configFile}
|
||||
echo "acodec=${acodec}" >> ${configFile}
|
||||
echo "b_acodec=${b_acodec}" >> ${configFile}
|
||||
echo "default_lang_audio=${default_lang_audio}" >> ${configFile}
|
||||
echo "v_ext=${v_ext}" >> ${configFile}
|
||||
source ${configFile}
|
||||
fi
|
||||
|
||||
# Check cygwin alias (for Windows)
|
||||
if [ -f "/usr/bin/cygwin-alias.sh" ] ; then
|
||||
shopt -s expand_aliases
|
||||
|
@ -129,7 +161,7 @@ if [ -z "${1}" ] ; then
|
|||
echo ""
|
||||
echo "- Convert folder album to MP3 Audio Format"
|
||||
echo ""
|
||||
echo "+ Config:"
|
||||
echo "+ Config: ${configFile}"
|
||||
echo ""
|
||||
echo " - Audio codec: ${acodec}"
|
||||
echo " - Bitrate audio: ${b_acodec}"
|
||||
|
|
34
src/ks-oga
34
src/ks-oga
|
@ -13,6 +13,8 @@ M_DATE="030521"
|
|||
dirTemp="/tmp"
|
||||
listTemp="ks-tools.list"
|
||||
ksToolsTempFolder="/tmp/ks-tools"
|
||||
configFolder=${HOME}/.ks-tools
|
||||
configFile=${configFolder}/ks-oga
|
||||
|
||||
# Basic parameters
|
||||
acodec="libvorbis"
|
||||
|
@ -20,6 +22,36 @@ b_acodec="130k"
|
|||
v_ext="oga"
|
||||
default_lang_audio="spa"
|
||||
|
||||
# Create inicial config file
|
||||
mkdir -p ${configFolder}
|
||||
if [ -f ${configFile} ] ; then
|
||||
exist_acodec=$(cat ${configFile} | grep "acodec" | cut -c2 | cut -d "_" -f 1)
|
||||
exist_b_acodec=$(cat ${configFile} | grep "b_acodec=")
|
||||
exist_default_lang_audio=$(cat ${configFile} | grep "default_lang_audio=")
|
||||
exist_v_ext=$(cat ${configFile} | grep "v_ext=")
|
||||
if [ -z ${exist_acodec} ] ; then
|
||||
echo "acodec=${acodec}" >> ${configFile}
|
||||
fi
|
||||
if [ -z ${exist_b_acodec} ] ; then
|
||||
echo "b_acodec=${b_acodec}" >> ${configFile}
|
||||
fi
|
||||
if [ -z ${exist_default_lang_audio} ] ; then
|
||||
echo "default_lang_audio=${default_lang_audio}" >> ${configFile}
|
||||
fi
|
||||
if [ -z ${exist_v_ext} ] ; then
|
||||
echo "v_ext=${v_ext}" >> ${configFile}
|
||||
fi
|
||||
source ${configFile}
|
||||
else
|
||||
echo "#!/bin/bash" > ${configFile}
|
||||
echo "" >> ${configFile}
|
||||
echo "acodec=${acodec}" >> ${configFile}
|
||||
echo "b_acodec=${b_acodec}" >> ${configFile}
|
||||
echo "default_lang_audio=${default_lang_audio}" >> ${configFile}
|
||||
echo "v_ext=${v_ext}" >> ${configFile}
|
||||
source ${configFile}
|
||||
fi
|
||||
|
||||
# Check cygwin alias (for Windows)
|
||||
if [ -f "/usr/bin/cygwin-alias.sh" ] ; then
|
||||
shopt -s expand_aliases
|
||||
|
@ -122,7 +154,7 @@ if [ -z "${1}" ] ; then
|
|||
echo ""
|
||||
echo "- Convert video/audio file(s) to OGA (OGG Audio) Format"
|
||||
echo ""
|
||||
echo "+ Config:"
|
||||
echo "+ Config: ${configFile}"
|
||||
echo ""
|
||||
echo " - Audio codec: ${acodec}"
|
||||
echo " - Bitrate audio: ${b_acodec}"
|
||||
|
|
|
@ -18,6 +18,8 @@ formatFiles="mp4 avi mpg mpeg mov wmv mkv ogv webm rm flv vob ogg oga mp3 mp2 aa
|
|||
dirTemp="/tmp"
|
||||
listTemp="ks-tools.list"
|
||||
ksToolsTempFolder="/tmp/ks-tools"
|
||||
configFolder=${HOME}/.ks-tools
|
||||
configFile=${configFolder}/ks-oga
|
||||
|
||||
# Basic parameters
|
||||
acodec="libvorbis"
|
||||
|
@ -27,6 +29,36 @@ track_init="1"
|
|||
artist_init="Artist"
|
||||
default_lang_audio="spa"
|
||||
|
||||
# Create inicial config file
|
||||
mkdir -p ${configFolder}
|
||||
if [ -f ${configFile} ] ; then
|
||||
exist_acodec=$(cat ${configFile} | grep "acodec" | cut -c2 | cut -d "_" -f 1)
|
||||
exist_b_acodec=$(cat ${configFile} | grep "b_acodec=")
|
||||
exist_default_lang_audio=$(cat ${configFile} | grep "default_lang_audio=")
|
||||
exist_v_ext=$(cat ${configFile} | grep "v_ext=")
|
||||
if [ -z ${exist_acodec} ] ; then
|
||||
echo "acodec=${acodec}" >> ${configFile}
|
||||
fi
|
||||
if [ -z ${exist_b_acodec} ] ; then
|
||||
echo "b_acodec=${b_acodec}" >> ${configFile}
|
||||
fi
|
||||
if [ -z ${exist_default_lang_audio} ] ; then
|
||||
echo "default_lang_audio=${default_lang_audio}" >> ${configFile}
|
||||
fi
|
||||
if [ -z ${exist_v_ext} ] ; then
|
||||
echo "v_ext=${v_ext}" >> ${configFile}
|
||||
fi
|
||||
source ${configFile}
|
||||
else
|
||||
echo "#!/bin/bash" > ${configFile}
|
||||
echo "" >> ${configFile}
|
||||
echo "acodec=${acodec}" >> ${configFile}
|
||||
echo "b_acodec=${b_acodec}" >> ${configFile}
|
||||
echo "default_lang_audio=${default_lang_audio}" >> ${configFile}
|
||||
echo "v_ext=${v_ext}" >> ${configFile}
|
||||
source ${configFile}
|
||||
fi
|
||||
|
||||
# Check cygwin alias (for Windows)
|
||||
if [ -f "/usr/bin/cygwin-alias.sh" ] ; then
|
||||
shopt -s expand_aliases
|
||||
|
@ -129,7 +161,7 @@ if [ -z "${1}" ] ; then
|
|||
echo ""
|
||||
echo "- Convert folder album to OGA (OGG Audio) Format"
|
||||
echo ""
|
||||
echo "+ Config:"
|
||||
echo "+ Config: ${configFile}"
|
||||
echo ""
|
||||
echo " - Audio codec: ${acodec}"
|
||||
echo " - Bitrate audio: ${b_acodec}"
|
||||
|
|
Loading…
Reference in New Issue
Block a user