cURL on play/pause/stop

  Thread Rating:
  • 0 Votes - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Post Reply
dareon Offline
Junior Member
Posts: 12
Joined: Jan 2010
Reputation: 0
Post: #1
I have been trying to find a way to run a curl script on play/pause/stop, but with the changes to eden I have not found anything that works. Is there some place that I can put the command for it to work?

Here is a sample of what I want to send:

curl -X PUT -H "Content-Type:application/json;charset=utf-8" -d "{\"password\":\"6753\",\"sceneId\":\"90f18fea-bd80-4c53-96a3-5b04429ca790\",\"activate\":\"1\"}" http://10.4.3.178:1178/zwave/activateSceneByGuid

It would be a different command for each action. I only care to have it work if it is playing a video. I don't care about music, photos, etc...

Thanks.
find quote
jhsrennie Offline
Team-XBMC Developer
Posts: 7,237
Joined: Nov 2008
Reputation: 117
Location: Chester, UK
Post: #2
As far as I know the trick of subclassing xbmc.Player to get notifications still works. Write a service add-on with the default.py containing something like:

Code:
import xbmc

class MyPlayer(xbmc.Player):

    def __init__(self):
        xbmc.Player.__init__(self)

    def onPlayBackEnded(self):
        xbmc.log("script.notifications: Playback Ended")

    def onPlayBackStarted(self):
        xbmc.log("script.notifications: Playback Started")

    def onPlaybackStopped(self):
        xbmc.log("script.notifications: Playback Stopped")

xbmc.log("script.notifications: Started Running")

player = MyPlayer()

while(not xbmc.abortRequested):
    xbmc.sleep(100)

xbmc.log("script.notifications: Finished Running")
find quote