/usr/share/doc/libaudio-mpd-perl/examples/example.pl is in libaudio-mpd-perl 1.120610-1.
This file is owned by root:root, with mode 0o644.
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 | #!/usr/bin/perl -w
#
# This file is part of Audio-MPD
#
# This software is copyright (c) 2007 by Jerome Quelin.
#
# This is free software; you can redistribute it and/or modify it under
# the same terms as the Perl 5 programming language system itself.
#
use strict;
use Data::Dumper;
use Audio::MPD;
### NOTE! ###
# THIS SCRIPT DOES NOT CONTAIN ERRORHANDLING, AND MAY THEREFORE FAIL ON
# CERTAIN ACTIONS
############
#my $x = MPD->new('localhost',2100); # Do this for specifing server and/or port.
my $x = Audio::MPD->new('localhost', 6601);
print "Example: Shows Audio::MPD used to write mpc-like output\n\n";
print($x->get_title,"\n");
print("[".$x->{state}."] #".($x->{song} || 'n/a')."/".$x->{playlistlength}." ".$x->get_time_format."\n");
print("volume: ".$x->{volume}."% repeat: ".$x->{repeat}." random: ".$x->{random}."\n");
print "\n\nExample: Shows list of all files, directories and playlists in a specific directory.\n";
my @array = $x->listallinfo('Misc');
foreach(@array)
{
print $_->{'file'} || $_->{'directory'} || $_->{'playlist'},"\n";
}
print "\n\nExample: Shows how to get information from the playlist. \@playlist is a reference, so don't change it :)\n\n";
my $playlist = $x->playlist;
print "Song 1 filename: ".$playlist->[1]{'file'}."\n";
print "Song 2 time: ".$playlist->[2]{'Time'}." seconds\n";
my $foo = $x->get_time_info;
print "Current song info: \n";
print "Minutes: ".$foo->{'minutes_so_far'}."\n";
print "Seconds: ".$foo->{'seconds_so_far'}."\n";
|