/usr/bin/stream_ttyrec is in libapp-termcast-perl 0.13-2.
This file is owned by root:root, with mode 0o755.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 | #!/usr/bin/perl
eval 'exec /usr/bin/perl -S $0 ${1+"$@"}'
if 0; # not running under some shell
use strict;
use warnings;
use App::Termcast;
use Getopt::Long qw(:config pass_through);
eval { require Term::TtyRec::Plus }
|| die "This script requires the Term::TtyRec::Plus module";
# PODNAME: stream_ttyrec
# ABSTRACT: play a ttyrec to a termcast channel
my ($speed, $clamp, $peek) = (1, undef, 0);
GetOptions(
'speed=f' => \$speed,
'clamp=f' => \$clamp,
'peek' => \$peek,
'nowait' => sub { $clamp = 0 },
);
my $tc = App::Termcast->new_with_options;
my @argv = @{ $tc->extra_argv };
@argv = (\*STDIN) unless @argv;
foreach my $file (@argv) {
my $ttyrec = Term::TtyRec::Plus->new(
(ref($file)
? (filehandle => $file)
: (infile => $file)),
(defined($clamp)
? (time_threshold => $clamp)
: ()),
);
if ($peek) {
my $fh = $ttyrec->filehandle;
seek $fh, 0, 2 unless $fh == \*STDIN;
while (1) {
seek $fh, 0, 1 unless $fh == \*STDIN;
my $frame_ref = $ttyrec->next_frame;
$tc->write_to_termcast($frame_ref->{data})
if $frame_ref;
select undef, undef, undef, 0.1;
}
}
else {
while (my $frame_ref = $ttyrec->next_frame) {
select undef, undef, undef, ($frame_ref->{diff} / $speed);
$tc->write_to_termcast($frame_ref->{data});
}
}
}
__END__
=pod
=encoding UTF-8
=head1 NAME
stream_ttyrec - play a ttyrec to a termcast channel
=head1 VERSION
version 0.13
=head1 SYNOPSIS
stream_ttyrec [options] [ttyrec_file]
=head1 DESCRIPTION
This program will stream a ttyrec file to the given termcast channel. The
ttyrec file may be given on the command line, or it will be read from STDIN.
See L<App::Termcast> for options documentation.
This program also accepts some additional options:
=over 4
=item C<< --speed <n> >>
Set a multiplier for how fast the ttyrec should be played back (C<--speed 2>
means twice as fast).
=item C<< --clamp <n> >>
Set the maximum delay between any two frames in the ttyrec. If unset, there is
no maximum (the ttyrec will be streamed as written).
=item C<< --nowait >>
Disable all delays between frames (equivalent to C<--clamp 0>).
=item C<< --peek >>
"Peek" at a ttyrec that is currently being written. This will seek to the end
of the file and stream new ttyrec frames as they become available.
=back
=head1 AUTHOR
Jesse Luehrs <doy@tozt.net>
=head1 COPYRIGHT AND LICENSE
This software is copyright (c) 2014 by Jesse Luehrs.
This is free software; you can redistribute it and/or modify it under
the same terms as the Perl 5 programming language system itself.
=cut
|