wireload/screenly-ose — pull request #92 by SebastianSchildt (2013-03-06 17:14:38+00:00)
Title: Allow aborting currently shown asset via SIGUSR1

This code allows skipping the currently displayed asset.

Why:
If you have a long running asset which you removed from the asset list (or shortened its time), but it is displayed at the moment you need to wait until the asset is finished Not good if you want to display some "Breaking news" as soon as possible.

How:
Unix signals. Normally python will terminate when receiving a signal. Added a signal handler for USR1 Signal. After processing of the signal handler, all calls to sleep() are interrupted, effectively finishing the current asset (the signal handler will also kill omxplayer, in case the current asset was a video).

This includes only the "plumbing". Eventually I plan to add a "Skip current asset" button to the WebIF, but oh my good! I understand nothing about the haml, coffe, js whatever stuff, so for the time being I failed horribly at that :)

To test, the signal could be sent like this (possibly it can be done more elegantly)

kill -s USR1 `ps a | grep [v]iewer.py | awk '{ print $1 }'`

which effectively does a "kill -s USR1 "