Friday, April 17, 2009

Developing Applications with Python seminar

For those who will attend my Python Seminar on April 18, 2009 at Informatics Northgate; you can view and download the materials below:

Presentation:


Source Codes:
tweet.py - A simple micro-blogging software using CherryPy.
qt-textedit.py - A basic text editor using PyQt4

Please feel free to email me if there is some inconsistencies with my materials.

Wednesday, April 8, 2009

GStreamer Hack Sprint

My target: Get to know gstreamer and write something useful with it. :)

Day 1 (Hello GTK+):

GStreamer's cool and has a good python binding although I decided to use C this time. It's been a long time since I wrote software in a low-level language and it seems now is the best time to resharpen. First up getting to know gtk, glib, and gobjects. I started my baby steps by writing a simple text editor using GTK 2.0 and Glade. Doing this exercise made me realize that I've been pampered by python for too long.


Here's the source code for those who are interested:
textedit.c
textedit.glade

Day 2 (Hello GStreamer):

After barely reawakening some of my C programming, I headed over to freedesktop to read about application programming in gstreamer. I give kudos to all people who wrote the gstreamer manual. This enabled me to create a command-line mp3 player. (I'm now listening to my favorite artist Shiina Ringo with it). ^_^


The pipeline that was used here is:
filesrc ! mad ! audioconvert ! alsasink
The mp3 player uses the mad plugin which is in 'gst-plugins-ugly' so you may have to install the gstreamer plugins-ugly to make it work (they usually don't get installed by default specially by Ubuntu). Below is the source code and a python version which does the same thing:

mp3player.c
mp3player.py

Day 3 & 4 (GtkTreeView woes):

Having some limited knowledge about GstBus (which is needed for catching GstMessages and take action on them), it seemed that it would be enough to create a simple 'playlist' engine by listening to GST_MESSAGE_EOS (end-of-stream).


Here's my baby steps to combine GTK+ and GStreamer together. It's miles away from becoming useful yet. GtkTreeView (as my playlist) is giving me a lot of challenges and parsing tags (media file info) doesn't seem to work properly.

gstplayer.c
gstplayer.glade