Watch TV on Raspberry Pi with OpenELEC media-build

I’m using an Elgato EyeTV DTT to watch TV on my Macbook Pro. I wanted to use this USB tuner on my Rasperry Pi with Raspbian, but VLC doesn’t support hardware-accelerated video yet. So I found this post on Tiago Pires’ blog, which describes how to build OpenElec from scratch including media-build. Unfortunately, some things are missing in this post, and some others are unnecessary. A lot of things in this post comes from his article, so thank you ;)

Media-build is just a script that will get the most up-to-date dvb drivers and include them in OpenElec. I don’t think it’s required if your DVB tuner is supported for a longtime by Linux, but let’s include it anyway.

(more…)

django-wkhtmltopdf on a linux (Webfaction) server

Generating PDF with python is not an easy thing. Here is what I’ve tried:

  • xhtml2pdf: the worst. It has a very bad CSS interpreter and it is pretty impossible to make a clean PDF out from a complex html page.
  • WeasyPrint: that’s better. It has its own HTML and CSS2 interpreters, and despite some minor issues it is fairly reliable. However it requires some big dependencies, and I eventually had some memory issues on my webserver.
  • wkhtmltopdf with its Django wrapper: for now, the best. It makes use of Webkit to render HTML+CSS+JS(!) pages, I don’t think you can do better. However, it requires QT, and this is big. Well, not the “classical” QT, a patched QT (that’s even worse) that allows to run without an X server. This is what I’m using for now in my projects

We’ll see here how to build wkhtmltopdf and a basic django-wkhtmltopdf usage. These steps has been tested on a Webfaction server (CentOS 6) through SSH.

(more…)

Python – Install WeasyPrint on a linux (Webfaction) server

WeasyPrint is a great python library to generate PDFs from HTML. It beats hands down xhtml2pdf, by interpreting CSS and HTML the right way.

However, it has a lot of dependencies and it just can’t fit in a simple python virtual environment. It took me a whole day to install on Webfaction, so I think it would be helpful to show how to do it properly.

These steps has been tested on a Webfaction CentOS 6 server (python2.7), and they should be the same for others Linux systems. If your system is not exactly the same, you might have to install other dependencies manually. Linux From Scratch is your helpful friend in this kind of situation.

(more…)