Fandom

Music Player Daemon Community Wiki

Hack:prevtitle

525pages on
this wiki
Add New Page
Talk0 Share
  • 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

Ad blocker interference detected!


Wikia is a free-to-use site that makes money from advertising. We have a modified experience for viewers using ad blockers

Wikia is not accessible if you’ve made further modifications. Remove the custom ad blocker rule(s) and the page will load as expected.

Also on Fandom

Random Wiki