diff --git a/.config/shell/functions b/.config/shell/functions index cbaa29d..7a89ba3 100644 --- a/.config/shell/functions +++ b/.config/shell/functions @@ -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 } diff --git a/.config/shell/server b/.config/shell/server index a1bc45d..a0b2d9e 100644 --- a/.config/shell/server +++ b/.config/shell/server @@ -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" diff --git a/.local/bin/scripts/pl b/.local/bin/scripts/pl index 5ec877c..4e07e63 100755 --- a/.local/bin/scripts/pl +++ b/.local/bin/scripts/pl @@ -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 diff --git a/.local/bin/server/ampache b/.local/bin/server/ampache new file mode 100755 index 0000000..2798d9d --- /dev/null +++ b/.local/bin/server/ampache @@ -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 $*" +