Allow aborting currently shown asset via SIGUSR1#92
Merged
Conversation
Contributor
|
Yeah, it does just that, I get it now. |
3 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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 <viewer_PID>"