Compare commits

..

10 Commits

Author SHA1 Message Date
Vincent Riquer
de63477ede small fixes 2025-11-10 00:57:37 +01:00
Vincent Riquer
3c8e0241b1 updateTags: Refactor progress info 2025-11-10 00:57:37 +01:00
Vincent Riquer
3a4e43475a getFiles: Refactor progress info 2025-11-10 00:57:37 +01:00
Vincent Riquer
e50bf63f16 copyFiles_action: Refactor progress info 2025-11-10 00:57:37 +01:00
Vincent Riquer
c5ad92f587 atom: Refactor progress info 2025-11-10 00:57:37 +01:00
ScriptFanix
1d8ef90968 Revert "Merge branch '27-script-is-uselessly-verbose' into 'dev'"
This reverts merge request !34
2025-11-10 00:53:37 +01:00
ScriptFanix
a44fc069fe Merge branch '29-many-error-codes-are-not-defined' into 'dev'
Use predictable exit codes

Resolve "Many error codes are not defined"

See merge request atom/AtOM!35
2025-11-09 06:56:37 +01:00
ScriptFanix
6e1a85199c Resolve "Many error codes are not defined" 2025-11-09 06:56:37 +01:00
ScriptFanix
cb64b5749c Merge branch '27-script-is-uselessly-verbose' into 'dev'
Resolve "Script is uselessly verbose"

See merge request atom/AtOM!34
2025-11-09 06:18:26 +01:00
ScriptFanix
fb35fea3e0 Resolve "Script is uselessly verbose" 2025-11-09 06:18:26 +01:00
11 changed files with 130 additions and 95 deletions

36
atom
View File

@ -1,15 +1,17 @@
#!/usr/bin/env bash #!/usr/bin/env bash
declare -r \
DOCDIR=%DOCDIR% \
LIBDIR=%LIBDIR% \
SHAREDIR=%SHAREDIR%
declare -r \
exampleconf=$DOCDIR/example.cfg \
schema=$SHAREDIR/schema.sql \
\
oldIFS="$IFS"
## Define exit codes ## Define exit codes
# General config errors [10-19] source "$SHAREDIR"/errorcodes
ELOAD=10
EINTERVAL=11
ENOCFG=19
# Source cofig errors [20-29]
# Destination config errors [30-49]
EFORMAT=30
ECHANNEL=31
EFMTINVPARM=49
# config structures # config structures
declare -A \ declare -A \
@ -36,21 +38,11 @@ declare -A \
exit $EBASHVERS exit $EBASHVERS
} }
declare -r \
DOCDIR=%DOCDIR% \
LIBDIR=%LIBDIR% \
SHAREDIR=%SHAREDIR%
declare -r \
exampleconf=$DOCDIR/example.cfg \
schema=$SHAREDIR/schema.sql \
\
oldIFS="$IFS"
LC_ALL=C LC_ALL=C
shopt -s extglob shopt -s extglob
source $SHAREDIR/id3genres source "$SHAREDIR"/id3genres
for function in "$LIBDIR"/*/* for function in "$LIBDIR"/*/*
do do
@ -125,12 +117,12 @@ do
:) :)
echo "-$OPTARG requires an argument" echo "-$OPTARG requires an argument"
help help
exit 127 exit $EINVARG
;; ;;
*) *)
echo "Unrecognized option: -$OPTARG" echo "Unrecognized option: -$OPTARG"
help help
exit 127 exit $EINVARG
;; ;;
esac esac
done done

View File

