Linux Pause and Continue Movie
#1
Hi,

I'm doing some charity work for a local care home for the elderly and need a little assistance.

I'm using RPi and XBMC,

What I need to do is play a movie as long as an UP arrow keyboard stoke is detected at least once every 3 seconds.

If that doesn't happen the movie pauses and waits for an input.

The rule is: If no input is received over a period of 3 seconds the movie pauses. As soon as it detects input the movie starts again.

Any help to set me on the right path would be very gratefully received.

Many Thanks...
Reply
#2
I don't know if it's the best solution, but you could write a python script which starts a video on the press of a button and then runs a timer which either resets if Up is pressed or executes
xbmc.executebuiltin( "XBMC.Action(Pause)" ) if 3 seconds elapse without Up pressed.
Reply
#3
Hi Doug, and many thanks for a lead on solving this.

I'm a firmware coder by profession and high level languages are not what I do normally - so please excuse the "noob" air about me with xbmc.

I checked out the xbmb.executebuilt in syntax, and after some searching I stumbled across this python xbmx json client: https://github.com/jcsaaddupuy/python-xbmc

Is it necessary to incorporate this module ? It seems like an all singing all dancing tool may solve the problem?

Many thanks.
Reply
#4
I'm not a python programmer either. And can't help you much beyond the basics. You won't have to add any modules. Just create or change (if you have one already) the keyboard.xml file and write a script.

Your (simplified) keyboard.xml file could look like:
Code:
<keymap>
  <global>
    <keyboard>
          <up>RunScript(/path/to/UpPressed.py)</up>
    </keyboard>
  </global>
</keymap>

Your UpPressed.py script would be something like:
Code:
import xbmc
## You'll need others to help here or use google as I only know *really* basic python
## Start a 3 second timer or use a while loop. If you get another keypress, reset the timer. Otherwise:
xbmc.executebuiltin( "XBMC.Action(Pause)")
Reply
#5
You probably should have posted this question in the Python Add-on Development sub-forum as this is a general query rather than being Raspberry Pi specific (you'll have more eyes-on in a general forum). Maybe a moderator can move it?

Although to be honest, unless you will be using the other functionality of XBMC (media libraries, metadata etc.) I can't help wonder if XBMC is over-kill just to play a movie and handle keyboard events - there's probably an easier solution that doesn't involve XBMC, possibly using just omxplayer in Raspbian?
Texture Cache Maintenance Utility: Preload your texture cache for optimal UI performance. Remotely manage media libraries. Purge unused artwork to free up space. Find missing media. Configurable QA check to highlight metadata issues. Aid in diagnosis of library and cache related problems.
Reply

Logout Mark Read Team Forum Stats Members Help
Pause and Continue Movie0