forked from sayan01/scripts
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmc
executable file
·58 lines (57 loc) · 1.07 KB
/
mc
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
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
#!/bin/bash
# media control script using playerctl
# the player is chosen from ~/.config/mc.conf if $2 is not passed
# editing ~/.config/mc.conf directly is discouraged, use mc-config instead
# if file is absent then -p is not used while calling playerctl
# Usage:
# mc play
# mc pause
# mc pp
# mc stat / status
# mc stop
# mc next / n
# mc prev / p / previous
# mc meta / metadata
# mc title / tit / t
# mc artist / art / a
# mc titart / ta
# mc arttit / at
confpath="${HOME}/.config/mc.conf"
if [ "$2" != "" ]; then
player="-p $2"
elif [ -r "$confpath" ]; then
player="-p $(head -n1 "$confpath")"
else
player=""
fi
c="playerctl $player"
m="metadata"
mf="metadata --format"
tf="{{title}}"
af="{{artist}}"
case $1 in
play) ;&
pause) ;&
status) ;&
stop) ;&
next) ;&
previous) ;&
"$m") $c "$1";;
pp) $c play-pause;;
stat) $c status;;
n) $c next;;
p) ;&
prev) $c previous;;
meta) $c $m;;
t) ;&
tit) ;&
title) $c $m title;;
a) ;&
art) ;&
artist) $c $m artist;;
ta) ;&
titart) $c $mf "$tf - $af";;
at) ;&
arttit) $c $mf "$af - $tf";;
*) echo "invalid argument";;
esac