2008/05/17

Automatic Heute-Journal Download

"Heute-Journal" is a german late-night news show on ZDF. You can watch their shows for free both live and on demand at the ZDF-Mediathek.
On Linux you can play them if you've VLC- and Flash-plugins for your browser. But in mine (Firefox-2, 64-bit) it's not possible to pause or forward the playback. That's the reason why I've wrote a small bash script, which downloads yesterday show's mms-link and then uses mplayer to dump the stream into a file. After 5 seconds of downloading the stream, VLC starts an plays the dumpfile.

---------------
#!/bin/bash

YESTERDAY=`date -d yesterday +"%y%m%d"`
ASX="http://wstreaming.zdf.de/zdf/veryhigh/"$YESTERDAY"_hjo.asx"
TMP_PATH=$HOME"/tmp/"
DLINK="hj_link"
HJNAME="heute-journal.wmv"


cd $TMP_PATH

#Catch direct-link
wget -O $DLINK $ASX
#Extract direct-link
LINK=`sed "s/.*href=\"\(mms.*\.wmv\)\".*/\1/" hj_link`


mplayer -dumpstream $LINK -dumpfile heute-journal.wmv & (sleep 5 && vlc $HJNAME &)
---------------

Till now, I haven't figured out, how to tell mplayer to read the .asx-file, so I've to extract the mms-link by myself with sed.

UPDATE: I'm sorry, this Blogger-templates eats my long lines. Here's a Nopaste.

No comments: