Skip to content

Embed URL

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Watch YAPC::NA with VLC
#! /usr/bin/perl
# USAGE: yapc-vlc [-d|--dump] ROOM
# where ROOM is L, V, 313, or 325
# add a -d or -dump there to dump the stream to a file
use 5.10.0;
use strict;
use warnings;
use IPC::Cmd qw[can_run];
use List::Util qw(first);
use HTML::TreeBuilder 5 -weak;
use Getopt::Long;
my $player = first { can_run($_) } qw(vlc vlc.exe mplayer mplayer.exe wmplayer.exe);
# use -d or -dump to save the stream locally
GetOptions( "dump|d" => \(my $dump));
my($dump_opts);
if($dump) {
(my $dump_file = localtime ) =~ s/\W/_/g;
for($player) {
when(/vlc/) {
$dump_opts = "--sout '#duplicate{dst=display,dst=std{access=file,mux=raw,dst=$dump_file.asf}'"
}
when(/mplayer/){
$dump_opts = "-dumpstream -dumpfile $dump_file.asf"
}
default {
# i have no idea on how to dump a stream with other players -- nuba
}
}
}
my %room = (
l => '1de9c319-010c-4585-8617-210873935dfa',
325 => '90b5b79a-ceb6-4084-8cca-8977ff1aa729',
313 => '1c56eaf7-1178-4cb9-bf47-53e717ea74c2',
v => '5b80d7ae-5fc7-46c4-98ba-5f770a8be940',
);
my $catalog =
'http://ics.webcast.uwex.edu/mediasite/Catalog/pages/catalog.aspx?catalogId='
. ($room{lc shift} || die "Room must be l v 313 325");
my $tree = HTML::TreeBuilder->new_from_url($catalog);
my $url =
$tree->look_down(qw(_tag span class PresentationCard_OnAir))
->look_up(qw(_tag tr))
->look_down(qw(_tag a href) =>
qr!^http://ics\.webcast\.uwex\.edu/mediasite/Viewer!)
->attr('href');
my @parts = ($url =~ /peid=(\w{8})(\w{4})(\w{4})(\w{4})(\w+)\w\w\z/)
or die;
my $new = "http://video.ics.uwex.edu/" . join('-', @parts);
#use 5.010; say $new; exit;
if ($^O =~ /Win32/) {
system start => $player, $dump_opts, $new;
} else {
system "$player $dump_opts $new"
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.