improvement: only --load-local requires MUSICDIR to be set
This commit is contained in:
28
src/main.sh
28
src/main.sh
@@ -36,8 +36,7 @@ set -eu
|
|||||||
. "sh/local.sh"
|
. "sh/local.sh"
|
||||||
|
|
||||||
# Support of local music files
|
# Support of local music files
|
||||||
if [ "${MUSICDIR:-}" ]; then
|
if [ "${1:-}" = "--decorate" ]; then
|
||||||
if [ "${1:-}" = "--decorate" ]; then
|
|
||||||
[ ! "${2:-}" ] && err "You did not specify a directory." && exit 1
|
[ ! "${2:-}" ] && err "You did not specify a directory." && exit 1
|
||||||
[ ! -d "$2" ] && err "Path $2 does not point to a directory." && exit 1
|
[ ! -d "$2" ] && err "Path $2 does not point to a directory." && exit 1
|
||||||
if ! decorate "$2"; then
|
if ! decorate "$2"; then
|
||||||
@@ -45,37 +44,36 @@ if [ "${MUSICDIR:-}" ]; then
|
|||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
exit 0
|
exit 0
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ "${1:-}" = "--load-local" ]; then
|
if [ "$MUSICDIR" ] && [ "${1:-}" = "--load-local" ]; then
|
||||||
load_local || err "Failed to load local data"
|
load_local || err "Failed to load local data"
|
||||||
exit 0
|
exit 0
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ "${1:-}" = "--list-releases" ]; then
|
if [ "${1:-}" = "--list-releases" ]; then
|
||||||
list_releases
|
list_releases
|
||||||
exit 0
|
exit 0
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ "${1:-}" = "--list-releasegroups" ]; then
|
if [ "${1:-}" = "--list-releasegroups" ]; then
|
||||||
list_releasegroups
|
list_releasegroups
|
||||||
exit 0
|
exit 0
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ "${1:-}" = "--list-artists" ]; then
|
if [ "${1:-}" = "--list-artists" ]; then
|
||||||
list_artists
|
list_artists
|
||||||
exit 0
|
exit 0
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ "${1:-}" = "--play-release" ]; then
|
if [ "${1:-}" = "--play-release" ]; then
|
||||||
echo "Playing release $2" >>/tmp/foo
|
echo "Playing release $2" >>/tmp/foo
|
||||||
exit 0
|
exit 0
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ "${1:-}" = "--play-recording" ]; then
|
if [ "${1:-}" = "--play-recording" ]; then
|
||||||
echo "Playing recording $2" >>/tmp/foo
|
echo "Playing recording $2" >>/tmp/foo
|
||||||
exit 0
|
exit 0
|
||||||
fi
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ "${1:-}" = "--internal-preview-artist" ]; then
|
if [ "${1:-}" = "--internal-preview-artist" ]; then
|
||||||
|
Reference in New Issue
Block a user