blob: 3fa04f3af1429484d1f113128eb825f91cba9d80 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
|
#!/bin/bash
SONG="$(mocp -i | head -n 2 | tail -n 1 | cut -c 7-)"
RUN=0
echo $RUN
if [ -z "$SONG" ] || [ ! -e "$SONG" ]; then
echo "mocp is not currently running or is stopped"
exit
fi
ffmpeg -y -i "$SONG" /tmp/now_playing.jpg
sxiv -b -s f /tmp/now_playing.jpg &
PID=$(echo $!)
while [[ "$RUN" == "0" ]]; do
if [[ $SONG != "$(mocp -i | head -n 2 | tail -n 1 | cut -c 7-)" ]]; then
SONG="$(mocp -i | head -n 2 | tail -n 1 | cut -c 7-)"
ffmpeg -y -i "$SONG" /tmp/now_playing.jpg &
fi
sleep 1
RUN=$(ps --pid $PID; echo $?)
RUN=$(echo $RUN | rev | cut -c 1)
done
|