a)
C:\Perl64\site\lib\Winamp> winampctl.pl -debug
Name "Class::Maker::Basic::Handler::Attributes::integer" used only once:
possible typo at C:/Perl64/site/lib/Class/Maker.pm line 119.
Unable to connect to winamp/httpQ at
C:\Perl64\site\lib\Winamp\winampctl.plline 53.
I think it happened because I created a password after the installation of
Winamp::Control.
b)
use Winamp::Control;
use IO::Extended qw(printfln);
$main::opts{debug} = 1;
my $winamp = Winamp::Control->new( host => '192.168.1.6', port => '4800' );
$winamp->passwd( 'pitty123' );
if( my $ver = $winamp->getversion )
{
printfln 'Connected to Winamp (Ver: %s)', $ver;
printfln 'Currently playing: %s ', $winamp->getcurrenttitle() if
$winamp->isplaying();
printfln "Current playlist:\n\t", join "\n\t",
$winamp->getplaylisttitle();
$winamp->playfile( a => 'D:\Media\MP3 Goth EBM 80s\Golden Apes -
Denying The Towers Our Words Are Falling From [Full-lenght, 2010]\12 -
Golden Apes - Denying The Towers Our ... - Song Of Innocence.mp3' );
}
This is the result:
D:\Media\Radio\winamp control\Winamp>perl temp.pl
Name "Class::Maker::Basic::Handler::Attributes::integer" used only once:
possibl
e typo at C:/Perl64/site/lib/Class/Maker.pm line 119.
http://192.168.1.6:4800/getversion?p=pitty123
Connected to Winamp (Ver: 0x5065)
http://192.168.1.6:4800/isplaying?p=pitty123
http://192.168.1.6:4800/getcurrenttitle?p=pitty123
Currently playing: 131. The Eden House - Freakshow
http://192.168.1.6:4800/getplaylisttitle?p=pitty123
Current playlist:
http://192.168.1.6:4800/playfile?p=pitty123&a=D%3A%5CMedia%5CMP3+Goth+EBM+80s%5C
Golden+Apes+-+Denying+The+Towers+Our+Words+Are+Falling+From+%5BFull-lenght%2C+20
10%5D%5C12+-+Golden+Apes+-+Denying+The+Towers+Our+...+-+Song+Of+Innocence.mp3
D:\Media\Radio\winamp control\Winamp>
When I paste this url on my browser, I get a zero as a result. It's easy to
find the reason:
1. The second parameter on this url is "a". It should be "file", as
documented on
http://httpq.sourceforge.net/reference.html - but your
example on cpan doc says "a" instead of "file"
2. When I change the parameter from "a" to "file", I get 1 as result. The
file is added to playlist, but Winamp is unable to locate it. This is the
file path that appears on Winamp, it's encoded:
D:\Media\MP3+Goth+EBM+80s\Golden+Apes+-+Denying+The+Towers+Our+Words+Are+Falling+From+[Full-lenght,+2010]\12+-+Golden+Apes+-+Denying+The+Towers+Our+...+-+Song+Of+Innocence.mp3
I created my own module to do this, based on httpQ doc. It just opens a
connection with my local machine on port 4800 using LWP. It's working, but
with bugs that I blame httpQ.
I add 225 files to Winamp, success, Winamp starts playing my music. But if
I do this while some music is playing, and I check the playlist, I get
duplicated entries with the same music that was being played, and I did NOT
enqueue.
These are the main functions that I think it will help you. I think
URI::Encode is a great solution to get rid of issue number 2. And to fix
issue number 1 means just modify the parameter from "a" to "file".
=item enqueuefile
Append a file to the playlist. The file must be in the current working
directory or pass in the directory along with the filename as the argument.
It return 1 on success, 0 otherwise.
Usage:
my $winamp = new Winamp::Controller('192.168.1.6','4800','mypassword');
$winamp->enqueuefile('D:\Media\MP3 Goth EBM 80s\Golden Apes - Denying The
Towers Our Words Are Falling From [Full-lenght, 2010]\10 - Golden Apes -
Denying The Towers Our ... - Invidia.mp3');
=cut
sub enqueuefile($)
{
my $self=shift;
my $filepath=shift;
my $error = validate($self);
return $error if ($error);
my $uri = URI::Encode->new( { encode_reserved => 0 } );
$filepath= $uri->encode($filepath);
my $url="http://
$self->{host}:$self->{port}/playfile?p=$self->{password}&file=$filepath";
#print "$url\n";
my %result = get_url($url);
return $result{error_message} if ( $result{error_message} );
return $result{page_html};
}
sub get_url($)
{
my $url = shift;
my %result;
# MAKES THE REQUEST
my $ua = LWP::UserAgent->new;
my $req = HTTP::Request->new(GET => $url);
$req->content_type('application/x-www-form-urlencoded');
my $res = $ua->request($req);
$result{request_result} = $res->is_success;
if ($res->is_success)
{
$result{page_html} = $res->content;
}
else
{
$result{error_message} = $res->status_line . "\nCheck if Winamp httpQ
service is running.";
}
return %result;
}
Happy new year!
Best regards,
Eduardo Maia
On Wed, Jan 1, 2014 at 3:30 AM, Murat Uenalan via RT <
bug-Winamp-Control@rt.cpan.org> wrote:
Show quoted text> <URL:
https://rt.cpan.org/Ticket/Display.html?id=91753 >
>
> Good,
>
> That you can connect to winamp.
>
> a) Could you please add this line to your command line
>
> $ winampctl.pl —debug …
>
> b) Or please put this line just above your '$winamp->playfile
> $main::opts{debug} = 1;
>
> and sent me the output.
>
> PS: Seems we’ll fix it soon.
>
> Thx,
> M!
>
> On 31 Dec 2013, at 17:16, Eduardo Maia via RT <
> bug-Winamp-Control@rt.cpan.org> wrote:
>
> generated,
> > I just get a 0 as a return.
> >
> > This piece of source works out too, I can connect to Winamp and see what
> is
> > being played:
> > $winamp = Winamp::Control->new( host => $opts{host}, port => $opts{port}
> );
> > if( my $ver = $winamp->getversion )
> > {
> > printfln 'Connected to Winamp (Ver: %s)', $ver;
> > printfln 'Currently playing: %s ', $winamp->getcurrenttitle() if
> > $winamp->isplaying();
> > }
> >
> > About the command line question, I just call perl winamp_control.pl, is
> > there anything else?
> >
> > Thank you!
> >
> > Best regards,
> >
> > Eduardo Maia
> >
> >
> > On Tue, Dec 31, 2013 at 6:24 AM, Murat Uenalan via RT <
> > bug-Winamp-Control@rt.cpan.org> wrote:
> >
> >> <URL:
https://rt.cpan.org/Ticket/Display.html?id=91753 >
> >>
> >> Hi,
> >>
> >> its all about the winamp http plugin mentioned on the docs. Have you
> >> installed it ? What error messages do you get ? How do you call the
> >> commadline ?
> >>
> >> M!
> >> On Dec 31, 2013 6:50 AM, "Eduardo Maia via RT" <
> >> bug-Winamp-Control@rt.cpan.org> wrote:
> >>
> >>> Tue Dec 31 00:50:00 2013: Request 91753 was acted upon.
> >>> Transaction: Ticket created by maia@eduardomaia.com
> >>> Queue: Winamp-Control
> >>> Subject: Winamp-Control-0.2.1
> >>> Broken in: (no value)
> >>> Severity: (no value)
> >>> Owner: Nobody
> >>> Requestors: maia@eduardomaia.com
> >>> Status: new
> >>> Ticket <URL:
https://rt.cpan.org/Ticket/Display.html?id=91753 >
> >>>
> >>>
> >>> Hello there.
> >>>
> >>> I'm using Perl v5.16.3 for MSWin32-x64-multi-thread provided by
> >>> ActiveState, under a Windows Seven 64 bits. My Winamp version is 5.65
> >>> (x86), with Winamp::Control 0.2.1 module.
> >>>
> >>> I don't know if this module is discontinued, anyway... I can connect to
> >>> Winamp using Perl code provided on documentation, but some methods are
> >> not
> >>> working out. For example, $winamp->getinfo and $winamp->playfile.
> >>>
> >>> Thanks in advance.
> >>>
> >>> Best regards,
> >>>
> >>> Eduardo Maia
> >>>
> >>>
> >>
> >>
> >
>
>
>