summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJesse Luehrs <doy@tozt.net>2010-04-18 16:53:00 -0500
committerJesse Luehrs <doy@tozt.net>2010-04-18 16:53:00 -0500
commit0f592e5cc31a442e282c29352082b0478c8878ab (patch)
treed7d0ebe0fba1b289497bc11a3f9f8d7a9a9673db
parent4a3506e0e8e1a7bd5173e0dc4136b13b75cb3b45 (diff)
downloadapp-termcast-0f592e5cc31a442e282c29352082b0478c8878ab.tar.gz
app-termcast-0f592e5cc31a442e282c29352082b0478c8878ab.zip
add ttyrec streamer
-rw-r--r--bin/stream_ttyrec50
1 files changed, 50 insertions, 0 deletions
diff --git a/bin/stream_ttyrec b/bin/stream_ttyrec
new file mode 100644
index 0000000..13e0635
--- /dev/null
+++ b/bin/stream_ttyrec
@@ -0,0 +1,50 @@
+#!/usr/bin/env perl
+use strict;
+use warnings;
+use App::Termcast;
+eval { require Term::TtyRec::Plus }
+ || die "This script requires the Term::TtyRec::Plus module";
+
+=head1 NAME
+
+stream_ttyrec - play a ttyrec to a termcast channel
+
+=head1 SYNOPSIS
+
+ stream_ttyrec [options] [ttyrec_file]
+
+=head1 DESCRIPTION
+
+See L<App::Termcast> for options documentation. 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.
+
+=cut
+
+my $tc = App::Termcast->new_with_options;
+my ($file) = @{ $tc->extra_argv };
+
+my $fh;
+if (defined($file)) {
+ open $fh, '<', $file or die "Couldn't open ttyrec $file for reading: $!";
+}
+else {
+ $fh = \*STDIN;
+}
+
+my $ttyrec = Term::TtyRec::Plus->new(filehandle => $fh);
+while (my $frame = $ttyrec->next_frame) {
+ select undef, undef, undef, $frame->{diff};
+ $tc->write_to_termcast($frame->{data});
+}
+
+=head1 AUTHOR
+
+ Jesse Luehrs <doy at tozt dot net>
+
+=head1 COPYRIGHT AND LICENSE
+
+This software is copyright (c) 2009-2010 by Jesse Luehrs.
+
+This is free software; you can redistribute it and/or modify it under
+the same terms as perl itself.