Archive for July, 2010

Our media server

July 26, 2010 in Personal | Comments (3)

Tags:

I can finally show off my week­end pro­ject! Well okay the vestiges of it star­ted a couple week­ends ago and it bled into this morn­ing by a couple hours, but I think it still counts as a week­end project.

Jasna and I don’t have cable or an antenna for our TV, which means we down­load everything we watch, or bor­row it from friends on rare occa­sions. My Mac­Book was start­ing to run near the end of its use­ful life as my main work com­puter — the track­pad was becom­ing unus­able which meant I couldn’t depend on it when trav­el­ling — but it’s still got some life in it as a server. It was wire­less net­work­ing (no cables to string around), uses very little power, is com­pletely silent, comes with media soft­ware (Front Row) and comes with a remote con­trol, is really small (less than 2cm tall), which makes it more or less the per­fect media server.

The only down­side is it was a pain to get shows onto it to watch, as you have to search for the shows manu­ally, down­load them, then copy them manu­ally over to the server. So, I decided to make a web interface.

Check here for screen­shots of the new web inter­face for the media server. EasyN­ews, our Usenet pro­vider, provides very handy ser­vices like global searches, thumb­nails and AutoUn­RAR­ing. A big bene­fit to this is not hav­ing to wait until some­thing has fin­ished down­load­ing it before watch­ing it. So far I’ve got ser­vices for down­load­ing from Usenet — which is where we get almost all of our TV shows to watch, down­load­ing CFL games from TSN and just upload­ing indi­vidual files from your browser. At some point I need to set up schedul­ing so that it auto­mat­ic­ally down­loads new epis­odes of shows when they’re released, but I guess that’s for another weekend.

I’m kind of embar­rassed at how proud I am to have actu­ally fin­ished it in a week­end like I’d planned, espe­cially con­sid­er­ing I haven’t done any web devel­op­ment in years and years. The astute of you may have noticed I used straight-​​up CGI instead of tech­no­lo­gies the cool kids are using: no love from me for PHP or RoR or Ajax or any­thing. Since I haven’t put any pass­word secur­ity in yet — that’s for another week­end yet — and the box is pub­licly address­able via IPv6 I’ve had access to the web inter­face to just within our local net­work, but if IPv6 takes off some day it’ll be cool to be able to down­load movies while I’m away from home.


Rock Point

July 23, 2010 in Personal | Comments (0)

Tags: , ,

Jasna and I just got back today from a spur-​​of-​​the-​​moment camp­ing trip. We’d been want­ing to have a couple days just for the two of us for a while now, and our sched­ules aligned, so why not? We thought camp­ing would be more fun and relax­ing than any­thing else, and I’ve wanted to see the towns along the Grand River forever, so we com­bined the two and went to Rock Point Pro­vin­cial Park: it’s vir­tu­ally right where the Grand River emp­ties into Lake Erie and neces­sit­ates driv­ing along the Grand River, a fairly nice drive.

I’ve got a grand total of 3 pic­tures from the trip and I’m happy with that. It wasn’t the sort of trip to you take to take pic­tures of. Appar­ently the park is known for its fossils, but we didn’t go hunt­ing for those, either. We went down to the beach a few times — twice for moon­light swims — and spent most of the rest of our time in our camp­site sit­ting around and talk­ing and enjoy­ing one another. We got a nice camp­site with fairly good pri­vacy and shade, and none of the camp­sites dir­ectly around us were taken. It was pretty much the per­fect couple of days, only because we were together.

Jasna bought me an e-​​reader! She actu­ally bought it before we’d planned on going on the trip, but I guess this seemed a good time to give it to me, and give me an easier time read­ing. It’s a Kobo, which I adore. I’m actu­ally a bit of a freak in that I’m some­what anti-​​paper: I often prefer read­ing on screen to read­ing on paper; maybe it’s a side-​​effect of grow­ing up with a com­puter. The Kobo has a really beau­ti­ful dis­play and is easier for me to read than any­thing I’ve ever read from, CRT, LCD or paper. The dis­play can’t refresh very often — maybe once a second or some­thing like that — and it’s super low-​​powered which makes it unsuit­able for any­thing but read­ing, which suits me fine. I have only two com­plaints: firstly, that the font size is typ­ic­ally too big, but that’s a cri­ti­cism of the books that are format­ted for it, not the device itself; and secondly, that it’s really dif­fi­cult to skip for­ward or back­ward a lot of pages at a time. With paper it’s easy to do a bin­ary search for the page you want, but the Kobo seems determ­ined to make you do a lin­ear search.

