2024-10-11 05:15:48 +00:00
|
|
|
{
|
|
|
|
stdenv,
|
|
|
|
ffmpeg-full,
|
|
|
|
nunicode,
|
|
|
|
getopt,
|
|
|
|
}: ''
|
2023-04-12 12:48:02 +00:00
|
|
|
#!${stdenv.shell}
|
|
|
|
|
|
|
|
port=8000
|
|
|
|
host=0.0.0.0
|
|
|
|
config=$(pwd)/config
|
|
|
|
metadata=$(pwd)/metadata
|
|
|
|
|
|
|
|
LONGOPTS=host:,port:,config:,metadata:,help
|
2023-10-09 19:29:22 +00:00
|
|
|
args=$(${getopt}/bin/getopt -l "$LONGOPTS" -o h -- "$@")
|
2023-04-12 12:48:02 +00:00
|
|
|
|
|
|
|
eval set -- "$args"
|
|
|
|
|
|
|
|
while [ $# -ge 1 ]; do
|
|
|
|
case "$1" in
|
|
|
|
--)
|
|
|
|
# No more options left.
|
|
|
|
shift
|
|
|
|
break
|
|
|
|
;;
|
|
|
|
--host)
|
|
|
|
host="$2"
|
|
|
|
shift
|
|
|
|
;;
|
|
|
|
--port)
|
|
|
|
port="$2"
|
|
|
|
shift
|
|
|
|
;;
|
|
|
|
--config)
|
|
|
|
if [[ "''${2:0:1}" = "/" ]]; then
|
|
|
|
config="$2"
|
|
|
|
else
|
|
|
|
config="$(pwd)/$2"
|
|
|
|
fi
|
|
|
|
shift
|
|
|
|
;;
|
|
|
|
--metadata)
|
|
|
|
if [[ "''${2:0:1}" = "/" ]]; then
|
|
|
|
metadata="$2"
|
|
|
|
else
|
|
|
|
metadata="$(pwd)/$2"
|
|
|
|
fi
|
|
|
|
shift
|
|
|
|
;;
|
|
|
|
--help|-h)
|
|
|
|
echo "Usage: audiobookshelf [--host <host>] [--port <port>] [--metadata <dir>] [--config <dir>]"
|
2023-10-09 19:29:22 +00:00
|
|
|
exit 0
|
2023-04-12 12:48:02 +00:00
|
|
|
;;
|
|
|
|
esac
|
|
|
|
shift
|
|
|
|
done
|
|
|
|
|
|
|
|
NODE_ENV=production \
|
|
|
|
SOURCE=nixpkgs \
|
2024-09-19 14:19:46 +00:00
|
|
|
SKIP_BINARIES_CHECK=1 \
|
2023-04-12 12:48:02 +00:00
|
|
|
FFMPEG_PATH=${ffmpeg-full}/bin/ffmpeg \
|
|
|
|
FFPROBE_PATH=${ffmpeg-full}/bin/ffprobe \
|
2024-10-11 05:15:48 +00:00
|
|
|
NUSQLITE3_PATH=${nunicode.sqlite}/lib/libnusqlite3 \
|
2023-04-12 12:48:02 +00:00
|
|
|
CONFIG_PATH="$config" \
|
|
|
|
METADATA_PATH="$metadata" \
|
|
|
|
PORT="$port" \
|
|
|
|
HOST="$host" \''
|