diff options
Diffstat (limited to 'lib/Vlc')
-rw-r--r-- | lib/Vlc/Client.rakumod | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/lib/Vlc/Client.rakumod b/lib/Vlc/Client.rakumod index 3620d47..5b19c53 100644 --- a/lib/Vlc/Client.rakumod +++ b/lib/Vlc/Client.rakumod @@ -20,8 +20,9 @@ class Vlc::Client { has Cro::HTTP::Client $!vlc; has Str $.password is required; has Str $.base-uri = 'http://127.0.0.1:8080/requests/'; + has IO::Path() $.mrl-root = '/'; - method !call-vlc(Str $path, *%args) { + method !call-vlc(Str:D $path, *%args) { $!vlc ||= Cro::HTTP::Client.new( auth => { :username(), :password(self.password) }, add-body-parsers => [ Cro::BodyParser::VlcXML ], @@ -34,10 +35,17 @@ class Vlc::Client { ); } - method command(Str $command, *%args) { + method command(Str:D $command, *%args) { return self!call-vlc('status.xml', :$command, |%args); } + method play-file(Str:D :$path, Str:D :$name) { + return self.command( + 'in_play', + input => self.mrl-root.child($path).child($name), + ); + } + method status() { my $res = await self!call-vlc('status.xml'); my XML::Document $status = await $res.body; |