forked from GioF71/tidal-connect
-
Notifications
You must be signed in to change notification settings - Fork 0
/
configure.sh
executable file
·65 lines (51 loc) · 1.39 KB
/
configure.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
#!/bin/bash
# error codes
# 1 cannot specify both index and name
set -ex
ENV_FILE=.env
chmod 755 bin/entrypoint.sh
while getopts n:i:f:m:c:p:t: flag
do
case "${flag}" in
n) card_name=${OPTARG};;
i) card_index=${OPTARG};;
f) friendly_name=${OPTARG};;
m) model_name=${OPTARG};;
c) mqa_codec=${OPTARG};;
p) mqa_passthrough=${OPTARG};;
t) sleep_time_sec=${OPTARG};;
esac
done
if [[ -n "${card_index}" && -n "${card_name}" ]]; then
echo "Cannot specify both index and name for audio card"
exit 1
fi
echo "card_index=[$card_index]"
echo "card_name=[$card_name]"
if test -f $ENV_FILE; then
truncate -s 0 $ENV_FILE
fi
if test -f $ENV_FILE; then
truncate -s 0 $ENV_FILE
fi
if [[ -n ${friendly_name} ]]; then
echo "FRIENDLY_NAME=${friendly_name}" >> $ENV_FILE
fi
if [[ -n ${model_name} ]]; then
echo "MODEL_NAME=${model_name}" >> $ENV_FILE
fi
if [[ -n ${mqa_codec} ]]; then
echo "MQA_CODEC=${mqa_codec}" >> $ENV_FILE
fi
if [[ -n ${mqa_passthrough} ]]; then
echo "MQA_PASSTHROUGH=${mqa_passthrough}" >> $ENV_FILE
fi
if [[ -n ${sleep_time_sec} ]]; then
echo "SLEEP_TIME_SEC=${sleep_time_sec}" >> $ENV_FILE
fi
if [[ -n "${card_name}" ]]; then
echo "CARD_NAME=${card_name}" >> $ENV_FILE
elif [[ -n "${card_index}" ]]; then
echo "CARD_INDEX=${card_index}" >> $ENV_FILE
echo "CARD_NAME=NOT_SET" >> $ENV_FILE
fi