Sending on-screen notifications using the JSON API

  Thread Rating:
  • 0 Votes - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Post Reply
ftclausen Offline
Junior Member
Posts: 12
Joined: Apr 2012
Reputation: 0
Location: Amsterdam
Post: #1
Hi All,

This is regarding the conversation going on at

http://forum.xbmc.org/showthread.php?tid...id=1090501

where a add-on showing tweets *about* what you are currently watching would be very nice to have. To that end I am doing some research regarding potential ways of sending an on-screen notification while media is playing. I have been reading the JSON docs at

http://wiki.xbmc.org/index.php?title=JSON-RPC_API

but I could not find anything related to on-screen notifications, only notifications to do with how XBMC is operating. Does anyone know if the JSON API supports this?

Thanks!

Fred.
find quote
robweber Offline
Fan
Posts: 598
Joined: Sep 2009
Reputation: 15
Post: #2
I don't see a notification call (similiar to the old http api Notification() function) in the JSON descriptions either. If you are planning on making an addon though you can always use the xbmc python module to use the builtin notification function. Several addons already do this, the call would be

Code:
xbmc.executebuiltin("Notification('Title','Message')")

Another possibility would be to use the XBMC EventServer to send the notification, if you had to send it from a source outside of XBMC. The Maraschino project has a nice python based XBMC Client library that includes send notification functionality using the event server. Not sure where the original library came from, or if it was coded from scratch for that project but it might be worth a look:

https://github.com/mrkipling/maraschino/...cclient.py

Would either of these fit your project needs?
find quote
Montellese Online
Team-XBMC Developer
Posts: 2,776
Joined: Jan 2009
Reputation: 20
Location: Switzerland
Post: #3
In the (unstable) version 5 of the JSON-RPC API which is part of the current master you can use GUI.ShowNotification() to display notifications in XBMC. The wiki page for JSON-RPC API v5 hasn't been updated yet but if you want to see what has changed since Eden has been released, you will always find the latest changes here: http://forum.xbmc.org/showthread.php?tid=98551 (just scroll far enough down).

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
ftclausen Offline
Junior Member
Posts: 12
Joined: Apr 2012
Reputation: 0
Location: Amsterdam
Post: #4
Thanks for the great suggestions! I will evaluate all options - I am indeed planning on making an add-on so might try the built in method first.

Thanks again,

Fred.
(This post was last modified: 2012-05-02 23:39 by ftclausen.)
find quote
Bstrdsmkr Online
Fan
Posts: 644
Joined: Oct 2010
Reputation: 12
Post: #5
I was kicking this idea around myself and came up with a few options. Instead of using notifications (which would give off a DING! every time you called it), here's what I had in mind:

1. Create a service addon . The service runs in the background waiting for xbmc.Player.isPlaying() == True. Once it's true, use twython (a pure python twitter implementation) to grab tweets based on the title of the playing content. Create a WindowXMLDialog that the service displays when the onscreen menu is NOT being shown. This has the advantage of skinners being able to override the xml with something that looks good with their skin

2. Create a fake subtitle file which contains the tweets
find quote
ftclausen Offline
Junior Member
Posts: 12
Joined: Apr 2012
Reputation: 0
Location: Amsterdam
Post: #6
(2012-05-03 00:52)Bstrdsmkr Wrote:  I was kicking this idea around myself and came up with a few options. Instead of using notifications (which would give off a DING! every time you called it), here's what I had in mind:

1. Create a service addon . The service runs in the background waiting for xbmc.Player.isPlaying() == True. Once it's true, use twython (a pure python twitter implementation) to grab tweets based on the title of the playing content. Create a WindowXMLDialog that the service displays when the onscreen menu is NOT being shown. This has the advantage of skinners being able to override the xml with something that looks good with their skin

2. Create a fake subtitle file which contains the tweets

I like option 1) - worth looking into! I did not notice a "ding" when notifications came through (for example, when receiving an SMS and using the XBMC android remote) but that might have been down to the theme I am using.

Cheers,

Fred.
find quote
robweber Offline
Fan
Posts: 598
Joined: Sep 2009
Reputation: 15
Post: #7
Just FYI - The 'ding' associated with the built in XBMC notification is set per skin and can easily be turned off or removed altogether if people find it irritating. That being said a lot of skins have a very small place for the notifications making them hard to read.
find quote
giftie Online
Skilled Python Coder
Posts: 2,031
Joined: Mar 2010
Reputation: 35
Post: #8
The ding also is only available if navigation sounds works as well.. Smile Which at the moment, a lot of Linux systems it does not. Hopefully once AudioEngine gets merged they will.

[Image: e4f63e45ba34fe4695b3bb08eb2499d8e4ee484e...4c076g.jpg]
For troubleshooting and bug reporting please make sure you read this first you can also use XBMC Log Uploader Script.
Cinema Experience
Cinema Experience Wiki
cdART Manager
fanart.tv


find quote
Martijn Online
Team-XBMC
Posts: 7,672
Joined: Jul 2011
Reputation: 114
Location: Dawn of time
Post: #9
(2012-05-04 05:22)giftie Wrote:  The ding also is only available if navigation sounds works as well.. Smile Which at the moment, a lot of Linux systems it does not. Hopefully once AudioEngine gets merged they will.

I certainly hope it will stay broken for me Tongue
I find it annoying as hell

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


For your mediacenter artwork go to
[Image: fanarttv.png]
find quote
Martijn Online
Team-XBMC
Posts: 7,672
Joined: Jul 2011
Reputation: 114
Location: Dawn of time
Post: #10
(2012-05-04 05:22)giftie Wrote:  The ding also is only available if navigation sounds works as well.. Smile Which at the moment, a lot of Linux systems it does not. Hopefully once AudioEngine gets merged they will.

I certainly hope it will stay broken for me Tongue
I find it annoying as hell

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


For your mediacenter artwork go to
[Image: fanarttv.png]
find quote
Post Reply