Audio-Daemon
view release on metacpan or search on metacpan
examples/ad-client.pl view on Meta::CPAN
my $type = shift;
my $msg = shift;
# return if ($type eq 'debug');
my ($line, $function) = (@_)[2,3];
$function = (split '::', $function)[-1];
printf("%6s:%12s %7s:%s\n", $type, $function, '['.$line.']', $msg);
}
my $player = new Audio::Daemon::Client(Server => '127.0.0.1', Port => 9101, Log => \&log);
my $prompt = "Cmd > ";
syswrite(STDOUT, $prompt, length($prompt));
# loop getting lines and sending commands to the server specified above.
while (my $line = <STDIN>) {
chop $line;
if ($line eq 'add') {
#
# Right now, the "Add" command exists to just stick something in the playlist.
#
#
examples/ad-client.pl view on Meta::CPAN
}
}
# print "Sending ".($status->{frame})."\n";
my $tdisplay = format_time($status->{frame});
my @state = ('Stopped', 'Paused', 'Playing');
print " ".$state[$status->{state}]." $tdisplay\n";
print " \"".$status->{title}.'" by '.$status->{artist}."\n";
syswrite(STDOUT, $prompt, length($prompt));
}
sub format_time {
my $frame = shift;
my ($pf,$rf,$ps,$rs) = split ',', $frame;
return (gimme_time($ps).'/'.gimme_time($ps+$rs));
}
sub gimme_time {
my $time = shift;
( run in 1.243 second using v1.01-cache-2.11-cpan-0b5f733616e )