![]() |
|
|||||||
| Plugin/Script (Python) Development Developers forum for XBMC Python Plugins/Scripts. Scripters/coders only! Not for posting feature requests, bugs, or end-user support requests! |
![]() |
|
|
Thread Tools | Search this Thread | Display Modes |
|
|
#1 | |
|
Team-XBMC Developer
Join Date: Sep 2003
Posts: 530
![]() |
first of all 'python 2.3' is embedded into xbmc and you the need to do the following to get it working
extract the directories from python.rar (cvs\xbmc\python\python.rar) to "xbmc home dir\python\" and if you want some examples you should extract scripts.rar(cvs\xbmc\scripts\scripts.rar) to "xbmc home dir\scripts\" you will now have the next directory structure in xbmc xbmc * python * * * lib * * * temp * * * www * scripts * * * medusa you execute scripts thrue the myscripts gui which is under settings->scripts. currently there is no interaction with xbmc, for example you can't see any output from the python interpreter (this will be added because it's the only way to see where the script stops when an error occours) included in scripts.rar are the next files Quote:
__________________
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.
|
|
|
|
|
|
|
#2 |
|
Team-XBMC Project Manager
Join Date: Sep 2003
Location: Sweden
Posts: 10,582
![]() |
darkie, as the coder of xbmc's python interpreter can you tell us all a little more about the techical aspects behind it, things like; is it loaded into a pragma section?, is it or will it be loaded by default?, how much ram does it use?, once the python interpreter is loaded into memory will/can it be unloaded when not used anymore or is reboot nessesary?, once a python script is loaded into memory will/can it be unloaded when not running anymore?, where are you planning to take this development wise?, and how do you plan to implement it in the gui, now & later?
...and other things like that, tia
__________________
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. |
|
|
|
|
|
#3 |
|
Team MediaPortal
Join Date: Sep 2003
Posts: 509
![]() |
>is it loaded into a pragma section?
yes it is >is it or will it be loaded by default? no >how much ram does it use? when loaded about 350kbyte > once the python interpreter is loaded into memory will/can it be unloaded when not used anymore no, sorry?, >once a python script is loaded into memory will/can it be unloaded when not running anymore? yes frodo
__________________
XBMC Project Founder (Retired), now head programmer of MediaPortal |
|
|
|
|
|
#4 | |
|
Team-XBMC Project Manager
Join Date: Sep 2003
Location: Sweden
Posts: 10,582
![]() |
Quote:
__________________
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. |
|
|
|
|
|
|
#5 |
|
Team MediaPortal
Join Date: Sep 2003
Posts: 509
![]() |
why?
cause darkie couldnt get it to work (yet) hopefully he'll manage to fix it frodo
__________________
XBMC Project Founder (Retired), now head programmer of MediaPortal |
|
|
|
|
|
#6 | |
|
Team-XBMC Project Manager
Join Date: Sep 2003
Location: Sweden
Posts: 10,582
![]() |
Quote:
__________________
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. |
|
|
|
|
|
|
#7 |
|
Team MediaPortal
Join Date: Sep 2003
Posts: 509
![]() |
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
__________________
XBMC Project Founder (Retired), now head programmer of MediaPortal |
|
|
|
|
|
#8 |
|
Team-XBMC Developer
Join Date: Sep 2003
Posts: 530
![]() |
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.
|
|
|
|
|
|
#9 |
|
Team MediaPortal
Join Date: Sep 2003
Posts: 509
![]() |
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
__________________
XBMC Project Founder (Retired), now head programmer of MediaPortal |
|
|
|
|
|
#10 | |
|
Team-XBMC Developer
Join Date: Sep 2003
Posts: 530
![]() |
ok, made a little progress.
with python now, you can use the 4 dialogs (dialogok, dialogyesno, dialogselect, and dialogprogress) Quote:
__________________
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.
|
|
|
|
|
![]() |
| Bookmarks |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | Search this Thread |
| Display Modes | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Running python-scrips from "My Videos" | theni9e | Plugin/Script (Python) Help and Support | 23 | 2006-10-25 17:26 |
| How about a "4:3 Expanded" view mode? ie. "16:9 Pan and Scan", or "14:9 Stretched" | LaTropa64 | XBMC Feature Suggestions | 34 | 2006-09-27 12:47 |
| Telnet/SSH access to XBMC python interpreter | sumanthjv | Plugin/Script (Python) Development | 4 | 2006-03-23 15:02 |
| python "loadskin" | bitplane | XBMC Feature Suggestions | 1 | 2004-04-13 11:28 |
| Stuck inside "My Videos" submenu | bburtin | XBMC for Xbox Specific Support | 2 | 2004-02-26 08:42 |