fewer cables

Post on 18-Nov-2014

2.434 Views

Category:

Technology

1 Downloads

Preview:

Click to see full reader

DESCRIPTION

Find out about hardware, software, protocols, digital video broadcasting, video formats, computer architectures, Perl modules and more as the speaker undertakes the project of a lifetime in his living room: fewer cables.

TRANSCRIPT

Fewer cables

Find out about hardware, so�ware, protocols,digital video broadcasting, video formats,

computer architectures, Perl modules and more asthe speaker undertakes the project of a lifetime in

his living room: fewer cables.Léon Brocard

YAPC::Europe 2009

Me

Léon BrocardFrench, live in LondonLike foodLike the colour orangeFounded Amsterdam.pm, Bath.pm, Croydon.pmLeader of London.pmStarted YAPC::EuropePerl hacker

83 distributions on the CPAN

Acme-Buffy, Acme-Colour, App-Cache, Archive-Peek, Catalyst-Plugin-CookiedSession,Catalyst-Plugin-SimpleAuth, Compress-LZF_PP, Compress-LZMA-External, CPAN-IndexPod,CPAN-Metadata-RDF, CPAN-Mini-Webserver, CPAN-Unpack, Crypt-Skip32-Base32Crockford,Crypt-Skip32-Base64URLSafe, Dackup, Data-Page, Data-UUID-Base64URLSafe,DateTime-Stringify, Devel-ebug, Devel-ebug-HTTP, Devel-Profit, Email-Send-Gandi,Email-Send-Gmail, File-Copy-Reliable, Fir, Games-GuessWord, Git-PurePerl, GraphViz,Haul, HTML-Fraction, HTML-TagCloud, HTTP-Server-Simple-Kwiki, Image-Imlib2,Image-Imlib2-Thumbnail, Image-Imlib2-Thumbnail-S3, Image-WorldMap,Java-JVM-Classfile, JSON-XS-VersionOneAndTwo, Kasago, Language-Functional,LWP-ConnCache-MaxKeepAliveRequests, Mac-EyeTV, MealMaster, Messaging-Courier,Module-CPANTS-Generator, Module-Packaged, MP3-ID3Lib, Net-Amazon-S3,Net-Amazon-SimpleQueue, Net-Cassandra, Net-DPAP-Client, Net-FTP-Throttle, Net-LastFM,Net-Mosso-CloudFiles, Net-MythTV, Net-MythWeb, Net-OpenDHT, Net-Stomp, Net-VNC,Number-DataRate, OpenFrame-Segment-Apache, OpenFrame-Segment-Apache2,Parse-BACKPAN-Packages, Parse-CPAN-Authors, Parse-CPAN-Packages, Parse-CPAN-Ratings,Perl-Metric-Basic, PPIx-IndexOffsets, PPIx-LineToSub, Search-Mousse,String-Koremutake, Template-Plugin-Page, Template-Stash-Strict,Term-ProgressBar-Quiet, Test-Expect, Tie-GHash, Tree-Ternary_XS, TV-Anytime,WWW-Gazetteer, WWW-Gazetteer-FallingRain, WWW-Gazetteer-Getty, WWW-Mechanize-Timed,WWW-Search-Google

�e TV as computer

“�e growth of personal computers is happening sorapidly that the future open-architecture television isthe PC, period. �e set-top box will be acredit-card-size insert that turns your PC into anelectronic gateway for cable, telephone, or satellite. Inother words, there is no TV-set industry in the future.It is nothing more or less than a computer industry:displays �lled with tons of memory and processingpower.”

�e bit radiation business

“�e key to the future of television is to stop thinkingabout television as television. TV bene�ts most fromthinking of it in terms of bits. Motion pictures, too,are just a special case of data broadcast. Bits are bits.”

Anything, anytime, anywhere television

“If your TV could record every program transmitted,you would already have �ve times the selectivityo�ered in the superhighway’s broad-brush style ofthinking. Say, instead of keeping them all, you haveyour TV agent grab the one or two in which youmight have interest, for your future viewing at anytime.”

Dackup

my $source = Dackup::Target::Filesystem->new(prefix => ’/home/acme/important/’ );

my $dest = Dackup::Target::Filesystem->new(prefix => ’/home/acme/backup/’ );

my $dackup = Dackup->new(source => $source,destination => $dest,delete => 0,dry_run => 0,verbose => 1,throttle => ’1Mbps’,

);$dackup->backup;

Dackup targets

Dackup::Target::FilesystemDackup::Target::SSHDackup::Target::S3Dackup::Target::CloudFiles

RTFM

�ere are two main logical elements in a MythTVsystem:

L �e backend contains the TV capture cards, andstores the recorded video. A typical system willcontain at least one backend

L �e frontend is connected to your TV screenand lets you watch LiveTV and recorded shows.It gets its data from the backend

Protocol

C: 21 ANN Playback tigger 0S: 2 OK

C: 48 QUERY_FILETRANSFER 32[]:[]REQUEST_BLOCK[]:[]2048

S: 4 2048

C: 63 QUERY_FILETRANSFER 32[]:[]SEEK[]:[]0[]:[]0[]:[]0[]:[]0[]:[]2048

S: 7 0[]:[]0

Net::MythTV

my $mythtv = Net::MythTV->new();my @recordings = $mythtv->recordings;foreach my $recording (@recordings) {my $filename = $recording->title .’ ’ . $recording->start;

$filename =~ s{[^a-zA-Z0-9]}{_}g;$filename .= ’.mpg’;$mythtv->download_recording($recording, $filename );

}

Scraping is not an API

my $ua = WWW::Mechanize->new;$ua->default_header( ’Accept-Language’=> ’en’ );

$ua->get(’/mythweb/tv/detail/’. "$channel_id/$programme_id");

$ua->submit_form(form_name => ’program_detail’,fields => { record => 1 },button => ’save’,

);

Date formats

# Sun, Jun 14, 10:00 PM to 11:00 PM (75 mins)my $strptime = DateTime::Format::Strptime->new(pattern => ’%Y %a, %b %d, %I:%M %p’,locale => ’en_GB’,on_error => ’croak’,

);

# programme runs over midnightif ( $stop < $start ) {

$stop->add( days => 1 );}

Modern scraping

my $tree = HTML::TreeBuilder::XPath->new;my $html = $response->decoded_content;$tree->parse_content( $html );my $nodeset =

$tree->findnodes(’//tr[@class="recorded"]’);foreach my $row ( $nodeset->get_nodelist ) {next if $row->as_HTML =~ /Still Recording/;...

);

Net::MythWeb

my $programme = $mythweb->programme( $channel,$start_as_datetime );

$programme->record;

my @recordings = $mythweb->recordings;foreach my $recording ( @recordings ) {

$recording->download("recording.mpg");}

Success

“�e project has been a great success, delivered onschedule, within budget and with only a littlethreatening to give up and start again from scratch”— Andrea

top related