Skip to content

Commit

Permalink
Software title: Navidrome Music Server and Streamer compatible with S…
Browse files Browse the repository at this point in the history
…ubsonic/Airsonic
  • Loading branch information
igorpecovnik committed Jan 20, 2025
1 parent 2f62c9a commit c433b1e
Show file tree
Hide file tree
Showing 3 changed files with 132 additions and 0 deletions.
11 changes: 11 additions & 0 deletions tests/NAV001.conf
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
}
36 changes: 36 additions & 0 deletions tools/json/config.software.json
Original file line number Diff line number Diff line change
Expand Up @@ -169,6 +169,42 @@
}
]
},
{
"id": "Music",
"description": "Music servers and streamers",
"sub": [
{
"id": "NAV001",
"description": "Navidrome music server and streamer compatible with Subsonic/Airsonic",
"command": [
"module_navidrome install"
],
"status": "Stable",
"author": "@armbian",
"condition": "! module_navidrome status"
},
{
"id": "NAV002",
"description": "Navidrome remove",
"command": [
"module_navidrome install"
],
"status": "Stable",
"author": "@armbian",
"condition": "module_navidrome status"
},
{
"id": "NAV003",
"description": "Navidrome purge with data folder",
"command": [
"module_navidrome purge"
],
"status": "Stable",
"author": "@armbian",
"condition": "module_navidrome status"
}
]
},
{
"id": "Desktops",
"description": "Desktop Environments",
Expand Down
85 changes: 85 additions & 0 deletions tools/modules/software/module_navidrome.sh
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
}

0 comments on commit c433b1e

Please sign in to comment.