Wikia

Music Player Daemon Community Wiki

Hack:prevtitle

525pages on
this wiki
Talk0
  • Description: Small bash script which skips to the previous title if playtime of currently playing title lower than 10 s (time adjustable in script) else it seeks to begin of currently playing title.
  • Intended purpose: Skiping with LIRC or keyboard short keys
  • Additional info: Restore the behavior of older MPD versions (< v0.16).
  • Author: Fux77, inital version: 2010-08-01


  • Code
#!/bin/bash

# PARAMETER
TIME="0:10"

if [[ $(mpc --format %time% | head -n 1) -eq "" ]]; then # check if stream (no total-length)
	mpc prev
else
     if [[ $(mpc | grep "\[playing\]" | awk -F'   ' '{print $2}' | awk -F'/' '{print $1}') < "$TIME" ]]
     then
	     mpc prev
     else
	     mpc seek 0%
     fi
fi

Around Wikia's network

Random Wiki