Wikia

Music Player Daemon Community Wiki

Hack:Mpc-relseek.pl

525pages on
this wiki
Talk0

This script is obsolete because it's functionality is included to mpc-0.11.2

This perl-script allows you to seek backward/forward for particular time in seconds.

Usage:

mpc-relseek.pl <time>

<time> is time to seek in seconds. To seek backward, use negative values.

#!/usr/bin/perl

$status=`mpc`;

$delta_t=$ARGV[0] || "5";

if($status=~/\[playing\] +\#\d+\/\d+ +(\d+):(\d+) \((\d+)\%\)/)
{
       $percent=$3/100;
       $time_secs=$1*60+$2;

       $alltime=$time_secs/$percent;

       $newtime=$time_secs+$delta_t;
       $newpercent=int($newtime/$alltime*100);
       system("mpc seek $newpercent");
}

Around Wikia's network

Random Wiki