bin: add ampache and improve server configuration

This commit is contained in:
xeruf 2022-07-06 09:15:29 +00:00
parent 88538ffcdf
commit d60dee1302
4 changed files with 20 additions and 7 deletions

View File

@ -116,7 +116,7 @@ edbin() {
if f="$(which $1 2>/dev/null)" && test -f "$f"
then edit "$f"
else edshell -f "$1"
test $? != 2 || edit "$HOME/.local/bin/scripts/$1"
test $? != 2 || edit "$HOME/.local/bin/${2:-scripts}/$1"
fi
}

View File

@ -1,9 +1,11 @@
test -z "$DISPLAY" || return 0
PATH="$PATH:$HOME/.local/bin/server"
export PATH="$PATH:$HOME/.local/bin/server"
export PROJECTS="$HOME/projects"
test -d "$MUSIC" || export MUSIC="/srv/funkwhale/data/music/janek"
## STACKSPIN
export STACKSPIN="${STACKSPIN:-$HOME/projects/stackspin}"
export STACKSPIN="${STACKSPIN:-$PROJECTS/stackspin}"
_stackspin_cluster_cache=/var/tmp/stackspin-cluster
# Stackspin CLI Wrapper:
@ -78,3 +80,5 @@ stack() {
}
cat "$_stackspin_cluster_cache" 2>/dev/null |
while read cluster; do stack select "$cluster"; done
test "$PWD" = "$HOME" && cde "$PROJECTS/ampache-docker"

View File

@ -4,6 +4,7 @@
# env: MUSIC
test $# -gt 0 && command=$1 && shift
test "$1" = '-v' && verbose='true' && shift || verbose='false'
! test -d "$MUSIC" && echo "No music directory!" && exit 1
case $command in
(update)
for pl; do
@ -24,10 +25,10 @@ case $command in
then shift && i=1; while test $i -le ${1:-9}; do $0 make "${2:-Ω}$i" "empty$i"; ((i++)); done
else echo ${2:-empty} >$1.m3u8
fi;;
(fix) sed -i 's/.*\/musi[kc]/../g';;
(cd) dir=${2:-cd}
mkdir $dir
cat $1 | python -c "import sys, urllib as ul; [sys.stdout.write(ul.unquote_plus(l)) for l in sys.stdin]" | sed '=' | sed -r 's/^[0-9]$/0\0/' | sed -r "N; s/(.*)\n(.*\/[0-9 ]*(.*))/'\2'\n'$dir\/\1 \3'/" | xargs -L 2 cp;;
(fix) sed -i 's/.*\/\(musi[kc]\|janek\)/../g' "$@";;
(cd) dir="${2:-cd}"
mkdir "$dir"
cat "$1" | python -c "import sys, urllib as ul; [sys.stdout.write(ul.unquote_plus(l)) for l in sys.stdin]" | sed '=' | sed -r 's/^[0-9]$/0\0/' | sed -r "N; s/(.*)\n(.*\/[0-9 ]*(.*))/'\2'\n'$dir\/\1 \3'/" | xargs -L 2 cp;;
(*) echo "Unknown subcommand '$1' - Possible subcommands:
update - update file paths for moved songs in a playlist
edit - open playlist in default editor

8
.local/bin/server/ampache Executable file
View File

@ -0,0 +1,8 @@
#!/bin/sh -ex
# Ampache CLI helper
case $1 in
(update) shift; exec $0 "run:updateCatalog" "${@:---import}";;
(*:*|"") command="php -f /var/www/bin/cli";;
esac
sudo docker-compose -f $PROJECTS/ampache-docker/docker-compose.yml exec ampache su www-data -s /bin/sh -c "$command $*"