aboutsummaryrefslogtreecommitdiff
path: root/scripts/commands/:play-next
blob: 255fb9f64252c584e41ca4606e0b474d9cd37ec9 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
#!/usr/bin/env bash

musicdir=$HOME/Downloads/music;

ls_songs() {
  cd $musicdir;
  find -follow | while read l; do [[ -f "$l" ]] && echo "$l"; done | sed 's/^\.\///';
}

song=$(ls_songs | sort | dmenu -p "Song :: ");

[[ -z "$song" ]] && exit 1;

mpc insert "file://$musicdir/$song";

[[ "$(~/scripts/music/player.sh get_play_state)" == "Stopped" ]] && mpc play;
update-dwmblock music;