Fandom

Music Player Daemon Community Wiki

Hack:mpc-show-playlist

525pages on
this wiki
Add New Page
Talk0 Share

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.

#!/usr/bin/perl
# mpc playlist wrapper, tested with mpc 0.18.
# License: GPLv3, see http://www.gnu.org/licenses/gpl.txt

use warnings;
use strict;

my $song = 0;
open(SONG, "mpc status |");
while(<SONG>) {
    #if(/\^+\] #(\d+)/) {
    if(/#(\d+)/) {
	$song = $1;
    }
}

#die unless defined($song);
my $n = 0;
open(PLAYLIST, "mpc playlist |");
while(<PLAYLIST>) {
    $n++;
    if($n==$song) {
	printf "\e[31;2m> %3d %s\e[31;0m", $n, $_;
    } else {
	printf "  %3d %s", $n, $_;
    };
}

Also on Fandom

Random Wiki