mirror of
https://github.com/KrumpetPirate/AAXtoMP3.git
synced 2024-11-18 03:08:57 +01:00
Merge pull request #51 from corbolais/master
chg: use authcode file located in HOME dir.
This commit is contained in:
commit
e3d9a9ea35
28
AAXtoMP3
28
AAXtoMP3
@ -5,6 +5,8 @@ set -o errexit -o noclobber -o nounset -o pipefail
|
|||||||
codec=libmp3lame
|
codec=libmp3lame
|
||||||
extension=mp3
|
extension=mp3
|
||||||
mode=chaptered
|
mode=chaptered
|
||||||
|
authcode=".authcode";
|
||||||
|
authcodeDirs="${HOME}/ ./";
|
||||||
GREP=$(grep --version | grep -q GNU && echo "grep" || echo "ggrep")
|
GREP=$(grep --version | grep -q GNU && echo "grep" || echo "ggrep")
|
||||||
|
|
||||||
if ! [[ $(type -P "$GREP") ]]; then
|
if ! [[ $(type -P "$GREP") ]]; then
|
||||||
@ -47,12 +49,26 @@ then
|
|||||||
shift
|
shift
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ ! -f .authcode ]; then
|
auth_code="";
|
||||||
auth_code=$1
|
for dir in $authcodeDirs; do
|
||||||
shift
|
codeFile="${dir}$authcode";
|
||||||
else
|
|
||||||
auth_code=`head -1 .authcode`
|
if [ ! -f "$codeFile" ]; then
|
||||||
fi
|
auth_code=$1
|
||||||
|
shift
|
||||||
|
break;
|
||||||
|
elif [ -s "$codeFile" ]; then
|
||||||
|
auth_code=`head -1 "$codeFile"`
|
||||||
|
break;
|
||||||
|
else
|
||||||
|
echo "INFO: Sorry, empty \"$codeFile\" found, skipping.";
|
||||||
|
fi;
|
||||||
|
done;
|
||||||
|
|
||||||
|
if [ -z "$auth_code" ]; then
|
||||||
|
echo "INFO: Sorry, no authcode provided.";
|
||||||
|
exit 1;
|
||||||
|
fi;
|
||||||
|
|
||||||
debug() {
|
debug() {
|
||||||
echo "$(date "+%F %T%z") ${1}"
|
echo "$(date "+%F %T%z") ${1}"
|
||||||
|
Loading…
Reference in New Issue
Block a user