Using DLL's, threading, interpreter etc
#1
Hi,

Hi i'm new to XBMC development and information seems a bit scattered so I figured it might be better to just ask here =)

I'm basically looking to make an add-on that will require doing quite a lot of processing at start-up and continuing to update on a regular basis in the background but I don't want it to be bogged down waiting on callbacks and where possible to be processing things as efficiently as possible so my 2 main questions are:

-Is using external DLL's possible to speed things up where needed?
-Does XBMC's python interpreter support threading so I can set off multiple tasks that are depending on responses

Also I can't seem to find information on what interpreter XBMC uses. Is it an entirely custom interpreter that uses XBMC functionality only? Or does it use the standard OS python interpreters, and if so what version?
Reply
#2
- yes, but there is no distribution mechanism in place.
- yes.
- depends on platform, on linux it uses the system python 2.x, on others a separate python is built. it's not a custom interpreter, but there are custom xbmc modules which are exported directly by the xbmc binary (and thus is not available unless you run the script in xbmc).
Reply
#3
External DLLs are a very poor idea unless you are going to support them on every platform XBMC runs on.
If I have helped you or increased your knowledge, click the 'thumbs up' button to give thanks :) (People with less than 20 posts won't see the "thumbs up" button.)
Reply
#4
Thanks for the reply guys!

What do you mean by no distribution mechanism in place, do you mean just you can't distribute non-source in the official repo?

What would your recommended approach be for external code then nickr? The external code is going to be fairly generic stuff that python is generally slow at such as parsing large data files and maths with a lot of iteration.
Reply
#5
yes, precisely.
Reply
#6
(2014-06-03, 13:39)ironic_monkey Wrote: yes, precisely.

I'm not to bothered if it doesn't make it into the official repo to be honest :p
Reply
#7
you need to detect what platform the addon runs on and then use the correct compiled DLL
Read/follow the forum rules.
For troubleshooting and bug reporting, read this first
Interested in seeing some YouTube videos about Kodi? Go here and subscribe
Reply
#8
Take a look at Xsqueeze, it uses binaries which differ per platform.
If I have helped you or increased your knowledge, click the 'thumbs up' button to give thanks :) (People with less than 20 posts won't see the "thumbs up" button.)
Reply
#9
(2014-06-01, 01:30)ianuk2005 Wrote: Hi,

Hi i'm new to XBMC development and information seems a bit scattered so I figured it might be better to just ask here =)

I'm basically looking to make an add-on that will require doing quite a lot of processing at start-up and continuing to update on a regular basis in the background but I don't want it to be bogged down waiting on callbacks and where possible to be processing things as efficiently as possible so my 2 main questions are:

-Is using external DLL's possible to speed things up where needed?
-Does XBMC's python interpreter support threading so I can set off multiple tasks that are depending on responses

Also I can't seem to find information on what interpreter XBMC uses. Is it an entirely custom interpreter that uses XBMC functionality only? Or does it use the standard OS python interpreters, and if so what version?

As far as threading, yes it supports threading. Just 'import threading'...
One thing I have been considering is making the use of the external dll optional. Then you can provide instructions how the individual can download it so you can make use of it if they want the added features (in your case, increase processing speed). I think that's kosher with the official repo since you wouldn't be distributing the download with the addon. But I could be wrong.
Reply
#10
(2014-06-03, 21:46)nickr Wrote: Take a look at Xsqueeze, it uses binaries which differ per platform.

Thanks I'll definitely have a look at that to see how it's organised and handles platform detection

(2014-06-05, 18:47)KenV99 Wrote:
(2014-06-01, 01:30)ianuk2005 Wrote: Hi,

Hi i'm new to XBMC development and information seems a bit scattered so I figured it might be better to just ask here =)

I'm basically looking to make an add-on that will require doing quite a lot of processing at start-up and continuing to update on a regular basis in the background but I don't want it to be bogged down waiting on callbacks and where possible to be processing things as efficiently as possible so my 2 main questions are:

-Is using external DLL's possible to speed things up where needed?
-Does XBMC's python interpreter support threading so I can set off multiple tasks that are depending on responses

Also I can't seem to find information on what interpreter XBMC uses. Is it an entirely custom interpreter that uses XBMC functionality only? Or does it use the standard OS python interpreters, and if so what version?

As far as threading, yes it supports threading. Just 'import threading'...
One thing I have been considering is making the use of the external dll optional. Then you can provide instructions how the individual can download it so you can make use of it if they want the added features (in your case, increase processing speed). I think that's kosher with the official repo since you wouldn't be distributing the download with the addon. But I could be wrong.

That would be good, why are binaries not allowed to be distributed with addons anyway? Just to ensure open source?
Reply
#11
You can always make your own repo for distribution.
If I have helped you or increased your knowledge, click the 'thumbs up' button to give thanks :) (People with less than 20 posts won't see the "thumbs up" button.)
Reply
#12
(2014-06-05, 23:25)nickr Wrote: You can always make your own repo for distribution.

Yeah for now i'm focusing on getting to grips with the JSON-RPC-API and actually making the add on before I'm worrying about the distribution channel. It's always a pain working with new API's when you have no auto-complete for it in the IDE :p.

On a slightly off topic subject is there any way to breakpoint addon projects while they are running in XBMC, i'm not familiar enough with the different Python IDE's to know if it's possible like it is with other languages/IDE's.
Reply
#13
(2014-06-06, 10:45)ianuk2005 Wrote:
(2014-06-05, 23:25)nickr Wrote: You can always make your own repo for distribution.

Yeah for now i'm focusing on getting to grips with the JSON-RPC-API and actually making the add on before I'm worrying about the distribution channel. It's always a pain working with new API's when you have no auto-complete for it in the IDE :p.

On a slightly off topic subject is there any way to breakpoint addon projects while they are running in XBMC, i'm not familiar enough with the different Python IDE's to know if it's possible like it is with other languages/IDE's.
If by breakpoints you mean stop the script in the debugger:
You can setup PyDev as a remote debugger for breakpoints: http://wiki.xbmc.org/index.php?title=HOW...th_Eclipse
This works well with Eclipse or PyCharm (Pro - they will grant you a free license for work for XBMC) - I currently use PyCharm and include this at the beginning:
Code:
debug = True
remote = False
if debug:
    if remote:
        sys.path.append(r'C:\\Users\\Ken User\\AppData\\Roaming\\XBMC\\addons\\script.ambibox\\resources\\lib\\pycharm-debug.py3k\\')
        import pydevd
        pydevd.settrace('192.168.1.103', port=51234, stdoutToServer=True, stderrToServer=True)
    else:
        sys.path.append(r'C:\\Program Files (x86)\\JetBrains\\PyCharm 3.1.3\\pycharm-debug-py3k.egg')
        import pydevd
        pydevd.settrace('localhost', port=51234, stdoutToServer=True, stderrToServer=True)

In both cases it is considered 'remote' debugging because you aren't launching the script from the IDE...

Winpdb also works: http://wiki.xbmc.org/index.php?title=HOW...ith_WinPDB

For autocomplete within the Python API, you can install xbmcstubs: http://forum.xbmc.org/showthread.php?tid=173780
Unfortunately idk of anything similar for the JSONRPC API.
Reply
#14
(2014-06-06, 11:43)KenV99 Wrote:
(2014-06-06, 10:45)ianuk2005 Wrote:
(2014-06-05, 23:25)nickr Wrote: You can always make your own repo for distribution.

Yeah for now i'm focusing on getting to grips with the JSON-RPC-API and actually making the add on before I'm worrying about the distribution channel. It's always a pain working with new API's when you have no auto-complete for it in the IDE :p.

On a slightly off topic subject is there any way to breakpoint addon projects while they are running in XBMC, i'm not familiar enough with the different Python IDE's to know if it's possible like it is with other languages/IDE's.
If by breakpoints you mean stop the script in the debugger:
You can setup PyDev as a remote debugger for breakpoints: http://wiki.xbmc.org/index.php?title=HOW...th_Eclipse
This works well with Eclipse or PyCharm (Pro - they will grant you a free license for work for XBMC) - I currently use PyCharm and include this at the beginning:
Code:
debug = True
remote = False
if debug:
    if remote:
        sys.path.append(r'C:\\Users\\Ken User\\AppData\\Roaming\\XBMC\\addons\\script.ambibox\\resources\\lib\\pycharm-debug.py3k\\')
        import pydevd
        pydevd.settrace('192.168.1.103', port=51234, stdoutToServer=True, stderrToServer=True)
    else:
        sys.path.append(r'C:\\Program Files (x86)\\JetBrains\\PyCharm 3.1.3\\pycharm-debug-py3k.egg')
        import pydevd
        pydevd.settrace('localhost', port=51234, stdoutToServer=True, stderrToServer=True)

In both cases it is considered 'remote' debugging because you aren't launching the script from the IDE...

Winpdb also works: http://wiki.xbmc.org/index.php?title=HOW...ith_WinPDB

For autocomplete within the Python API, you can install xbmcstubs: http://forum.xbmc.org/showthread.php?tid=173780
Unfortunately idk of anything similar for the JSONRPC API.

Thank's I'm using the LiClipse atm so the eclipse steps should be exactly the same.

Unfortunately I don't think there will ever be anything for the JSON-RPC apart from external docs unless someone builds a python library around it. I'll have to get the stubs so I can at least auto-complete the python libs.
Reply

Logout Mark Read Team Forum Stats Members Help
Using DLL's, threading, interpreter etc0