Several GUI plugin questions - loops, $INFO etc.
#1
Ok I am developing a XBMC<>Squeezebox bridge (http://forum.xbmc.org/showthread.php?p=1012231) - and by and large it's going well. Source code is here:

http://code.google.com/p/bossanova808-xb...t.xsqueeze

Obviously, I want to tie into XBMC eye candy and the mad skills of the various skinners, so I am trying to write this in a skinner friendly way.

Thus I moved over from window to windowXML recently...this has brought with it numerous issues.

QUESTION1:

First, I get constant errors:
Code:
15:25:46 T:3472   ERROR: CLocalizeStrings::ClearBlock: Trying to cl"ear non existent block C:\Users\X\AppData\Roaming\XBMC\addons\script.xsqueeze

...I am reasonably confident they are not my fault, and I have no idea where they are coming from really, as they only appeared with the WindowXML change.

Can I do anything about these?

Question 2

I am unsure how best to do a GUI loop - that is, my addon is basically a 'Now Playing' display for an external media player. It needs to update all the time, and capture remote control events, and pass to the client. There seems to be two ways of doing this, basically

a) window.doModal() and kick off an updating thread in OnInit

b) a simple loop...and this MUST have an xbmc.sleep in it or I don't get events:

Code:
window.running = True
    while window.running:
      window.show()
      window.update()
      xbmc.sleep(10)

I am using b) at the moment.

I notice some odd things - when I handle a remote event, like next_item (so FF->] if you see what I mean) - this gets passed to my player....but also seems to go through to XBMC itself and I get a popup 'can't find item next item on playlist'. I think this is something to do with window.show() and events and the sleep, but I can't find any good info on how this works.

I am guessing if I doModal() this might not happen as all events will be absorbed by the window?? But I am not sure how cool XBMC is with multi-threaded plugins, and my initial testing of this seemed to crash XBMC fairly frequently.

Is there anyone who can confirm the best way to do a safe, high performing dynamically updating window in an XBMC addon?

Question 3
To make things easy on the skinner, my initial idea was to populate the $INFO thing with lots of handy data - names of current images for cover art, text for titles etc etc. However, there doesn't seem to be access to this (I assumed, wrongly I think, this is what windowXML.setProperty did??) - instead one has to do the more laborious access by control number thing I think? Which also forces the skinner to implement all those controls (well, unless you do a lot of try: excepting...) - and keep those numbers. Have I missed the obvious and can one set info labels for a plugin created windowXML??

Question 4

Can one take over & directly invoke the XBMC NowPlaying window, so to speak - that is, can I set the appropriate INFO labels and actually use the existing NowPlaying infrastructure with the external player...this would be the most integrated approach I think, and instantly give all skins compatibility I guess. But I'd have to be able to grab all the remote events and remap them to the external controls still. Even trying this will be very time consuming so I want to get an idea if it's possible before I waste many hours on it!!

Question 5

Images are an issue - most of the time, I have cover art. Sometimes, a default image is returned by Logitech Music Server, and sometimes no image.

