XBMC with Canal Digital Norway using tvheadend/oscam for crypted channels on Gentoo

So I decided to set up DVB support on my XBMC, so that i can use XBMC for all my media needs. With oscam, the only hardware we need is a DVB-C card and a cheap PCSC smart card reader.

My TV card is a TerraTecCinergy C DVB-C.
My Smartcard reader is a SDI010 (works with CCID).
I did this on gentoo but it should be just as easy on most Linux OS.

The process

First you need to install CCID and pcsc-lite:

1
emerge -av pcsc-lite ccid

On gentoo PCSC daemon will auto start when you plug in the USB reader if you add this to /etc/rc.conf:

1
rc_hotplug="pcscd"

Else you might need to start the service.

Checkout oscam source:

1
2
svn co http://www.streamboard.tv/svn/oscam/trunk oscam
cd oscam

Now let’s build oscam with PCSC support:

1
make pcsc-libusb

Now configure oscam:

1
mkdir /usr/local/etc

Contents of /usr/local/etc/oscam.conf:

1
2
3
4
5
6
7
8
9
10
11
12
[global]
nice = -1
WaitForCards = 1
logfile = /tmp/oscam.log
usrfile = /tmp/oscamuser.log
cwlogdir = /tmp/cw
[webif]
httpport = 8888
httpallowed = 127.0.0.1
[newcamd]
key = 0102030405060708091011121314
port = 32000@0B00:000000

Note that you should change key to something more non-predictable.

Contents of /usr/local/etc/oscam.server:

1
2
3
4
5
6
7
8
9
[reader]
label                 = canaldigital
protocol              = pcsc
device                = 0
caid                  = 0B00
detect                = cd
ident                 = 0B00:000000
group                 = 1
emmcache              = 1,3,2

Contents of /usr/local/etc/oscam.user:

1
2
3
4
5
6
7
8
[account]
user = tvheadend
pwd = tvheadend
uniq = 0
group = 1
ident = 0B00:000000
caid = 0B00
au = canaldigital

Note that you should change user/pwd.

Run oscam:

1
./Distribution/oscam-1.20-unstable_*-libusb-pcsc

You can see its output from /tmp/oscam.log

Install and start tvheadend:

1
2
emerge -av tvheadend
/etc/init.d/tvheadend start

  1. Browse to http://localhost:9981/
  2. Go to Configuration -> Code word client
  3. Add entry
  4. Hostname: your ip
  5. Port: 32000
  6. Username: tvheadend
  7. Password: tvheadend
  8. DES Key: 01:02:03:04:05:06:07:08:09:10:11:12:13:14
  9. Check Enabled and Update card.
  10. Save

Now you can install XBMC tvheadend addon, plugin the smart card and, in theory just start watching TV!

