-
-
Notifications
You must be signed in to change notification settings - Fork 22
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Software title: Navidrome Music Server and Streamer compatible with S…
…ubsonic/Airsonic
- Loading branch information
1 parent
2f62c9a
commit c433b1e
Showing
3 changed files
with
132 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
ENABLED=true | ||
RELEASE="bookworm:noble" | ||
|
||
function testcase { | ||
./bin/armbian-config --api module_navidrome remove | ||
./bin/armbian-config --api module_navidrome install | ||
container=$(docker container ls -a | mawk '/navidrome?( |$)/{print $1}') | ||
if [[ -z "${container}" ]]; then | ||
exit 1 | ||
fi | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,85 @@ | ||
module_options+=( | ||
["module_navidrome,author"]="@armbian" | ||
["module_navidrome,maintainer"]="@igorpecovnik" | ||
["module_navidrome,feature"]="module_navidrome" | ||
["module_navidrome,example"]="install remove purge status help" | ||
["module_navidrome,desc"]="Install navidrome container" | ||
["module_navidrome,status"]="Active" | ||
["module_navidrome,doc_link"]="https://github.com/pynavidrome/navidrome/wiki" | ||
["module_navidrome,group"]="Downloaders" | ||
["module_navidrome,port"]="4533" | ||
["module_navidrome,arch"]="x86-64 arm64" | ||
) | ||
# | ||
# Install Module navidrome | ||
# | ||
function module_navidrome () { | ||
local title="navidrome" | ||
local condition=$(which "$title" 2>/dev/null) | ||
|
||
if pkg_installed docker-ce; then | ||
local container=$(docker container ls -a | mawk '/navidrome?( |$)/{print $1}') | ||
local image=$(docker image ls -a | mawk '/navidrome?( |$)/{print $3}') | ||
fi | ||
|
||
local commands | ||
IFS=' ' read -r -a commands <<< "${module_options["module_navidrome,example"]}" | ||
|
||
NAVIDROME_BASE="${SOFTWARE_FOLDER}/navidrome" | ||
|
||
case "$1" in | ||
"${commands[0]}") | ||
pkg_installed docker-ce || module_docker install | ||
[[ -d "$NAVIDROME_BASE" ]] || mkdir -p "$NAVIDROME_BASE" || { echo "Couldn't create storage directory: $NAVIDROME_BASE"; exit 1; } | ||
docker run -d \ | ||
--name=navidrome \ | ||
--net=lsio \ | ||
--user 1000:1000 \ | ||
-e TZ="$(cat /etc/timezone)" \ | ||
-p 4533:4533 \ | ||
-v "${NAVIDROME_BASE}/music:/music" \ | ||
-v "${NAVIDROME_BASE}/data:/data" \ | ||
--restart unless-stopped \ | ||
deluan/navidrome:latest | ||
for i in $(seq 1 20); do | ||
if docker inspect -f '{{ index .Config.Labels "build_version" }}' navidrome >/dev/null 2>&1 ; then | ||
break | ||
else | ||
sleep 3 | ||
fi | ||
if [ $i -eq 20 ] ; then | ||
echo -e "\nTimed out waiting for ${title} to start, consult your container logs for more info (\`docker logs navidrome\`)" | ||
exit 1 | ||
fi | ||
done | ||
;; | ||
"${commands[1]}") | ||
[[ "${container}" ]] && docker container rm -f "$container" >/dev/null | ||
[[ "${image}" ]] && docker image rm "$image" >/dev/null | ||
;; | ||
"${commands[2]}") | ||
${module_options["module_navidrome,feature"]} ${commands[1]} | ||
[[ -n "${NAVIDROME_BASE}" && "${NAVIDROME_BASE}" != "/" ]] && rm -rf "${NAVIDROME_BASE}" | ||
;; | ||
"${commands[3]}") | ||
if [[ "${container}" && "${image}" ]]; then | ||
return 0 | ||
else | ||
return 1 | ||
fi | ||
;; | ||
"${commands[4]}") | ||
echo -e "\nUsage: ${module_options["module_navidrome,feature"]} <command>" | ||
echo -e "Commands: ${module_options["module_navidrome,example"]}" | ||
echo "Available commands:" | ||
echo -e "\tinstall\t- Install $title." | ||
echo -e "\tstatus\t- Installation status $title." | ||
echo -e "\tremove\t- Remove $title." | ||
echo -e "\tpurge\t- Purge $title." | ||
echo | ||
;; | ||
*) | ||
${module_options["module_navidrome,feature"]} ${commands[4]} | ||
;; | ||
esac | ||
} |