summary refs log tree commit diff
path: root/bin/play-music
blob: 554d93f0f59d90b67db8157d4735e8a724115b34 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
#!/bin/sh
set -eux

music_dir=/run/media/robert/fwdrive/music

mpa() {
	mpv --profile=mpa \
		--directory-filter-types=audio \
		--autocreate-playlist=filter \
		--wayland-app-id=mpv.play-music \
		"$@"
}

case "$1" in
shuffle)
	mpa --shuffle $music_dir
	;;
select)
	cd $music_dir
	subdir=$(find . -type d -printf "%P\n" | shuf | fuzzel -d -w 80)
	mpa "$subdir"
	;;
playlists)
	cd $music_dir
	playlist=$(find . -maxdepth 1 -name '*.m3u' -printf "%P\n" | shuf | fuzzel -d -w 80)
	mpa "$playlist"
	;;
*)
	shift
	mpa "$@"
	;;
esac