#!/usr/bin/env sh case "$1" in shuf) mpc random on && notify-send "Shuffle enabled" && exit 0 ;; shufno) mpc random off && notify-send "Shuffle disabled" && exit 0 ;; next) mpc next ;; prev) mpc prev ;; current) mpc current && exit 0 ;; info) song_file=$(mpc --format '%file%' current) song_dir=$(dirname "/home/coast/Music/$song_file") cover=$(find "$song_dir" -maxdepth 1 \( -iname '*cover*.jpg' -o -iname '*cover*.png' -o -iname '*folder*.jpg' -o -iname '*folder*.png' -o -iname '*front*.jpg' -o -iname '*front*.png' \) | head -n 1) [ -z "$cover" ] && cover="/usr/share/icons/hicolor/48x48/apps/musical-note.png" notify-send "Currently Playing" "$(mpc current)" -i "$cover" && exit 0 ;; search) choice=$(mpc --format '%title% - %artist% - %album%\t%file%' search any "" \ | rofi -dmenu -i -p "Search music" -display-columns 1) [ -z "$choice" ] && exit 0 file=$(printf '%s' "$choice" | cut -f2) [ -z "$file" ] && exit 0 mpc clear && mpc add "$file" && mpc play && exit 0 ;; esac mpc play mpc volume 15 song_file=$(mpc --format '%file%' current) music_dir="/home/coast/Music" song_abs="$music_dir/$song_file" song_dir=$(dirname "$song_abs") cover=$(find "$song_dir" -maxdepth 1 \( -iname '*cover*.jpg' -o -iname '*cover*.png' -o -iname '*folder*.jpg' -o -iname '*folder*.png' -o -iname '*front*.jpg' -o -iname '*front*.png' \) | head -n 1) [ -z "$cover" ] && cover="/usr/share/icons/hicolor/48x48/apps/musical-note.png" notify-send "Now playing..." "$(mpc current)" -i "$cover"