PageRenderTime 101ms CodeModel.GetById 89ms app.highlight 9ms RepoModel.GetById 1ms app.codeStats 0ms

/sketch/convert.pl

http://github.com/motemen/Teto
Perl | 17 lines | 14 code | 3 blank | 0 comment | 0 complexity | 5a0776fd3c093b15a76c2fc444b0ea0a MD5 | raw file
 1use strict;
 2use warnings;
 3use lib 'lib';
 4use Teto::Track;
 5use Teto::Buffer;
 6use Perl6::Say;
 7
 8my $url = shift or die "Usage: $0 url\n";
 9my $track = Teto::Track->from_url($url) or die;
10
11my $buffer = Teto::Buffer->new(min_buffer_size => 0);
12$track->buffer($buffer);
13$track->play;
14
15my ($fh, $filename) = $track->tempfile(SUFFIX => '.mp3');
16say "$url -> $filename";
17print $fh $buffer->buffer;