Added a getInfoTag to python.

  Thread Rating:
  • 0 Votes - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Post Reply
Nuka1195 Offline
Skilled Python Coder
Posts: 3,910
Joined: Dec 2004
Reputation: 18
Post: #1
i added a xbmc.getinfotag(int) to xbmcmodule.cpp.

before i submit the patch, i wondered if i should add all the infotag constants also? like you have for player and playlist...

also in guiinfomanager.h, i noticed a double entry, should i update that file and include it in the patch?

#define system_free_space_c 115
#define system_free_space_c 115

thanks

For python coding questions first see http://mirrors.xbmc.org/docs/python-docs/
find quote
jmarshall Offline
Team-XBMC Developer
Posts: 25,689
Joined: Oct 2003
Reputation: 169
Post: #2
cool.

i've added the fix for the #define in my local build as well.

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
Nuka1195 Offline
Skilled Python Coder
Posts: 3,910
Joined: Dec 2004
Reputation: 18
Post: #3
i changed it to:

xbmc.getinfolabel(int) and xbmc.getinfoimage(int). since there are overlaps of info. weather.conditions...

edit: i misunderstood what the constants at the bottom did. should there be a list of the values in the python doc?

For python coding questions first see http://mirrors.xbmc.org/docs/python-docs/
find quote
Nuka1195 Offline
Skilled Python Coder
Posts: 3,910
Joined: Dec 2004
Reputation: 18
Post: #4
patch 1496246 uploaded.

edit: changed so now it takes the actual infotag as input.

the format is:
xbmc.getinfolabel("weather.conditions")
xbmc.getinfoimage("weather.conditions")

should have thought of this first.

For python coding questions first see http://mirrors.xbmc.org/docs/python-docs/
find quote
Nuka1195 Offline
Skilled Python Coder
Posts: 3,910
Joined: Dec 2004
Reputation: 18
Post: #5
thanks for the fix,

i've noticed in the xbmc.html and xbmcgui.html that some descriptions are well written with an example. some are formatted better.

if i was to update these and maybe add an example if one would help. is this something that could go in before 2.0?

it only affects .cpp files in lib\libpython\xbmcmodule\.

if so i could run makedoc.py and submit the files to cvs.

For python coding questions first see http://mirrors.xbmc.org/docs/python-docs/
find quote
jmarshall Offline
Team-XBMC Developer
Posts: 25,689
Joined: Oct 2003
Reputation: 169
Post: #6
sure, that'd be great Smile

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
Nuka1195 Offline
Skilled Python Coder
Posts: 3,910
Joined: Dec 2004
Reputation: 18
Post: #7
the getcputemp() doesn't work. looking at cfancontroller::getcputempinternal() theres a lot different.

since you can now get the infolabel for it may i suggest deleting it? i doubt there are many if any scripts that use it.

also the sleep() method. i don't understand it. if it's suppose to do what the description says, it doesn't. when i tried using it. all it did was keep the script from continuing after that call. maybe it's not necessary eitherConfused

Quote: // sleep() method
pydoc_strvar(sleep,
"sleep(integer) -- sleeps for 'time' msec.\n"
"\n"
"throws: pyexc_typeerror, if time is not an integer\n"
"this is useful if you have for example a player class that is waiting\n"
"for onplaybackended() calls.\n");

pyobject* xbmc_sleep(pyobject *self, pyobject *args)
{
pyobject *pobject;
if (!pyarg_parsetuple(args, "o", &pobject)) return null;
if (!pyint_check(pobject))
{
pyerr_format(pyexc_typeerror, "argument must be a bool(integer) value");
return null;
}

long i = pyint_aslong(pobject);
while(i != 0)
{
py_begin_allow_threads
sleep(500);
py_end_allow_threads

py_makependingcalls();
i = pyint_aslong(pobject);
}

py_incref(py_none);
return py_none;
}

For python coding questions first see http://mirrors.xbmc.org/docs/python-docs/
find quote
thor918 Offline
Fan
Posts: 363
Joined: Jun 2004
Reputation: 0
Location: Norway
Post: #8
thanks nuka1195, i can see that infolabel can be a good addition to python.(i have allready taken one infolabel to use in my script)

i have added some resourcelinks to the python manuals in my signatur Wink
find quote
Nuka1195 Offline
Skilled Python Coder
Posts: 3,910
Joined: Dec 2004
Reputation: 18
Post: #9
thor, i added the links down with the functions, but i like your idea better. would you share your changes so i can add them in.

thanks

For python coding questions first see http://mirrors.xbmc.org/docs/python-docs/
find quote
thor918 Offline
Fan
Posts: 363
Joined: Jun 2004
Reputation: 0
Location: Norway
Post: #10
i'm not touching source.
all is done automatically in python script.
everytime a new xbmc is uploaded to my xbox,
a script will detect that a new version is in place,
it will then generate the python docs, add the resource links, and then connect to my ftp to upload the documents. it's very neat Smile

this script is a part of something else. i may release the whole thing, in the near future.
find quote
Nuka1195 Offline
Skilled Python Coder
Posts: 3,910
Joined: Dec 2004
Reputation: 18
Post: #11
i noticed the aspectratio has changed.

in the python docs, which is how it use to be.
Quote:"aspectratio : integer - (values 0 = scale down (black bars), 1 = scale up (crops), 2 = stretch (default)");

this is how it currently works.
Quote:"aspectratio : integer - (values 0 = stretch (default), 1 = scale up (crops), 2 = scale down (black bars)");

i just want to make sure it's going to stay this way.

thanks

For python coding questions first see http://mirrors.xbmc.org/docs/python-docs/
find quote
jmarshall Offline
Team-XBMC Developer
Posts: 25,689
Joined: Oct 2003
Reputation: 169
Post: #12
yes, that is the correct behaviour. stretch = 0 as default.

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
Nuka1195 Offline
Skilled Python Coder
Posts: 3,910
Joined: Dec 2004
Reputation: 18
Post: #13
(nuka1195 @ may 29 2006,22:52 Wrote:the getcputemp() doesn't work. looking at cfancontroller::getcputempinternal() theres a lot different.

since you can now get the infolabel for it may i suggest deleting it? i doubt there are many if any scripts that use it.

also the sleep() method. i don't understand it. if it's suppose to do what the description says, it doesn't. when i tried using it. all it did was keep the script from continuing after that call. maybe it's not necessary eitherConfused

Quote:  // sleep() method
 pydoc_strvar(sleep,
"sleep(integer) -- sleeps for 'time' msec.\n"
"\n"
"throws: pyexc_typeerror, if time is not an integer\n"
"this is useful if you have for example a player class that is waiting\n"
   "for onplaybackended() calls.\n");

 pyobject* xbmc_sleep(pyobject *self, pyobject *args)
{
pyobject *pobject;
if (!pyarg_parsetuple(args, "o", &pobject)) return null;
if (!pyint_check(pobject))
{
pyerr_format(pyexc_typeerror, "argument must be a bool(integer) value");
return null;
}

long i = pyint_aslong(pobject);
while(i != 0)
{
py_begin_allow_threads
sleep(500);
py_end_allow_threads

py_makependingcalls();
i = pyint_aslong(pobject);
}

py_incref(py_none);
return py_none;
}
i'm bumping this question for the getcputemp() and sleep() methods.

about the sleep() it looks to me that if you call it with any integer other than zero, it enters an endless loop.

can the sleep(500); statement be changed to sleep(i); and get rid of the while loop?

thanks

For python coding questions first see http://mirrors.xbmc.org/docs/python-docs/
find quote