@ -18,7 +18,7 @@ checkDatabaseVersion() {
echo "Database schema version $dbversion is higher than echo "Database schema version $dbversion is higher than
that of this version of AtOM that of this version of AtOM
($currentdbversion). Bailing out." >&2 ($currentdbversion). Bailing out." >&2
exit 1 exit $EDBVERSION
fi fi
else else
Insert atom 1 <<<"version $currentdbversion" Insert atom 1 <<<"version $currentdbversion"

View File

@ -220,7 +220,7 @@ master() {
echo "Waiting for children to come back home..." echo "Waiting for children to come back home..."
wait wait
echo $'\nGood luck!' echo $'\nGood luck!'
exit 1 exit $ETASKLEFT
elif (( ready == 0 )) elif (( ready == 0 ))
then then
sleep 0.1 sleep 0.1

24
share/errorcodes Normal file
View File

@ -0,0 +1,24 @@
#!/usr/bin/env bash
## Define exit codes
# General config errors [10-19]
EDBVERSION=10
ELOAD=11
EINTERVAL=12
ELOAD=13
EIONICE=14
ENOCFG=19
# Source cofig errors [20-29]
# Destination config errors [30-49]
EFORMAT=30
ECHANNEL=31
EQUALITY=32
EMAXBPS=33
EINVDEST=34
EFMTINVPARM=49
# Tasks
ETASKLEFT=50
# Sanity
ESANITY=60
# Invalid arguments
EINVARG=127

View File

@ -8,6 +8,19 @@ EOWarn
read -p "Press Enter to continue or Ctrl-C to abort" read -p "Press Enter to continue or Ctrl-C to abort"
declare -r \
DOCDIR=%DOCDIR% \
LIBDIR=%LIBDIR% \
SHAREDIR=%SHAREDIR%
declare -r \
exampleconf=$DOCDIR/example.cfg \
schema=$SHAREDIR/schema.sql \
\
oldIFS="$IFS"
## Define exit codes
source "$SHAREDIR"/errorcodes
# config structures # config structures
declare -A \ declare -A \
destinationchannels \ destinationchannels \
@ -30,16 +43,6 @@ declare -A \
exit $EBASHVERS exit $EBASHVERS
} }
declare -r \
DOCDIR=%DOCDIR% \
LIBDIR=%LIBDIR% \
SHAREDIR=%SHAREDIR%
declare -r \
exampleconf=$DOCDIR/example.cfg \
schema=$SHAREDIR/schema.sql \
\
oldIFS="$IFS"
LC_ALL=C LC_ALL=C
shopt -s extglob shopt -s extglob

View File

@ -1,5 +1,18 @@
#!/usr/bin/env bash #!/usr/bin/env bash
declare -r \
DOCDIR=%DOCDIR% \
LIBDIR=%LIBDIR% \
SHAREDIR=%SHAREDIR%
declare -r \
exampleconf=$DOCDIR/example.cfg \
schema=$SHAREDIR/schema.sql \
\
oldIFS="$IFS"
## Define exit codes
source "$SHAREDIR"/errorcodes
# config structures # config structures
declare -A \ declare -A \
destinationchannels \ destinationchannels \
@ -22,16 +35,6 @@ declare -A \
exit $EBASHVERS exit $EBASHVERS
} }
declare -r \
DOCDIR=%DOCDIR% \
LIBDIR=%LIBDIR% \
SHAREDIR=%SHAREDIR%
declare -r \
exampleconf=$DOCDIR/example.cfg \
schema=$SHAREDIR/schema.sql \
\
oldIFS="$IFS"
LC_ALL=C LC_ALL=C
shopt -s extglob shopt -s extglob

View File

@ -1,5 +1,18 @@
#!/usr/bin/env bash #!/usr/bin/env bash
declare -r \
DOCDIR=%DOCDIR% \
LIBDIR=%LIBDIR% \
SHAREDIR=%SHAREDIR%
declare -r \
exampleconf=$DOCDIR/example.cfg \
schema=$SHAREDIR/schema.sql \
\
oldIFS="$IFS"
## Define exit codes
source "$SHAREDIR"/errorcodes
# config structures # config structures
declare -A \ declare -A \
destinationchannels \ destinationchannels \
@ -22,16 +35,6 @@ declare -A \
exit $EBASHVERS exit $EBASHVERS
} }
declare -r \
DOCDIR=%DOCDIR% \
LIBDIR=%LIBDIR% \
SHAREDIR=%SHAREDIR%
declare -r \
exampleconf=$DOCDIR/example.cfg \
schema=$SHAREDIR/schema.sql \
\
oldIFS="$IFS"
LC_ALL=C LC_ALL=C
shopt -s extglob shopt -s extglob

View File

