This file is indexed.

/usr/bin/mptoggle is in mpdtoys 0.24.

This file is owned by root:root, with mode 0o755.

The actual contents of the file can be viewed below.

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
#!/usr/bin/perl
use strict;
use warnings;
use Audio::MPD q{0.19.0};

=head1 NAME

mptoggle - single button control for mpd

=head1 SYNOPSIS

mptoggle [host] [playlist ...]

=head1 DESCRIPTION

B<mptoggle> allows mpd to be controlled by a single physical button. It 
was designed for a linksys nslu2 running mpd, for which the only available
physical control is a power button that can be remapped to run an arbitrary
program.

B<mptoggle> toggles playback each time it's run. So press the button once
to start, and a second time to stop. Each time it starts playing. By
default it selects a new different playlist, at random, to play. If
playlist names are specified at the command line, it will choose between
those at random.

Example of how to make the nslu2's power button run mptoggle, in
/etc/inittab:

	ca:12345:ctrlaltdel:/usr/bin/mptoggle localhost

=head1 SEE ALSO

mprompt(1) mpd(1)

=head1 AUTHOR

Copyright 2007 Joey Hess <joey@kitenet.net>

Licensed under the GNU GPL version 2 or higher.

http://kitenet.net/~joey/code/mpdtoys

=cut

if (@ARGV) {
	$ENV{MPD_HOST}=shift;
}
my $mpd=Audio::MPD->new(conntype => "reuse");

if ($mpd->status->state ne 'play') {
	$mpd->playlist->clear;
	my @playlists;
	if (@ARGV) {
		@playlists=@ARGV;
	}
	else {
		@playlists=$mpd->collection->all_playlists;
	}
	$mpd->playlist->load($playlists[rand @playlists]);
	$mpd->play;
}
else {
	$mpd->pause;
}