onPlayBackStarted in service addon

  Thread Rating:
  • 0 Votes - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Post Reply
nilzen Offline
Member
Posts: 62
Joined: Dec 2009
Reputation: 2
Location: SkellefteƄ, Sweden
Post: #1
Can someone please point me in the right direction for listening to player events, onPlayBackStarted etc, in a service addon?

Code:
import xbmc

class PlayerEvents(xbmc.Player) :
  
    def onPlayBackStarted(self):
        xbmc.log("play")

player=PlayerEvents()

xbmc.log("init")

"init" gets logged but never "play", Python isn't my preferred language so I'm sure if there's a better way to subscribe to player events but I found some example code where they were listening to player event this way using the old autoexec.py
find quote
jmarshall Offline
Team-XBMC Developer
Posts: 25,685
Joined: Oct 2003
Reputation: 169
Post: #2
IIRC you need to have a while (!xbmc.abortRequested) or thereabouts there, otherwise your script completes immediately.

Always read the XBMC online-manual, FAQ and search the forum before posting.
Do not e-mail XBMC-Team members directly asking for support. Read/follow the forum rules.
For troubleshooting and bug reporting please make sure you read this first.


[Image: badge.gif]
find quote
Bstrdsmkr Offline
Posting Freak
Posts: 802
Joined: Oct 2010
Reputation: 16
Post: #3
Yeah, you have to keep the script running by checking for a condition and then sleeping.
find quote
Popeye Offline
Posting Freak
Posts: 909
Joined: Aug 2009
Reputation: 26
Location: Sweden
Post: #4
use xbmc.sleep not time.sleep..

sverigesradio | Pneumatic | SABnzbd | XBMC that just works - openelec
find quote