why?
cause darkie couldnt get it to work (yet)
hopefully he'll manage to fix it
frodo
Frodo
Team MediaPortal Posts: 509 Joined: Sep 2003 |
2003-10-11 15:13
Post: #11
|
| find |
Gamester17
Team-XBMC Forum Moderator Joined: Sep 2003 Reputation: 9 Location: Sweden |
2003-10-11 17:35
Post: #12
(frodo @ oct. 11 2003,14:13 Wrote:why? cause darkie couldnt get it to work (yet)hehe, i meant the technical reason. i already knew that it didn't, i just thought i start an open dev/code discussion here 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. |
| find |
Frodo
Team MediaPortal Posts: 509 Joined: Sep 2003 |
2003-10-11 18:33
Post: #13
k here's why:
python is using lots of static functions & vars the problem is that static functions & vars dont work with section loading. we didnt find a solution to this yet there's one solution and thats 2 rewrite python so it doesnt use any static things anymore. but thats a lot of work so if any compiler/xdk/c++ guru's know a way how to get section loading 2 work with static vars & functions please let us know frodo |
| find |
darkie
Team-XBMC Developer Posts: 529 Joined: Sep 2003 Reputation: 0 |
2003-10-13 16:43
Post: #14
k, first of all, python is made for working in processes and not threads, that means if you run a program in windows and stop it, all used memory is given back to the operating system.
since the xbox doesn't work with processes used memory that isn't released by python won't be given back to the xbox. python is managing memory in a special way. it doesn't allocate memory for every object or string that is created, but instead it allocates 256k(called an area) of memory at once and keeps track of all objects, strings that are placed in it. once you don't need an object anymore, python removes it from the 256k area but doesn't give the memory back to the system, instead when a new object is created, this object is placed in that free part of the area. python does this because it is faster then allocating / deallocating memory. when more then 256k of memory is needed another area of 256k is created and so on. all these area's are only released when a proces ends, and there is the problem on the xbox. memory once needed for a script in python is never given back to xbmc. python as it exists in xbmc is created with 2 pragma section: python and py_rw. python is a section which contains c / c++ code and memory that can't change, this section is about 800k. py_rw contains variable memory that is modified when python is used, this section is about 300k. at startup of xbmc none of these sections are loaded, python doesn't use any memory at all. when a python script is selected in xbmc to execute. both python and py_rw are loaded into memory and python is initialized. at this moment 1200k of memory is used. now the script is beeing executed and if it needs memory for storing stuff a new area (see above) is created. that means that if a script uses 4 areas, a total of 4 * 256k + 1200k = 2200k of memory is used from the 64mb available on the xbox. when the script ends, all 4 areas are cleaned so they can be used when an user selects a next script to execute( 4 * 256k of memory isn't given back to the xbox! .section python will be unloaded by xbmc and py_rw is not unloaded. at this moment, 1 mb for the areas and 300k for py_rw is in use by python. if we select another script to run, section python is loaded again. if this scripts would need 750k of memory, python will use the existing areas for it. that means 2200k of memory is used i didn't unload py_rw because loading it again will reset all memory. if we would unload py_rw and load it when we would need python again. python would think there where no areas created before and therefore creates new areas. at this moment the 1 mb of areas created for the first script is lost and will never be used again (a memory leak of 1 mb! ![]() that was the technical part, so what can you expect to come. well there are still some small bugs to fix (including 256k areas that are never given back to xbmc). currently i am buzy to integrate some xbmc stuff into xbmc, like a yes / no dialog and the progress dialog. for example, you could use the progress dialog when downloading a file from ftp so an user could see how long it takes before it would finish. darkie 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. ![]() |
| find |
burriko
Senior Member Posts: 199 Joined: Oct 2003 Reputation: 0 |
2003-10-15 00:01
Post: #15
(darkie @ oct. 13 2003,15:43 Wrote:currently i am buzy to integrate some xbmc stuff into xbmc, like a yes / no dialog and the progress dialog. for example, you could use the progress dialog when downloading a file from ftp so an user could see how long it takes before it would finish.sounds good. i was thinking about writing some python scripts to control a tivo over the network. just simple tasks such as deleting shows, etc. to complement duo's work on streaming video from tivo. i don't think it should be too difficult. i would need python to be able to display a list of objects (in the same format as it displays a list of videos or mp3s would be great) in xbmc and then wait for the user to select one and pass the selected option on to the script. is that functionality likely to be available to python? |
| find |
Frodo
Team MediaPortal Posts: 509 Joined: Sep 2003 |
2003-10-15 08:20
Post: #16
darkie, thx for the explanation.
i still think python in xbmc has a lot of potential especially when its able to access xbmc stuff like dialogs,windows etc. things i would like 2 see for python: 1. bind a button control to a script. so pressing a button will run a script 2. python scripts should b able to use the controls like: - cguiimage to display an image - list control - text area - button - spincontrol 3. mapping of keys -> python with these 3 things one should b able to build almost anything in pyton frodo |
| find |
Gamester17
Team-XBMC Forum Moderator Joined: Sep 2003 Reputation: 9 Location: Sweden |
(frodo @ oct. 15 2003,07:20 Wrote:things i would like 2 see for python:a nice place for one of those buttons would be under the future tv-guide, user could link it to a grab tv listings script 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. |
| find |
windragz
Junior Member Posts: 17 Joined: Oct 2003 Reputation: 0 Location: Australia |
2003-10-16 19:47
Post: #18
frodo, we are on the same page!!
windragz it difficult to break 2048 bit as try to find a sock at morning, it's just matter of time. |
| find |
darkie
Team-XBMC Developer Posts: 529 Joined: Sep 2003 Reputation: 0 |
2003-10-17 23:59
Post: #19
ok, made a little progress.
with python now, you can use the 4 dialogs (dialogok, dialogyesno, dialogselect, and dialogprogress) Quote:1. bind a button control to a script.1 and 2 are both possible, but what exactly do you mean with 3. mapping of keys -> python? 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. ![]() |
| find |
burriko
Senior Member Posts: 199 Joined: Oct 2003 Reputation: 0 |
2003-10-18 20:10
Post: #20
i just tested out a python script in xbmc that i wrote to delete a show from a networked tivo, and it worked great. it should be quite easy to add a lot of extra functionality to xbmc using python.
darkie, how exactly do you use the 4 dialogs that you've added so far? i can't find any example scripts or documentation. thanks, burriko. |
| find |

.![[Image: badge.gif]](http://www.ohloh.net/projects/149/badge.gif)
Search
Help