config/shell: export music directory globally

This commit is contained in:
xeruf 2021-10-17 12:23:29 +02:00
parent 04cfa88b27
commit bf1fd1dbb4
4 changed files with 12 additions and 10 deletions

View File

@ -1,5 +1,3 @@
export DATA="$(test -d $HOME/data && echo $HOME/data || echo $HOME/daten)"
export MUSIC="$DATA/music"
export AUDIO="$DATA/audio" export AUDIO="$DATA/audio"
MUSIC_RAW="$AUDIO/songs/_raw" MUSIC_RAW="$AUDIO/songs/_raw"

View File

@ -1,12 +1,14 @@
#!/bin/sh -e #!/bin/sh -e
# launch my focus playlist # launch my focus playlist or find a matching playlist or song files
playlistPath="$MUSIC/Playlists" # depends: mp mpc
# env: MUSIC
PLAYLISTS="$MUSIC/Playlists"
mpc clear mpc clear
if test -z "$1" if test -z "$1"
then mp -q "$playlistPath/focus.m3u" then mp -q "$PLAYLISTS/focus.m3u"
else else
(find -L $playlistPath -iname "focus-$1.m3u" -print0 | grep --null-data . || (find -L $PLAYLISTS -iname "focus-$1.m3u" -print0 | grep --null-data . ||
find -L $playlistPath -iname "$1.m3u*" -print0 | grep --null-data . || find -L $PLAYLISTS -iname "$1.m3u*" -print0 | grep --null-data . ||
find -L $MUSIC -iname "*$1*" -prune -exec find {} -size +2M -type f -not -iregex ".*.\(jpe?g\|png\)" -print0 \; ) | find -L $MUSIC -iname "*$1*" -prune -exec find {} -size +2M -type f -not -iregex ".*.\(jpe?g\|png\)" -print0 \; ) |
xargs -0 mp -q xargs -0 mp -q
fi fi

View File

@ -1,6 +1,6 @@
#!/bin/sh #!/bin/sh
# Play given files on mpd, enabling playing of external files through symlinking and recursively resolving playlists # Play given files on mpd, enabling playing of external files through symlinking and recursively resolving playlists
# depends: xargs mpc realpath # depends: xargs realpath mpc
# env: MUSIC # env: MUSIC
MUSIC="${MUSIC:-$(cat ${XDG_CONFIG_HOME:-$HOME/.config}/mpd/mpd.conf | grep music_directory | cut -d'"' -f2 | sed "s|~|$HOME|")}" MUSIC="${MUSIC:-$(cat ${XDG_CONFIG_HOME:-$HOME/.config}/mpd/mpd.conf | grep music_directory | cut -d'"' -f2 | sed "s|~|$HOME|")}"
PLAYLISTS="$MUSIC/Playlists" PLAYLISTS="$MUSIC/Playlists"
@ -31,5 +31,5 @@ else
{ "$0" -r "$@" && mpc -q update --wait; } | #>/tmp/mp 2>&1 { "$0" -r "$@" && mpc -q update --wait; } | #>/tmp/mp 2>&1
xargs --delim='\n' mpc insert xargs --delim='\n' mpc insert
mpc ${quiet:-$next} play mpc ${quiet:-$next} play
test -n "$next" && mpc $quiet next test -z "$next" || mpc $quiet next
fi fi

View File

@ -1,5 +1,7 @@
export DATA="$(test -d $HOME/data && echo $HOME/data || echo $HOME/daten)"
export MUSIC="$DATA/music"
# xdg # xdg
export DATA="$HOME/data"
export XDG_DATA_HOME="$HOME/.local/share" export XDG_DATA_HOME="$HOME/.local/share"
export XDG_STATE_HOME="$HOME/.local/state" export XDG_STATE_HOME="$HOME/.local/state"
export XDG_CACHE_HOME="$HOME/.local/cache" export XDG_CACHE_HOME="$HOME/.local/cache"