Python xbmcwidgets API as an extension of the xbmcplugins API?
#1
Lightbulb 
Let me explain further, widget can mean so may things. Its possible to create a custom widget for a skin using the skinning interface already, most skins have currently playing, some have weather widgets. MediaStream Redux has 2 that are a bit more unique, it displays the newest movies and TV shows in your library. It's possible to change these, however, for each skin its different. You have to search through the code looking for the correct place to enter your new code. Also, the display code can end up closely linked with the content, not very MVC.


This python api would be similar to (or possible extension of) the xbmcplugin module. The xbmcplugin module leaves the Skinner in control of the layout (View) and the plugin modifies (Controller) their chosen content (Model). The api would allow the plugin writers to push their content into different view.

Hopefully I've made myself clear, I sometimes find it hard to get what's in my head into words.
Reply
#2
So you are basically suggesting an new type of python plugin API that would in a unified manor enable this:
http://forum.xbmc.org/showthread.php?tid=53396
and this:
http://forum.xbmc.org/showthread.php?tid=28376
http://forum.xbmc.org/showthread.php?tid=52034
http://forum.xbmc.org/showthread.php?tid=54368
and possibly also:
http://forum.xbmc.org/showthread.php?tid=33439
as a kind of skinnable python plugins to be called 'widgets' instead of plugins to not confuse them with the other plugins?

Do I understand that correctly? Huh

...I am not a programmer myself but still curious about your concept if it would do what I think it will do Big Grin
Reply
#3
Yes, I think you have the idea.

The first thread you posted sums it up the best. The 2 boxes in the right of the picture each contain a heading, a picture and a list 4 items long. That Box could contain anything from the top 4 most popular shows on iplayer or the first 4 items on a rss news feed, newest songs in my music library, last 4 songs I've listened too... etc.

It's also like the Weather plugin only more abstract.
Reply
#4
Feel free to design up such an interface. I'm more than happy to help implement it, as it's certainly missing as it is now.
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
Reply
#5
Ok, I'll give it a go, like Gamester17 said of himself "I am not much of a programmer"... but I'm learning.

Code:
addWidget(list, refresh, url)
    list             : a list of listItems n long
    refresh          : time in seconds until the widget refreshes
    url              : url called when refresh is reached

listItem(content, [,formating])
    content     : a string or image location
    formating   : optional a hint to the skin how to display the listItem
                  e.g. heading, a picture, left/right justify,  bold, etc.

The skin could invoke the script requesting it returns a list X long (possible standard lengths of 2,4,8,16) depending on the amount of room the skinner give to the widget. The the plugin would reply with varying detail depending on the length of the list requested.

A weather widget example:
1. skin requests a list 2 long, script returns temperature and forcast
2. skin requests a list 4 lines long, script returns temperature, forcast, UV index and Humidity

Newest items in library example:
1. skin requests 2 items, script returns newest item added to video and newest album added to music library.
2. skin requests 16 items, script returns 4 newest movies, 4 newest TV shows, 4 newest albums and 4 newest songs


The url the scripts are called with could be something like this:
Code:
plugins://widgets/<script name>?listlength=?

Do any of you skinners and skilled python coders have any opinions on my idea?
Reply
#6
Just had a few additional thoughts, make the list navigateable (I'm not sure if navigateable is a real word) and list items executable.

Code:
addWidget(list, refresh, url [, executable])
    list             : a list of listItems n long
    refresh          : time in seconds until the widget refreshes
    url              : url called when refresh is reached
    executable     : if true user can select items inside the widget and run them, defaults to false

listItem(content, [, url, formating])
    content     : a string or image location
    url        : url called when item is selected
    formating   : optional a hint to the skin how to display the listItem
                  e.g. heading, a picture, left/right justify,  bold, etc.
This would allow for manual refresh, or launching videos or music straight from the widget.
Reply
#7
jt0451 Wrote:Do any of you skinners and skilled python coders have any opinions on my idea?
You should really have a talk with Nuka1195 (python coder) and Jezz_X (skinner) based on the discussion here:
http://forum.xbmc.org/showthread.php?tid=53396

Nuka1195 and jmarshall where both deeply involved in the development of the xbmcplugins API, (plugin python directory services for XBMC).

Wink
Reply
#8
isn't it better to make skin able to execute python directly, boxee has it.
Reply
#9
we have it as well
Reply
#10
how about an exaple spiff as a simple try froze xbmc

PHP Code:
<onclick lang="python">
import webbrowser
webbrowser
.openhttp://www.google.com/ )
</onclick
For python coding questions first see http://mirrors.xbmc.org/docs/python-docs/
Reply
#11
hmm, blame yuval! Smile

i'll see if i can dig one out
Reply
#12
kind of related

http://trac.xbmc.org/ticket/6835
For python coding questions first see http://mirrors.xbmc.org/docs/python-docs/
Reply
#13
*dooooh* why didn't I check yuvalt's commits Sad
Reply
#14
Typical, I have an idea and someone thought of it 5 weeks ago and is already working on a solution.

I think the point I've been trying to get across is to make installing a widget script as easy as installing a video or music plugin. As well as doing it in a consistent way across all skins.

Take a look at this,
http://en.wikipedia.org/wiki/Web_banner#Standard_sizes
the same methodology could be applied to xbmc skins.
Reply
#15
well, it's not really the same thing, but widgets could be cool aswell Smile
Reply

Logout Mark Read Team Forum Stats Members Help
Python xbmcwidgets API as an extension of the xbmcplugins API?0