(For XBMC addons i used this ebuild: http://data.gpo.zugaina.org/vdr-devel/media-plugins/xbmc-addon-pvr/xbmc-addon-pvr-9999.ebuild)

References

http://www.satnigmo.com/900/canaldigital-nordic-oscam-config/
http://cardshare-viasat-canaldigital.blogspot.no/2012/08/oscam-config-oscamserver.html
http://www.streamboard.tv/oscam/wiki/CardsList
https://tvheadend.org/projects/tvheadend/wiki/Tvheadend_oscam_ziggo

Building/installing libcec 2 on Raspberry PI

Tested on Raspbian wheezy

On your linux computer

From https://github.com/Pulse-Eight/libcec/tags download libcec-2.0.5-repack.
Apply this patch to configure.ac: https://github.com/vulpesvelox/libcec/commit/3671569235896a7ed448384ea6777a981fd49be9.

1
2
tar xvf libcec-2.0.5-repack.tar.gz && cd libcec-libcec-2.0.5-repack
./project/RPi/build.sh "${PWD}"/project/RPi/build

On the PI

1
apt-get install rsync

On your linux computer

1
2
rsync -avz -e ssh project/RPi/build pi@192.168.1.121:
rsync -avz -e ssh project/RPi/deps/lib/liblockdev.* pi@192.168.1.121:build/lib

On the PI

1
2
cp -a build/* /usr/local/
/usr/local/bin/cec-client

Fun time!

hls-vod - HTTP Live Streaming with on-the-fly encoding of any video file

HTTP Live Streaming with on-the-fly encoding of any video file for Apple TV/iPhone/iPad/iPod and possibly other devices.

hls-vod lets you stream your whole video collection on-demand, regardless of format (as long as VLC can transcode it), to your iOS devices, playable from Safari, working AirPlay as well.

It is built on node.js.

Usage:

1
2
npm i -g hls-vod
hls-vod --root-path /path/to/my/videos

iOS Web App cache manifest + self-signed SSL problem

So I am making a HTTPS HTML5 Web App, and I was having problems getting HTML5 Application Cache working on iOS when adding the App to home screen. In Chrome and Safari Mobile everything was working fine, but when i added the App to the Home Screen, NETWORK resources stopped working. After hours of de-hairing, I figured out that the problem was that I was using a self-signed SSL certificate.
Since this is just an internal web app for controlling my home, I didn’t want to pay for an SSL certificate for each of my subdomains, so I created my own CA-certificate. I linked this with my server SSL certificate for my web app server and added the CA certificate to my profiles on the iPhone. Now safari accepts my server SSL cert, and the Home Screen web app does too. Success!

libxcomfort, open source Moeller xComfort library

libxcomfort is an open source library for controlling Moeller / Eaton’s xComfort devices through the CKOZ-00/03 USB dongle. Currently RS232 is not implemented, only the USB protocol. It can currently be used for:

  • Getting/setting the dim value.
  • Starting/stopping gradual up/down dimming
  • Turning actuators/dimmers hard on/off.
  • Some other commands like reporting temperatures/measurements have been partially reverse engineered but not implemented.

Check it out here:
https://github.com/mifi/libxcomfort

Frilett - Fake Mobillett Proof of Concept

Lenge siden sist!

Hatt det litt moro med HTML/CSS. For en stund tilbake slengte jeg sammen en proof of concept klone av ATB sin Mobillett-app implementert som web-app. Genererer automatisk en billett, men man kan også hastekjøpe en billett gjennom eksisterende Mobillett konto med penger på dersom denne har blitt registrert på siden. Da vil den vise en gyldig billett fra din konto!
Barcode inneholder også gyldig data fra billetten.
Fungerer utmerket på iPhone.

Check it out! (åpne den i din mobile nettleser)
http://frilett.mifi.no/

NB! Må ikke brukes for å forfalske billetter og unngå betaling! Denne er bare laget for å vise hvor enkelt det kan være å forfalske en slik elektronisk billett!

Hvordan laste ned / rippe video fra VGTV

Det er overraskende enkelt å lagre video fra VGTV.

Jeg har laget et python-skript som automatisk henter ut adressen. Last ned skriptet her.

Kopier lenken til videoen du vil ha, feks. http://www.vgtv.no/?id=33283&category=1

Bruk python fra komandolinja og hent ut adressen ved hjelp av skriptet, eks.:

1
python vgtv_url.py http://www.vgtv.no/?id=33283

1
python.exe vgtv_url.py http://www.vgtv.no/?id=33283

(Windows CMD)

Du vil så få en rtmp:// URL. Åpne denne i VLC og fortell VLC å automatisk lagre videostrømmen.

Eventuelt, bruk VLC eller mplayer på kommandolinjen med en av disse one-linerne:

1
vlc "$(python vgtv_url.py http://www.vgtv.no/?id=X)" --demux=dump --demuxdump-file=video.mp4

1
mplayer -dumpfile video.mp4 -dumpstream "$(python vgtv_url.py http://www.vgtv.no/?id=X)"

Gammel (manuell) metode:

  1. Ta URL-en til en video, f.eks.:
    http://www.vgtv.no/?id=33283&category=1

  2. Notér id (her: 33283)

  3. Gå inn på:
    http://www.vgtv.no/api/?do=playlist&id=NOTERT_ID
    F.eks.:
    http://www.vgtv.no/api/?do=playlist&id=33283

  4. Fra XML-filen, hent ut rtmp-adressen under følgende hierarki (prøv et vilkårlig location-element):
    <playlist> <trackList> <track> <location>

Åpne så denne URL-en i MPlayer. F.eks.:

1
mplayer -dumpfile video.mp4 -dumpstream rtmp://88.87.43.102/streaming/mp4:storage/compressed//33283/flash_1000.mp4

Dette kan også gjøres med VLC:

1
vlc rtmp://88.87.43.98/streaming/mp4:storage/compressed//33283/flash_1000.mp4 --demux=dump --demuxdump-file=video.mp4

Vent, og du har snart videoen på disk.

VG har sans for humor

Ser man det. Utviklerne av VG Nett har nerdehumor!

Jeg var nysgjerrig på hvilken server/cache de bruker på vg.no, og da la jeg merke til noe artig:

1
2
3
4
5
6
7
8
9
10
11
12
13
HTTP/1.1 200 OK
X-VG-WebServer: leon
Cache-Control: must-revalidate
Content-Type: text/html; charset=UTF-8
X-VG-WebCache: quinn
X-Rick-Would-Never: Let you down
X-VG-Korken: http://www.youtube.com/watch?v=Fcj8CnD5188
Content-Length: 289798
Date: Wed, 27 Oct 2010 17:23:18 GMT
Connection: keep-alive
X-Cache: HIT
X-Cache-Hits: 4363
X-Age: 177

Og et par andre:

1
2
3
X-Rick-Would-Never: Let you down
X-Rick-Would-Never: Run Around and Desert You
X-Rick-Would-Never: Trololo