I did bring my laptop, but only so I could do just enough work to make my guilt levels fall to the point where I could genu­inely relax. It turns out that’s about half an hour, ha! I’m still more or less pleased with how the thesis is progressing.


Watching CFL games on Linux

July 2, 2010 in Personal | Comments (5)

This art­icle is for you if you’re a Cana­dian foot­ball fan, you don’t have cable TV, you use an oper­at­ing sys­tem which doesn’t run Microsoft Sil­ver­light (such as Linux) and you can’t afford to go out to the bar all the time to watch foot­ball games. I may have described only one per­son (myself), but just in case there’s another per­son out there, I will describe to you how to watch your foot­ball games. I should say that while I’m no law­yer, my under­stand­ing is that what I describe here could become illegal should Bill C-​​32 pass, and we all hope it won’t.

The first and most import­ant part is to install rtm­p­dump, a util­ity which you will use to actu­ally down­load the video stream. I’m using a rel­at­ively ancient ver­sion of rtm­p­dump and I don’t think it mat­ters par­tic­u­larly which ver­sion you use.

From there all that is needed is a way to get the rtmp URLs of the game you want. To use the script below, you give it a link to a game you want to down­load — some­thing of the form http://​watch​.tsn​.ca/​c​f​l​-​g​a​m​e​s​-​o​n​-​d​e​m​a​n​d​/​w​e​e​k​-​1​-​a​l​o​u​e​t​t​e​s​-​v​s​-​r​o​u​g​h​r​i​d​e​rs/ (one of the best foot­ball games I’ve seen in a long time, incidentally) — as an argu­ment. It then extracts the clip IDs for each quarter (includ­ing over­time, if needed), determ­ines the rtmp URL for each video clip, and down­loads the video files in sequence.

#!/​bin/​bash
match_​name=$(echo “$1″ | sed ‘s,\(http://.*\)\(week-[^/]*\)\(.*\),\2,’)
q=0
# get through all the videos (quar­ters) linked to by the given game (“epis­ode”)
for i in $(wget –q –O — “$1″ | fgrep ‘#clip’ | sed ‘s/\(.*#clip\)\([0 – 9]*\)\(.*\)/\2/’ | uniq) ; do
        src=$(wget –q –O — “http://​esi​.ctv​.ca/​d​a​t​a​f​e​e​d​/​f​l​v​/​u​r​l​g​e​n​j​s​.​a​s​p​x​?​vid=$i | sed ‘s@\(.*\)\(rtmp://.*\.flv\)\(.*\)@\2@’ | tr –d ‘\n\r ‘)
        echo “sav­ing from $src
        echo “sav­ing to $match_​name-$q.flv“
        rtm­p­dump –r $src –o $match_​name-$q.flv“
        q=$(($q + 1))
done
# cre­ate dummy file so we don’t know before­hand if a game went into over­time
if [ $q –eq 4 ] ; then
        touch $match_​name-$q.flv“
fi

It’s worked well for me but there are cer­tainly no guar­an­tees about it. CTV could break it eas­ily if they so wanted (if you’re read­ing this, CTV, please don’t be mean­ies. Let’s be BFFs). The only unfor­tu­nate down­side to it is that CTV poten­tially loses out on some advert­ising rev­enue. My recom­mend­a­tion is to stare extra hard at the com­mer­cials to make up for it on the days you do go out to the bar to watch a game. Head­ing out to the sta­dium — at the very least whenever the Riders are in town — would also be a nice way to sup­port the league and TSN for put­ting games up online.