@ -1,5 +1,18 @@
#!/usr/bin/env bash #!/usr/bin/env bash
declare -r \
DOCDIR=%DOCDIR% \
LIBDIR=%LIBDIR% \
SHAREDIR=%SHAREDIR%
declare -r \
exampleconf=$DOCDIR/example.cfg \
schema=$SHAREDIR/schema.sql \
\
oldIFS="$IFS"
## Define exit codes
source "$SHAREDIR"/errorcodes
# config structures # config structures
declare -A \ declare -A \
destinationchannels \ destinationchannels \
@ -22,16 +35,6 @@ declare -A \
exit $EBASHVERS exit $EBASHVERS
} }
declare -r \
DOCDIR=%DOCDIR% \
LIBDIR=%LIBDIR% \
SHAREDIR=%SHAREDIR%
declare -r \
exampleconf=$DOCDIR/example.cfg \
schema=$SHAREDIR/schema.sql \
\
oldIFS="$IFS"
LC_ALL=C LC_ALL=C
shopt -s extglob shopt -s extglob

View File

@ -1,6 +1,17 @@
#!/usr/bin/env bash #!/usr/bin/env bash
#!/bin/bash declare -r \
DOCDIR=%DOCDIR% \
LIBDIR=%LIBDIR% \
SHAREDIR=%SHAREDIR%
declare -r \
exampleconf=$DOCDIR/example.cfg \
schema=$SHAREDIR/schema.sql \
\
oldIFS="$IFS"
## Define exit codes
source "$SHAREDIR"/errorcodes
# config structures # config structures
declare -A \ declare -A \
@ -24,16 +35,6 @@ declare -A \
exit $EBASHVERS exit $EBASHVERS
} }
declare -r \
DOCDIR=%DOCDIR% \
LIBDIR=%LIBDIR% \
SHAREDIR=%SHAREDIR%
declare -r \
exampleconf=$DOCDIR/example.cfg \
schema=$SHAREDIR/schema.sql \
\
oldIFS="$IFS"
LC_ALL=C LC_ALL=C
shopt -s extglob shopt -s extglob

View File

@ -1,5 +1,18 @@
#!/usr/bin/env bash #!/usr/bin/env bash
declare -r \
DOCDIR=%DOCDIR% \
LIBDIR=%LIBDIR% \
SHAREDIR=%SHAREDIR%
declare -r \
exampleconf=$DOCDIR/example.cfg \
schema=$SHAREDIR/schema.sql \
\
oldIFS="$IFS"
## Define exit codes
source "$SHAREDIR"/errorcodes
# config structures # config structures
declare -A \ declare -A \
destinationchannels \ destinationchannels \
@ -22,16 +35,6 @@ declare -A \
exit $EBASHVERS exit $EBASHVERS
} }
declare -r \
DOCDIR=%DOCDIR% \
LIBDIR=%LIBDIR% \
SHAREDIR=%SHAREDIR%
declare -r \
exampleconf=$DOCDIR/example.cfg \
schema=$SHAREDIR/schema.sql \
\
oldIFS="$IFS"
LC_ALL=C LC_ALL=C
shopt -s extglob shopt -s extglob

View File

@ -1,5 +1,18 @@
#!/usr/bin/env bash #!/usr/bin/env bash
declare -r \
DOCDIR=%DOCDIR% \
LIBDIR=%LIBDIR% \
SHAREDIR=%SHAREDIR%
declare -r \
exampleconf=$DOCDIR/example.cfg \
schema=$SHAREDIR/schema.sql \
\
oldIFS="$IFS"
## Define exit codes
source "$SHAREDIR"/errorcodes
# config structures # config structures
declare -A \ declare -A \
destinationchannels \ destinationchannels \
@ -23,16 +36,6 @@ declare -A \
exit $EBASHVERS exit $EBASHVERS
} }
declare -r \
DOCDIR=%DOCDIR% \
LIBDIR=%LIBDIR% \
SHAREDIR=%SHAREDIR%
declare -r \
exampleconf=$DOCDIR/example.cfg \
schema=$SHAREDIR/schema.sql \
\
oldIFS="$IFS"
LC_ALL=C LC_ALL=C
shopt -s extglob shopt -s extglob