With the default images, I get Warning JPEGIO error - not a real jpeg, starts with x20 or something (sorr don't have the exact message to hand) - but they do display correctly on screen despite this message. I suspect the server might actually be returning pngs in this case (you call it with ?cover.jpg on the URL but I don't think that means per se it's a jog coming back, unfortunately). I am not sure how to deal with this....

The no image thing is an issue - if I delete the images everytime, the come and go on track change (via urllib.retrieve()), and sometimes aren't present when the screen is re-drawn (well, I think this is what is happening as I presume urllib.retrieve is threaded or something??) - so they don't get drawn. Problem is, they never come back once that happens, even when the become present again. Note I am not explicitly calling window.setImage and maybe I should be? I guess the basic question - is there a proper way to clear an image from a window, such that when I re-set it it will come back?



OK any and all help MUCH appreciated - I have made really good progress and it by and large works, but it could be much better than it is if I can get into my head better how all this works and the documentation is ... sparse!

I am hoping some of you xbmc/python experts can help me out here...
Addons I wrote &/or maintain:
OzWeather (Australian BOM weather) | Check Previous Episode | Playback Resumer | Unpause Jumpback | XSqueezeDisplay | (Legacy - XSqueeze & XZen)
Sorry, no help w/out a *full debug log*.
Reply
#2
1: Likely not your fault, yes. Will try and check on it later today.

2: If you're overriding the onAction to handle events, then I think doModal will ensure they don't get passed on - you'll have to handle your own events though, such as the event to exit the script. Not 100 on this.

3: Window.SetProperty might be what you want - typically it's used when you don't really want a window and want to set properties on some other window for skinners to grab. You could set it on your own window if you want instead - the skinner would then use that info in their XML file for that window.

4: Nope, this is certainly not advisable.

5: If you can get the image from a URL (e.g. just point your browser at a URL and it'll load the image) then you can simply feed that URL to the image control and XBMC will automatically load it. This assumes the URL changes with each track change, however. If it's the same URL all the time (but the image changes) then you basically need to clear the image's URL first, wait for a render event, then re-set it again. There's a message you can send for this - GUI_MSG_RELOAD_THUMBS. Not sure how easy it is for you to send that, though.

Cheers,
Jonathan
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
#3
jmarshall Wrote:2: If you're overriding the onAction to handle events, then I think doModal will ensure they don't get passed on - you'll have to handle your own events though, such as the event to exit the script. Not 100 on this.

That's consistent with my experience. In fact, I spent a full day beating my head against a wall until I realized you basically *have* to capture actions with DoModal or you'll never be able to get out.

I found documentation for all the things you can override in the Key.h header file at https://github.com/xbmc/xbmc/blob/master...ilib/Key.h
Reply
#4
Many thanks Jonathan and pkscout.



ok so:

1. Thanks Jonathan - I think this is definitely a bug and it makes the log very messy, so would be good.

2. So I am guess then for general structure doModal() and a thread is probably the way to go..ultimately that makes sense...I did just find it a bit crashy. I will give it a whirl again and maybe get back to you if it crashes a lot. I am overriding onAction and I handle the previous menu to exit already, that works well. Basically, for almost all actions I jut want them passed through to the external player and absorbed before they get to XBMC, so it's actually a simple structure.

3. I tried window.setProperty() but then couldn't retrieve the info in the skin file using $INFO[] - I will try again and see if I made a mistake, and post some sample code if I think it's not working - but you can confirm the intention is that setProperty on my own window ID should then make this available in $INFO yes? If so that would make it very easy for skinners in general with this sort of thing.

4. Thought so, glad it is ruled out so I can stop wondering - thanks!

5. I did not realise I didn't have to download them - that's great. So I can do this either in the skin directly (since the URL for the cover image never changes) - or I presume with a ControlImage.setImage if that suits me (setImage can take a url?)

Many thanks, and sorry for so many questions!
Addons I wrote &/or maintain:
OzWeather (Australian BOM weather) | Check Previous Episode | Playback Resumer | Unpause Jumpback | XSqueezeDisplay | (Legacy - XSqueeze & XZen)
Sorry, no help w/out a *full debug log*.
Reply
#5
bossanova808 Wrote:3. I tried window.setProperty() but then couldn't retrieve the info in the skin file using $INFO[] - I will try again and see if I made a mistake, and post some sample code if I think it's not working - but you can confirm the intention is that setProperty on my own window ID should then make this available in $INFO yes? If so that would make it very easy for skinners in general with this sort of thing.

I think you have to target a skin window with the setProperty, not your own window. I tried building a plugin that skinners could use but got stuck the same place you have. I finally just did everything in the modal window because I could data into it.
Reply
#6
In other words, create a window id in the skin file you mean? With the CustomXXXX.xml thing required or not?


'by data into it' with your modeal you mean put stuff in $INFO? i.e. moModalWindow.SetProperty(Key,Value) - can be found in the skin file as $INFO[Key] ?
Addons I wrote &/or maintain:
OzWeather (Australian BOM weather) | Check Previous Episode | Playback Resumer | Unpause Jumpback | XSqueezeDisplay | (Legacy - XSqueeze & XZen)
Sorry, no help w/out a *full debug log*.
Reply
#7
UPDATE

On Issue 1 - still open, still occuring with a doModal window...only started when I moved to windowXML

On Issue 2 - still open I am now using doModal and events still fall through to xbmc...and ideas on how to stop this? Seems like a bug to me,, events should be handled by the frontmost window surely?

Issue 3 - closed

I can now set properties on my window, and the retrieve them using this code:

Code:
xbmcgui.Window(xbmcgui.getCurrentWindowId()).setProperty("DISPLAYLINE1", newLine1)

and

<label>$INFO[Window.Property(TEST)]</label>

..I couldn't do it by giving the window an ID in my skin file and using that ID...

Issue 4 - closed, ta!

Issue 5 - closed - using the URLs directly is FAR easier and works really well. Clearly there is caching going on as sometimes it's much quicker than others...but as a method it's sweet, I don't need to manage and files etc. It would be great if the Python Docs made it clear a URL can be used...


MANY THANKS AGAIN! Your further thoughts/ideas on 1 & 2 appreciated Smile
Addons I wrote &/or maintain:
OzWeather (Australian BOM weather) | Check Previous Episode | Playback Resumer | Unpause Jumpback | XSqueezeDisplay | (Legacy - XSqueeze & XZen)
Sorry, no help w/out a *full debug log*.
Reply
#8
For 3, my guess is it's because you don't actually know your window id. Anything specified in the xml is ignored (this is true throughout xbmc, with the possible exception of custom windows) as xbmc controls the window ids. Can you do your_window.setProperty() rather than fetching whatever has focus (which, one presumes, is actually your window anyway...)

For 2 the problem is that the action is sent to your script asynchronously, and xbmc doesn't want to have to wait to see if you've handled it before passing it on. In particular, the actions you can't pick up are, I believe, the ones such as "close window" and the global events that affect the player (volume, stop, pause, play, ffwd, rewd etc.) This is a general problem, something that will take some time to solve, so unfortunately you'll have to live with it for now. Out of interest, does the window close event get handled if you don't handle it yourself?

Cheers,
Jonathan
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
#9
Hi Jonathan

No, window.setProperty directly doesn't work and I've seen other threads about this not working so I don't think it was my code at issue.

No, close does not get handled without me handling it, which is kind of odd given the other ones dropping through. Obviously I can see the complexity there....maybe when you create the window there could be an option so that when the xbmc rendered looks at the window it queries this (event blocking window or not?) and then chooses what to do with events? I have no idea what's going on there so I am just floating that boat at random...
Addons I wrote &/or maintain:
OzWeather (Australian BOM weather) | Check Previous Episode | Playback Resumer | Unpause Jumpback | XSqueezeDisplay | (Legacy - XSqueeze & XZen)
Sorry, no help w/out a *full debug log*.
Reply

Logout Mark Read Team Forum Stats Members Help
Several GUI plugin questions - loops, $INFO etc.0