2013-10-21, 23:35
I have been working on a small (seemingly simple) script, and running into a lot of issues.
My motivation is that I watch a lot of sporting events (specifically US Football) which scroll scores of other games along the bottom of the screen. I do not want to see this, since it spoils my ability to watch those games at a later time. I'm trying to write a addon which covers up a small area of the bottom of the full screen video window (window ID 12005).
What I've done so far:
- got a handle to the window using 'win = xbmcgui.Window(12005)'
- Added a imageControl to it using 'win.addContro()l'.
This works (kind of), but has a lot of issues. The ones I'm aware of:
1. This is modifying an existing window, which seems like a bad idea. I'd rather place a new window/dialog in front of the existing one - but I couldn't see how to do that.
2. The size/resolution of the Full Screen Video window changes from time to time. When my script runs, the height of the FSV window is 720 pixels - but when I go to watch TV via my tuner card, it changes to 1080 pixels. This sucks because when I run my script it calculates where the overlay image should go based on the wrong resolution - and it ends up in the wrong place.
3. Ideally, this overlay control could be shown/hidden interactively via a keypress. I can't see a way of doing that without interfering with the video playback window's ability to process keys. It would also require this addon to be running in the background all the time - I suppose that means calling sleep() constantly?
Based on the issues I've run into, it feels like I'm going about the problem wrong. Anyone have suggestions for interactively putting on overlay over the fullscreen video window? It almost seems like this kind of customization isn't possible without modifying the skin. My code is below in case anyone would like to see it.
My motivation is that I watch a lot of sporting events (specifically US Football) which scroll scores of other games along the bottom of the screen. I do not want to see this, since it spoils my ability to watch those games at a later time. I'm trying to write a addon which covers up a small area of the bottom of the full screen video window (window ID 12005).
What I've done so far:
- got a handle to the window using 'win = xbmcgui.Window(12005)'
- Added a imageControl to it using 'win.addContro()l'.
This works (kind of), but has a lot of issues. The ones I'm aware of:
1. This is modifying an existing window, which seems like a bad idea. I'd rather place a new window/dialog in front of the existing one - but I couldn't see how to do that.
2. The size/resolution of the Full Screen Video window changes from time to time. When my script runs, the height of the FSV window is 720 pixels - but when I go to watch TV via my tuner card, it changes to 1080 pixels. This sucks because when I run my script it calculates where the overlay image should go based on the wrong resolution - and it ends up in the wrong place.
3. Ideally, this overlay control could be shown/hidden interactively via a keypress. I can't see a way of doing that without interfering with the video playback window's ability to process keys. It would also require this addon to be running in the background all the time - I suppose that means calling sleep() constantly?
Based on the issues I've run into, it feels like I'm going about the problem wrong. Anyone have suggestions for interactively putting on overlay over the fullscreen video window? It almost seems like this kind of customization isn't possible without modifying the skin. My code is below in case anyone would like to see it.
Code:
WINDOW_FULLSCREEN_VIDEO = 12005
__addonpath__ = xbmc.translatePath(__addon__.getAddonInfo('path')).decode('utf-8')
self.window = xbmcgui.Window(WINDOW_FULLSCREEN_VIDEO)
self.strTest = xbmcgui.ControlImage(0, self.window.getHeight()*0.9, self.window.getWidth(), self.window.getHeight()*0.1, __addonpath__+ '/resources/foo.png',colorDiffuse='0xFF000000' )
self.window.addControl(self.strTest)