X-Git-Url: http://git.draconx.ca/gitweb/fvwmconf.git/blobdiff_plain/74a217f96316193daa602b8a5f4a81cc922a42af..25a02c0e784c071a1fd46e38fc11f858f3c6bf64:/scripts/mpdexec.pl diff --git a/scripts/mpdexec.pl b/scripts/mpdexec.pl deleted file mode 100755 index 9c6e069..0000000 --- a/scripts/mpdexec.pl +++ /dev/null @@ -1,40 +0,0 @@ -#!/usr/bin/env perl -# -# Copyright © 2012 Nick Bowler -# -# Simple program to send a command to MPD. The result is printed to standard -# output. -# -# License WTFPL2: Do What The Fuck You Want To Public License, version 2. -# This is free software: you are free to do what the fuck you want to. -# There is NO WARRANTY, to the extent permitted by law. - -use strict; - -use utf8; -use encoding 'utf8'; -use IO::Socket::INET6; - -my $host = $ENV{MPD_HOST} // "localhost"; -my $port = $ENV{MPD_PORT} // 6600; - -my $sock = new IO::Socket::INET6( - PeerAddr => $host, - PeerPort => $port, - Proto => 'tcp', -) or die "failed to connect to MPD: $!"; -binmode($sock, ":utf8"); - -if (!(<$sock> =~ /^OK MPD ([0-9]+)\.([0-9]+)\.([0-9]+)$/)) { - die "MPD failed to announce version: $!"; -} - -print $sock join(' ', @ARGV), "\n"; -while (<$sock>) { - last if (/^OK/); - print; - exit 1 if (/^ACK/); -} - -print $sock "close\n"; -close $sock;