Kodi Community Forum
custom window with custom info. - Printable Version

+- Kodi Community Forum (https://forum.kodi.tv)
+-- Forum: Development (https://forum.kodi.tv/forumdisplay.php?fid=32)
+--- Forum: Skinning (https://forum.kodi.tv/forumdisplay.php?fid=12)
+--- Thread: custom window with custom info. (/showthread.php?tid=73645)



custom window with custom info. - bizulk - 2010-05-11

I'm using a remote connected to a personal film database in wich I store the DVD info.
When browsing database and selecting a film preview I'd like to have it also displayed on the TV screen.


What I did for now is just editing MyVideo.xml and display some 'static info' in order to get use to XML coding.
when I want XBMC to display this screen I send an http request
Code:
ExecBuiltIn(ActivateWindow(MyVideos))

But now I would like to fill this screen with real values trough the http API.

I tried using the cmd ExecBuiltIn(SetProperty(Title,alien)) and set my label info to :
Code:
<info>Window.Title</info>

But that does not work.

Do I have to write my own window with container ? Or some python script to fill a container property ?

thks.


- bizulk - 2010-05-11

Image


- Waffa - 2010-05-11

Look to DialogVideoInfo.xml
That is what you are creating.


- bizulk - 2010-05-11

Thks for answer.
Layout is quite the same, but the pb remains : how can I fill the ListItem properties ?


- Jezz_X - 2010-05-12

as far as I know you can't these things need to be passed down from the parent windows in the code or it just uses the current windows Listitem stuff


- bizulk - 2010-05-12

In fact with the http request I can set the window container property :
Code:
ExecBuiltIn(SetProperty(title,alien))

.. and try to display it in a label :
Code:
        <control type="label"> <!-- title value -->
            <description>Title Value</description>
            <posx>770</posx>
            <posy>20</posy>
            <width>120</width>
            <visible>true</visible>
            <align>left</align>
            <aligny>top</aligny>
            <scroll>false</scroll>
            <label>$INFO[container.property(title)]</label>
            <info>container.property(title)</info>
            <number></number>
            <angle>0</angle>
            <haspath>false</haspath>
            <font>font13</font>
            <textcolor>black</textcolor>            
            <wrapmultiline>false</wrapmultiline>
          </control>


But that does not work, I tried with and without "$INFO", with only info tag set.

I lanched XBMC in debugging mode and apparently when executing request the server fails to retreive the windows handler.

In file Builtins.cpp :
Code:
else if (execute.Equals("setproperty") && params.size() == 2)
  {
    CGUIWindow *window = g_windowManager.GetWindow(g_windowManager.GetActiveWindow());
    if (window)
      window->SetProperty(params[0],params[1]);
  }

GetActiveWindow() returns 10024 (Myvideo) but GetWindow always returns NULL ! I've tried it with confluence and PM3.HD skin.


- bizulk - 2010-05-12

I don't understand why GetWindow returns NULL.

I thought of another way to change container info : make a python script, that request my external db and fill the container with infos

what do you think ?


- Nuka1195 - 2010-05-12

<label>$INFO[window.property(title)]</label>

but, there was a fix just applied if your window is a dialog. so you'll need to update to latest svn


- bizulk - 2010-05-12

Hi !
I've just check that it has to be window.property.

Now Im not sure I have to use :
Code:
<label>$INFO[window.property(title)]</label>
or
Code:
<info>window.property(title)</info>

Or does it finaly converge to the same process ?

I'll just try it now both...


- bizulk - 2010-05-12

I've seen the diff change to getFocusedWindow to check also for dialogs ...
Anyway for my needs first option is sufficient.


- bizulk - 2010-05-12

Yes ! found it ! Big Grin

Regarding to the code (look at the end) the info must be entered in that way :
Code:
<info>window(myvideofiles).property(title)</info>
OR
Code:
<label>$INFO[window(myvideofiles).property(title)]</label>
Though I prefer the first line, both work the same way, till I cannot say if its always equivalent for other controls ?

Please notice that I've put the window 'myvideofiles' and not 'myvideos', because
The InfoManager retreive id 10006 for myvideos while the server retreive 10024, and then nothing is displayed. Huh
The manual says that 10006 (myvideos) is a wraper to myvideosfiles but it seems taht there's some glue missing.

About the getWindow() returning NULL, that was my debugger that was losing context (yet XBMC was compiled with -O2 ) and somethings displaying NULL/0 values.


Howto test that

Enable http server in your skin.
With a web browser activate the window with this cmd :
Code:
ExecBuiltIn(ActivateWindow(myvideos))
then set the window property :
Code:
ExecBuiltIn(SetProperty(title,alienation 2))

In this order as the SetProperty() does not take any argument for a window ID and work with the current ID. I may add this feature if needed later.

I don't think that be useful for many people because most of us use simple remote and display everything on XBMC. But for more advanced remote and custom DB that could be interesting feature.


Code:
GUIInfoManager.cpp
  else if (strCategory.Left(6).Equals("window"))
  {
    CStdString info = strTest.Mid(strCategory.GetLength() + 1);
    // special case for window.xml parameter, fails above
    if (info.Left(5).Equals("xml)."))
      info = info.Mid(5, info.GetLength() + 1);
    if (info.Left(9).Equals("property("))
    {
      int winID = 0;
      if (strTest.Left(7).Equals("window("))
      {
        CStdString window(strTest.Mid(7, strTest.Find(")", 7) - 7).ToLower());
        winID = CButtonTranslator::TranslateWindowString(window.c_str());
      }
      if (winID != WINDOW_INVALID)
      {
        int compareString = ConditionalStringParameter(info.Mid(9, info.GetLength() - 10));
        return AddMultiInfo(GUIInfo(WINDOW_PROPERTY, winID, compareString));
      }
    }



- bizulk - 2010-05-12

Thanks to everyone who helped me !
Really XBMC rocks !


- bizulk - 2010-05-17

It also works when displaying image :

Code:
        <control type="image"> <!-- video jacket -->
            <posx>20</posx>
            <posy>20</posy>
            <width>222</width>
            <height>312</height>
            <texture>$INFO[window(myvideofiles).property(jacket)]</texture>
            <aspectratio>stretch</aspectratio>
        </control>



- bizulk - 2010-05-26

I wanted to set such screen for CD/playlist preview :
Image

For now I just :
  • Used info property for title, jacket, and tracks.
  • each track displayed is a label as I could not bind these info to a list container.

The problem is that I can't just do that way with tracks as I need the player to play the whole list.

I found that XBMC http API has commands for playlist manipulation :
Code:
AddToPlayList()
SetCurrentPlaylist()
GetPlaylistContents()
...

I'm using this a I can set XBMC to play all tracks alone.

But I did not find out which container ID (if there is one) can display the current playlist selected ?

Finally, is there any wiki page that list those container id association ?
When I give a look to Confluence/myPlaylistEditor(), sometime à see a reference to conainer ID 50 and sometimes a container ID 100, how are they selected ?

Otherwise I thought about writing a script that could fill a container, but which one ?

Thanks.