shell/mpd: fix + move scripts + fix (z)sh PATH

This commit is contained in:
Henrik Lissner 2016-12-25 19:08:06 -05:00
parent b71a011b8c
commit 061c25f4fc
13 changed files with 96 additions and 25 deletions

View file

@ -1,3 +0,0 @@
# Scripts
A collection of personal scripts.

View file

@ -1,14 +0,0 @@
#!/usr/bin/env bash
if ! pgrep mpd >/dev/null; then
>&2 echo "mpd isn't running."
exit 1
fi
info=$(mpc current)
if [[ -z $info ]]; then
>&2 echo "nothing is playing."
exit
fi
notify-send --icon="media-playback-start" --app-name="ncmpcpp" "Now playing" "$info"

View file

@ -1,6 +1,6 @@
# Loaded at the end of the initialization process # Loaded at the end of the initialization process
export PATH="$DOTFILES/bin:$DOTFILES/scripts:$HOME/bin:$PATH" export PATH="$HOME/.bin:$DOTFILES/bin:$PATH"
# #
export EDITOR=$(is-callable nvim && echo 'nvim' || echo 'vim') export EDITOR=$(is-callable nvim && echo 'nvim' || echo 'vim')

View file

@ -0,0 +1,25 @@
music_directory "~/music"
playlist_directory "~/music/.db/playlists"
db_file "~/music/.db/db"
log_file "~/.config/mpd/mpd.log"
pid_file "~/.config/mpd/mpd.pid"
state_file "~/.config/mpd/mpdstate"
gapless_mp3_playback "yes"
restore_paused "yes"
bind_to_address "127.0.0.1"
port "6600"
audio_output {
type "alsa"
name "my_alsa"
}
audio_output {
enabled "no"
type "fifo"
name "my_fifo"
path "/tmp/mpd.fifo"
format "44100:16:2"
}

View file

@ -0,0 +1,27 @@
music_directory "~/Music/"
playlist_directory "~/Music/.db/playlists"
db_file "~/Music/.db/db"
log_file "~/.config/mpd/mpd.log"
pid_file "~/.config/mpd/mpd.pid"
state_file "~/.config/mpd/mpdstate"
gapless_mp3_playback "yes"
restore_paused "yes"
bind_to_address "127.0.0.1"
port "6600"
user "hlissner"
audio_output {
type "osx"
name "CoreAudio"
mixer_type "software"
}
audio_output {
enabled "no"
type "fifo"
name "my_fifo"
path "/tmp/mpd.fifo"
format "44100:16:2"
}

1
shell/mpd/.gitignore vendored Normal file
View file

@ -0,0 +1 @@
.config/mpd/mpd.conf

View file

@ -2,7 +2,7 @@
ncmpcpp_directory = ~/.ncmpcpp ncmpcpp_directory = ~/.ncmpcpp
## Directory for storing downloaded lyrics. ## Directory for storing downloaded lyrics.
#lyrics_directory = ~/.lyrics lyrics_directory = ~/music/.db/lyrics
##### connection settings ##### ##### connection settings #####
#mpd_host = localhost #mpd_host = localhost
@ -241,7 +241,7 @@ selected_item_prefix = +$6
## tag and then composer and performer if previous ones are ## tag and then composer and performer if previous ones are
## not available. ## not available.
## ##
song_columns_list_format = (5f)[green]{NEr} (45)[white]{t|f:Title} (8f)[magenta]{lr} (20)[]{a|A:Artist} (25)[cyan]{b} song_columns_list_format = (2f)[green]{CEr:_} (3f)[green]{NEr:#} (45)[white]{t|f:Title} (8f)[magenta]{lr} (20)[]{a|A:Artist} (25)[cyan]{b}
# #
##### various settings ##### ##### various settings #####
# #
@ -249,7 +249,7 @@ song_columns_list_format = (5f)[green]{NEr} (45)[white]{t|f:Title} (8f)[magenta]
## Note: Custom command that will be executed each ## Note: Custom command that will be executed each
## time song changes. Useful for notifications etc. ## time song changes. Useful for notifications etc.
## ##
execute_on_song_change = "notify-song.sh" execute_on_song_change = "notify-song"
#playlist_show_mpd_host = no #playlist_show_mpd_host = no
playlist_show_remaining_time = yes playlist_show_remaining_time = yes
playlist_shorten_total_times = yes playlist_shorten_total_times = yes

3
shell/mpd/README.md Normal file
View file

@ -0,0 +1,3 @@
# mpd + mpc + ncmpcpp
My music player stack, fit for Arch and MacOS.

12
shell/mpd/aliases.zsh Normal file
View file

@ -0,0 +1,12 @@
if [[ $OSTYPE == darwin* ]]; then
alias mpdi='mpd ~/.config/mpd/mpd.conf'
fi
mpca() {
local files=()
for file in $@; do
files+="$(realpath --relative-to="$HOME/music" "$file")"
done
mpc add ${files[@]}
}

21
shell/mpd/bin/notify-song Executable file
View file

@ -0,0 +1,21 @@
#!/usr/bin/env bash
if ! pgrep mpd >/dev/null; then
>&2 echo "mpd isn't running."
exit 1
fi
info=$(mpc current)
if [[ -z $info ]]; then
>&2 echo "nothing is playing."
exit
fi
case $OSTYPE in
darwin*)
terminal-notifier -title "Now playing" -message "$info" -appIcon "/Applications/iTunes.app/Contents/Resources/iTunes.icns"
;;
linux*)
notify-send --icon="media-playback-start" --app-name="ncmpcpp" "Now playing" "$info"
;;
esac

View file

@ -3,8 +3,8 @@
case $OSTYPE in case $OSTYPE in
darwin*) darwin*)
brew install mpd mpc brew install mpd mpc
brew install ncmpcpp --with-clock --with-visualizer brew install ncmpcpp --with-clock --with-visualizer --with-outputs
brew services start mpd ln -sfv $HOME/.config/mpd/mpd-osx.conf $HOME/.config/mpd/mpd.conf
;; ;;
linux*) linux*)
if [[ -f /etc/arch-version ]]; then if [[ -f /etc/arch-version ]]; then
@ -12,5 +12,6 @@ case $OSTYPE in
systemctl enable --user mpd.service systemctl enable --user mpd.service
systemctl start --user mpd.service systemctl start --user mpd.service
fi fi
ln -sfv $HOME/.config/mpd/mpd-linux.conf $HOME/.config/mpd/mpd.conf
;; ;;
esac esac

View file

@ -8,8 +8,6 @@ path=( /usr/local/{,s}bin $path )
load shell/zsh/config.zsh load shell/zsh/config.zsh
loadall env.zsh loadall env.zsh
path=( $HOME/.bin $DOTFILES/bin $path )
fpath=( fpath=(
$DOTFILES/shell/zsh/{completions,functions} $DOTFILES/shell/zsh/{completions,functions}
$fpath $fpath