Remove music script
Signed-off-by: Severin Kaderli <severin@kaderli.dev>
This commit is contained in:
parent
1ecc9bf7e3
commit
e082250de0
1 changed files with 0 additions and 36 deletions
|
@ -1,36 +0,0 @@
|
|||
#!/usr/bin/env bash
|
||||
#
|
||||
# SCRIPT NAME:
|
||||
# music
|
||||
#
|
||||
# AUTHOR:
|
||||
# Severin Kaderli <severin@kaderli.dev>
|
||||
#
|
||||
# DESCRIPTION:
|
||||
# Prints out the title of the current playing song using cmus-remote.
|
||||
#
|
||||
# USAGE:
|
||||
# ./music
|
||||
|
||||
QUERY="$(cmus-remote -Q)"
|
||||
|
||||
STATUS="$(echo "$QUERY" | grep -e "status " | cut -d " " -f 2)"
|
||||
ARTIST="$(echo "$QUERY" | grep -e " artist " | cut -d " " -f 3-)"
|
||||
ALBUM="$(echo "$QUERY" | grep -e " album " | cut -d " " -f 3-)"
|
||||
TITLE="$(echo "$QUERY" | grep -e " title " | cut -d " " -f 3-)"
|
||||
position="$(echo "$QUERY" | grep -e "position " | cut -d " " -f 2)"
|
||||
duration="$(echo "$QUERY" | grep -e "duration " | cut -d " " -f 2)"
|
||||
|
||||
if [ "$STATUS" != "playing" ]; then
|
||||
OUTPUT="Not playing"
|
||||
else
|
||||
pos_minutes=$(printf "%02d" $(("$position" / 60)))
|
||||
pos_seconds=$(printf "%02d" $(("$position" % 60)))
|
||||
|
||||
dur_minutes=$(printf "%02d" $(("$duration" / 60)))
|
||||
dur_seconds=$(printf "%02d" $(("$duration" % 60)))
|
||||
|
||||
OUTPUT="$ARTIST | $ALBUM | $TITLE | $pos_minutes:$pos_seconds / $dur_minutes:$dur_seconds"
|
||||
fi
|
||||
|
||||
echo "$OUTPUT"
|
Loading…
Add table
Add a link
Reference in a new issue