Howto use KDE4’s device notifier to play a DVD in SMplayer

Just finally figured this one out! It’s possible to add an entry to KDE4’s device notifier, so you can just click & play a DVD in SMplayer. Awesome!

You need a very recent SMplayer and Mplayer, latter one compiled with dvdnav support.

  1. In SMplayer’s preferences, go to mouse & keyboard -> mouse, and for left click select "Activate option in DVD menus".
  2. Create a file called smplayer-playdvd-predicate.desktop
    in $KDEDIR/share/apps/solid/actions, here that means /usr/kde/svn/share/apps/solid/actions/smplayer-playdvd-predicate.desktop, with following in it:
[Desktop Entry]
X-KDE-Solid-Predicate=[ StorageVolume.ignored == false AND OpticalDisc.availableContent == 'Data|VideoDvd' ]

[Desktop Action open]
Name=Play DVD with SMplayer
Exec=smplayer dvdnav:////%d

Now restart KDE, insert a DVD in your drive, or load DVD ISO image in cdemu, wait for the device notifier to pop up, and select.

Device notifier play DVD in SMplayer

That’s it!

Overlay with Qt 4.5 snapshot ebuilds

Recently stumbled over this blog post:

Looks like it’s usable for KDE 4 trunk already, and the improvements to the WebKit engine got me interested in trying it. So I spend 2 hours in creating ebuilds for the Qt 4.5 snapshots – based on the split Qt 4.4.2 ebuilds in portage.

That actually wasn’t that hard to do, just fixing the qt4-build.eclass to include that 4.5.0_pre* version, and adding one line to qt-core ebuilds (adding src/tools/bootstrap to the targets). Other than that, it compiled fine. Easy.

The overlay can be found in my SVN:

svn co

There is an script in the Scripts/ subfolder, which should generate an updated headers tarball and update all ebuilds. Just adjust that distdir variable.

And now the usual warnings etc: USING THE EBUILDS IN THIS OVERLAY MIGHT KILL YOUR CAT, BURN YOUR HOUSE, BREAK YOUR CAR AND YOUR KDE4 and whatnot else. Use at your own risk!


BASH arrays and filenames with spaces

I’m sure I can use this one quite often.

1) Arrays are nice to avaoid temporaray files

2) Spaces in file names are a PITA. But there are nice ways to work around this

Array[0]="/some/path/to/mooo foo.txt"
Array[1]="/some/path/to/mooo foo bar 2.txt"
Array[2]="/some/path/to/mooo foo bar 3.txt"

There we have some example array.

for ((i=0;i<${#Array[@]};i++)); do echo ${Array[$i]}; done
/some/path/to/mooo foo.txt
/some/path/to/mooo foo bar 2.txt
/some/path/to/mooo foo bar 3.txt

Ok, now what if want to pass that to ls, we could quote it somehow. Or use some pattern expansion to replace the space with backslash space, like

for ((i=0;i<${#Array[@]};i++)); do echo ${Array[$i]// /\\ }; done
/some/path/to/mooo\ foo.txt
/some/path/to/mooo\ foo\ bar\ 2.txt
/some/path/to/mooo\ foo\ bar\ 3.txt

Great! Another way would be to temporarily change the special variable $IFS that determines which character is used for word splitting. Let’s set this to “newline”


for ((i=0;i<${#Array[$i]};i+=1)); do
   ls ${Array[$i]}


That $IFS change can also be used in all sorts of other loops. Hell, I’m going to need that really often. Thanks to the guys on

Howto: Log firewall from OpenWrt to a remote rsyslog

This is how I got remote logging from my OpenWrt router to the syslog daemon on the server box.

On the server side, I enabled remote logging over UDP (refer to the rsyslog or syslog-ng documentation).

On the OpenWRT box following steps are needed

Enable remote syslog logging

Edit /etc/config/system and enable remote logging by adding:

option 'log_ip' ''

Now reboot the router and see if it logs correctly.

Enable firewall logging (-j LOG)

Update (2013): In recent Openwrt builds this is as simple as editing /etc/config/firewall and adding a line to each zone that you want to get logged

config 'zone'
        option 'name' 'wan'
        option 'log' '1'

That’s all.


The info below is valid only for old OpenWRT builds Kamikaze 8.09 and older!

Then I had to get IPtables to produce some log output. With Kamikaze’s new firewall config layout this was a bit tricky. I decided to just log SYN flood protection actions, and the dropping of INVALID packets on INPUT and FORWARD chains. Therefore we need to edit /lib/firewall/ and add 3 lines (those with -j LOG)

In function fw_defaults()

$IPTABLES -A INPUT -m state --state INVALID -j LOG --log-prefix "DROP INVALID (INPUT): "
$IPTABLES -A INPUT -m state --state INVALID -j DROP
$IPTABLES -A FORWARD -m state --state INVALID -j LOG --log-prefix "DROP INVALID (FORWARD): "

and for the SYN flood stuff, in function load_synflood()

$IPTABLES -A syn_flood -j LOG --log-prefix "SYN FLOOD: "
$IPTABLES -A syn_flood -j DROP


Search for a good audio player

For a long time i’ve been a fan of simple WinAMP-style music players, and went the XMMS -> BMP -> Audacious way. Then, with my collection growing over the years, I got to like library driven players, with Amarok 1.4* being the best regarding music management capabilities.

Running KDE4 I decided to get rid of kdelibs-3 and everything depending on it, inkluding Amarok 1. So I need a new music manager/player.

This is what I tried out so far:

  • Amarok 2

Somehow it looks cool. But managing music isn’t as cool as it was with Amarok1.

  • Banshee

I couldn’t figure out how to simply drag & drop files from the file browser to the play queue

  • Listen

Looks most promising regarding the UI layout and feature set. Unfortunately the libraray can only be one single folder, and well after reading in my 32000 files, Listen was up at consuming 1.2GB RAM and crashed right away when trying to play one. (I used current SVN)

  • XMMS2 + Esperanza

if XMMS2 only had a good ALSA plugin and didn’t exhibit memory leaks after running a day….

  • MPD + Sonata

Actually this combination is just perfect. Really. I easpecially like the "browse library by filesystem" feature. This would be it, if I just could figure out how to add files from the file manager to the current playlist. Drag & drop doesn’t work.

  • Exaile

Really nice too. Tried the 0.3 branch, and I’m really looking forward to it.

Howto: Convert avi/mov/any video to Flash/flv on Linux

Recently I wanted to convert a Quicktime .mov video to Flash .flv in order to post it on this page, for the fun of it.
First thought: uuuh how do I do this on Linux? But it’s pretty simple, thanks to ffmpeg. Works fine with anything that ffmpeg can play, so avi, mpeg, wmv or whatever.

It’s as simple as:

ffmpeg -i input.avi -s 320x240 -ar 44100 -o movie.flv

There is also a nice tool to add metadata info like duration etc to flv files, called flvtool2.

cat movie.flv | flvtool2 -U stdin movie.flv

Now your flv has duration info and is ready for the website.