mirror of
https://github.com/KrumpetPirate/AAXtoMP3.git
synced 2024-11-18 03:08:57 +01:00
chg: search HOME and local dir for authcode file in this order, first occurence accepted.
Signed-off-by: Me <corbolais@gmail.com>
This commit is contained in:
parent
1031e3ae1d
commit
15945b18b1
23
AAXtoMP3
23
AAXtoMP3
@ -5,7 +5,8 @@ set -o errexit -o noclobber -o nounset -o pipefail
|
||||
codec=libmp3lame
|
||||
extension=mp3
|
||||
mode=chaptered
|
||||
authcodeFile="${HOME}/.authcode";
|
||||
authcode=".authcode";
|
||||
authcodeDirs="${HOME}/ ./";
|
||||
GREP=$(grep --version | grep -q GNU && echo "grep" || echo "ggrep")
|
||||
|
||||
if ! [[ $(type -P "$GREP") ]]; then
|
||||
@ -48,12 +49,26 @@ then
|
||||
shift
|
||||
fi
|
||||
|
||||
if [ ! -f "$authcodeFile" ]; then
|
||||
auth_code="";
|
||||
for dir in $authcodeDirs; do
|
||||
codeFile="${dir}$authcode";
|
||||
|
||||
if [ ! -f "$codeFile" ]; then
|
||||
auth_code=$1
|
||||
shift
|
||||
break;
|
||||
elif [ -s "$codeFile" ]; then
|
||||
auth_code=`head -1 "$codeFile"`
|
||||
break;
|
||||
else
|
||||
auth_code=`head -1 "$authcodeFile"`
|
||||
fi
|
||||
echo "INFO: Sorry, empty \"$codeFile\" found, skipping.";
|
||||
fi;
|
||||
done;
|
||||
|
||||
if [ -z "$auth_code" ]; then
|
||||
echo "INFO: Sorry, no authcode provided.";
|
||||
exit 1;
|
||||
fi;
|
||||
|
||||
debug() {
|
||||
echo "$(date "+%F %T%z") ${1}"
|
||||
|
Loading…
Reference in New Issue
Block a user