hughbarnard

Using Expect with Tidal

Apr 22nd, 2021 (edited)
55
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #!/usr/bin/perl
  2.  
  3. use strict ;
  4. use Expect;
  5.  
  6. # if you prefer the OO mindset:
  7. my $exp = new Expect;
  8. my $command = 'tidal' ;
  9.  
  10. $exp->raw_pty(1);
  11.  
  12. $exp->spawn($command)
  13.   or die "Cannot spawn $command: $!\n";
  14. $exp->expect( undef, ('Connected to SuperDirt.') );
  15. $exp->expect( 20, ('tidal> ') );
  16.  
  17. $exp->send("d1 \$ sound \"bd sn\"\n");
  18.  
  19. sleep 10;
  20. exit 0;
RAW Paste Data