Notice to addon devs

  Thread Rating:
  • 2 Votes - 5 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Post Reply
Martijn Offline
Team Kodi
Posts: 11,577
Joined: Jul 2011
Reputation: 167
Location: Dawn of time
Lightbulb  Notice to addon devs
Post: #1
script.module.elementtree

It seems that we are still using the script.module.elementtree however this is no longer needed since python version 2.5 and higher. Since XBMC uses python 2.6 or higher it is safe to use elementtree that has been included in python.

To use it simply include this (for example):
PHP Code:
import xml.etree.ElementTree as ET 

More information can be found here
http://docs.python.org/2/library/xml.etr...ttree.html

On next update it would be appreciated if you could replace the used module with the build in one.


script.module.simplejson
It seems that from python 2.7 and up the internal JSON lib is faster than the external script.module.simplejson that most of us use.
To test this out for yourself you can download script.json.performance-0.0.1.zip and try it out for yourself what the difference is.
Note: running the addon gives no indication during it's testing so have some patience until the dialog pops up.
Since some platforms use 2.6 you can use the following code to use the fastest method:
PHP Code:
if sys.version_info >=  (27):
    
import json as _json
else:
    
import simplejson as _json 



Tests done with JSON:
  • Windows: simplejson is 1.37x faster than json (python 2.6). No difference when using simpljeson version 2.0.10 and 3.3.0
  • Android: Android: simplejson is 1.41x faster than json (python 2.6). No difference when using simpljeson version 2.0.10 and 3.3.0
  • OpenELEC: json is 12.44x faster than simplejson (python 2.7). No difference when using simpljeson version 2.0.10 and 3.3.0
  • Ubuntu: json is 13.2x faster than simplejson (python 2.7). No difference when using simplejson version 2.0.10 and 3.3.0
  • iOS: untested
  • OSX: untested
  • rPi: untested

So all in all using simplejson doesn't seem like the obvious choice. So i would recommend every script dev to use the code posted in OP to use the fastest method.
results may differ per machine/test


Repo cleanup:
We are trying to keep things more tidy so once in a while we try to clean up broken addons or unmaintained ones.

Dharma:
If you have addons that are still in Dharma repo which should be marked broken or removed please contact us so we can take action. We will not allow any updates for them any more so only action is to remove or mark them broken.
Current list:
http://mirrors.xbmc.org/addons/dharma/

Eden:
If you have addons that are still in Eden repo which should be marked broken or removed please contact us so we can take action.
For Frodo we still allow updates so if you which you could also send an update. No new additions will be allowed.
Current list:
http://mirrors.xbmc.org/addons/eden/

Frodo:
We would like to request that you updated you plugin with the following: To be clear we will not remove them. We would just like to have a more consistent repository for future XBMC versions.
Current list: http://mirrors.xbmc.org/addons/frodo/


Remember that Eden and Frodo versions should differ regarding version number and xbmc.python version when submitted.

Thanks you.


Deprecate usage of explicitly setting the player in add-ons
We would like to ask when you update your plugin to no longer use the option for selection the internal player.
So instead of:
PHP Code:
xbmc.Player([core])
     *          - 
xbmc.PLAYER_CORE_AUTO
     
*          - xbmc.PLAYER_CORE_DVDPLAYER
     
*          - xbmc.PLAYER_CORE_MPLAYER
     
*          - xbmc.PLAYER_CORE_PAPLAYER 

just use:
PHP Code:
xbmc.Player() 
XBMC will auto select the player it needs.

Always read the XBMC online-manual, FAQ and search the forums before posting.
Do NOT e-mail Team-XBMC members asking for support. Read/follow the forum rules.
For troubleshooting and bug reporting, make sure you read this first

For your mediacenter artwork go to
[Image: fanarttv.png]
(This post was last modified: 2013-11-07 06:30 by Martijn.)
find quote
Eldorado Offline
Fan
Posts: 523
Joined: May 2009
Reputation: 14
Post: #2
Didn't know of this, thanks!

Is there a plan to remove script.module.elementtree from the xbmc repo?
find quote
Martijn Offline
Team Kodi
Posts: 11,577
Joined: Jul 2011
Reputation: 167
Location: Dawn of time
Post: #3
(2013-09-19 22:57)Eldorado Wrote:  Didn't know of this, thanks!

Is there a plan to remove script.module.elementtree from the xbmc repo?

not really Smile
to many addons rely on it. just thought i'd mention and might as well change it if we update our addons

Always read the XBMC online-manual, FAQ and search the forums before posting.
Do NOT e-mail Team-XBMC members asking for support. Read/follow the forum rules.
For troubleshooting and bug reporting, make sure you read this first

For your mediacenter artwork go to
[Image: fanarttv.png]
find quote
Martijn Offline
Team Kodi
Posts: 11,577
Joined: Jul 2011
Reputation: 167
Location: Dawn of time
Post: #4
Also added some information about simplejson module. if possible let us know the results if you test it

Always read the XBMC online-manual, FAQ and search the forums before posting.
Do NOT e-mail Team-XBMC members asking for support. Read/follow the forum rules.
For troubleshooting and bug reporting, make sure you read this first

For your mediacenter artwork go to
[Image: fanarttv.png]
find quote
Martijn Offline
Team Kodi
Posts: 11,577
Joined: Jul 2011
Reputation: 167
Location: Dawn of time
Post: #5
Tests done with JSON:
  • Windows: simplejson is 1.37x faster than json (python 2.6). No difference when using simpljeson version 2.0.10 and 3.3.0
  • Android: Android: simplejson is 1.41x faster than json (python 2.6). No difference when using simpljeson version 2.0.10 and 3.3.0
  • OpenELEC: json is 12.44x faster than simplejson (python 2.7). No difference when using simpljeson version 2.0.10 and 3.3.0
  • Ubuntu: json is 13.2x faster than simplejson (python 2.7). No difference when using simplejson version 2.0.10 and 3.3.0
  • iOS: untested
  • OSX: untested
  • rPi: untested

So all in all using simplejson doesn't seem like the obvious choice. So i would recommend every script dev to use the code posted in OP to use the fastest method.

Always read the XBMC online-manual, FAQ and search the forums before posting.
Do NOT e-mail Team-XBMC members asking for support. Read/follow the forum rules.
For troubleshooting and bug reporting, make sure you read this first

For your mediacenter artwork go to
[Image: fanarttv.png]
(This post was last modified: 2013-09-22 19:00 by Martijn.)
find quote
Martijn Offline
Team Kodi
Posts: 11,577
Joined: Jul 2011
Reputation: 167
Location: Dawn of time
Post: #6
Repo cleanup:
We are trying to keep things more tidy so once in a while we try to clean up broken addons or unmaintained ones.

Dharma:
If you have addons that are still in Dharma repo which should be marked broken or removed please contact us so we can take action. We will not allow any updates for them any more so only action is to remove or mark them broken.
Current list:
http://mirrors.xbmc.org/addons/dharma/

Eden:
If you have addons that are still in Eden repo which should be marked broken or removed please contact us so we can take action.
For Frodo we still allow updates so if you which you could also send an update. No new additions will be allowed.
Current list:
http://mirrors.xbmc.org/addons/eden/

Frodo:
We would like to request that you updated you plugin with the following: To be clear we will not remove them. We would just like to have a more consistent repository for future XBMC versions.
Current list: http://mirrors.xbmc.org/addons/frodo/


Remember that Eden and Frodo versions should differ regarding version number and xbmc.python version when submitted.

Thanks you.

Always read the XBMC online-manual, FAQ and search the forums before posting.
Do NOT e-mail Team-XBMC members asking for support. Read/follow the forum rules.
For troubleshooting and bug reporting, make sure you read this first

For your mediacenter artwork go to
[Image: fanarttv.png]
(This post was last modified: 2013-09-22 15:46 by Martijn.)
find quote
divingmule Offline
Skilled Python Coder
Posts: 1,297
Joined: Oct 2008
Reputation: 61
Post: #7
@Martijn

Any add-on's of mine in the Dharma repo should be considered unmaintained / likely broken.

Would you like for me to send a list?
find quote
Martijn Offline
Team Kodi
Posts: 11,577
Joined: Jul 2011
Reputation: 167
Location: Dawn of time
Post: #8
(2013-09-23 16:21)divingmule Wrote:  @Martijn

Any add-on's of mine in the Dharma repo should be considered unmaintained / likely broken.

Would you like for me to send a list?

send you mail with the list. thx

Always read the XBMC online-manual, FAQ and search the forums before posting.
Do NOT e-mail Team-XBMC members asking for support. Read/follow the forum rules.
For troubleshooting and bug reporting, make sure you read this first

For your mediacenter artwork go to
[Image: fanarttv.png]
find quote
realtebo Offline
Senior Member
Posts: 165
Joined: Apr 2013
Reputation: 0
Post: #9
About required elements in addon.xml [http://wiki.xbmc.org/index.php?title=Addon.xml#Required_additional_information]

Really is mandatory a forum url !?
I ve not a forum, what msut I do? Create a thread in this forum and then use the thread link as url ?
find quote
Martijn Offline
Team Kodi
Posts: 11,577
Joined: Jul 2011
Reputation: 167
Location: Dawn of time
Post: #10
(2013-09-24 20:43)realtebo Wrote:  About required elements in addon.xml [http://wiki.xbmc.org/index.php?title=Addon.xml#Required_additional_information]

Really is mandatory a forum url !?
I ve not a forum, what msut I do? Create a thread in this forum and then use the thread link as url ?

just keep it empty Smile

<forum></forum>

same for the others in that section if you do not want to fill them in.

Always read the XBMC online-manual, FAQ and search the forums before posting.
Do NOT e-mail Team-XBMC members asking for support. Read/follow the forum rules.
For troubleshooting and bug reporting, make sure you read this first

For your mediacenter artwork go to
[Image: fanarttv.png]
(This post was last modified: 2013-09-24 20:45 by Martijn.)
find quote
Martijn Offline
Team Kodi
Posts: 11,577
Joined: Jul 2011
Reputation: 167
Location: Dawn of time
Post: #11
Deprecate usage of explicitly setting the player in add-ons
We would like to ask when you update your plugin to no longer use the option for selection the internal player.
So instead of:
PHP Code:
xbmc.Player([core])
     *          - 
xbmc.PLAYER_CORE_AUTO
     
*          - xbmc.PLAYER_CORE_DVDPLAYER
     
*          - xbmc.PLAYER_CORE_MPLAYER
     
*          - xbmc.PLAYER_CORE_PAPLAYER 

just use:
PHP Code:
xbmc.Player() 
XBMC will auto select the player it needs.

Current list of addons that use this:
Quote:plugin.audio.listenliveeu
plugin.audio.modland
plugin.audio.qobuz
plugin.audio.radioma
plugin.audio.relive
plugin.video.4od
plugin.video.aljazeera
plugin.video.animeftw
plugin.video.goldpagemedia
plugin.video.irishtv
plugin.video.medi1tv
plugin.video.offene_kanaele
plugin.video.orftvthek
plugin.video.pakee
plugin.video.previewnetworks
plugin.video.sarpur
plugin.video.tvvn
plugin.video.vine
plugin.video.visir
plugin.video.wdrrockpalast
script.cu.lrclyrics
script.cu.lyrics
script.lrclyrics
script.module.playbackengine
script.mpdc
script.njoy
script.xbmc-pbx-addon

Always read the XBMC online-manual, FAQ and search the forums before posting.
Do NOT e-mail Team-XBMC members asking for support. Read/follow the forum rules.
For troubleshooting and bug reporting, make sure you read this first

For your mediacenter artwork go to
[Image: fanarttv.png]
(This post was last modified: 2013-09-29 17:55 by ronie.)
find quote
Martijn Offline
Team Kodi
Posts: 11,577
Joined: Jul 2011
Reputation: 167
Location: Dawn of time
Post: #12
Do not use os.getcwd()
There are still some addons that are using
PHP Code:
os.getcwd() 
Please update your plugins with
PHP Code:
xbmc.translatePath(xbmcaddon.Addon.getAddonInfo('path')).decode('utf-8'

This is the list of add-ons that are still using it:
Quote:plugin.image.500px
plugin.video.hockeystreams
plugin.video.nasa
plugin.video.previewnetworks
plugin.video.synopsi (used for testing outside XBMC: OK)
script.cinema.experience
script.games.rom.collection.browser
script.module.xbmcswift (used for testing outside XBMC: OK)
script.module.xbmcswift2 (used for testing outside XBMC: OK)
script.mythbox
service.watchdog (came with module, unused)

Always read the XBMC online-manual, FAQ and search the forums before posting.
Do NOT e-mail Team-XBMC members asking for support. Read/follow the forum rules.
For troubleshooting and bug reporting, make sure you read this first

For your mediacenter artwork go to
[Image: fanarttv.png]
(This post was last modified: 2013-10-09 13:24 by Martijn.)
find quote
Martijn Offline
Team Kodi
Posts: 11,577
Joined: Jul 2011
Reputation: 167
Location: Dawn of time
Post: #13
Do not use executehttpapi - it does not work since Frodo

PHP Code:
executehttpapi(httpcommand
Please update your script if you are still using this. It does not work anymore.

These are the ones still using it:
Quote:script.cdartmanager
script.cinema.experience
script.games.rom.collection.browser (got an exception to use it from me for now)
script.mythbox (code is commented out so no issue there)
plugin.video.pakee
plugin.video.previewnetworks

Always read the XBMC online-manual, FAQ and search the forums before posting.
Do NOT e-mail Team-XBMC members asking for support. Read/follow the forum rules.
For troubleshooting and bug reporting, make sure you read this first

For your mediacenter artwork go to
[Image: fanarttv.png]
(This post was last modified: 2013-09-29 18:32 by Martijn.)
find quote
malte Offline
Skilled Python Coder
Posts: 1,351
Joined: Jan 2010
Reputation: 28
Location: Germany
Post: #14
Is it ok to use it like this?

Code:
try:
    xbmc.executehttpapi("Action(199)")
except:
    xbmc.executeJSONRPC('{"jsonrpc":"2.0","method":"Input.ExecuteAction","params":{"action":"togglefullscreen"},"id":"1"}')

I don't want to maintain a branch for each release, so I tried to be backward compatible.
(This post was last modified: 2013-09-29 18:20 by malte.)
find quote
Martijn Offline
Team Kodi
Posts: 11,577
Joined: Jul 2011
Reputation: 167
Location: Dawn of time
Post: #15
(2013-09-29 18:20)malte Wrote:  Is it ok to use it like this?

Code:
try:
    xbmc.executehttpapi("Action(199)")
except:
    xbmc.executeJSONRPC('{"jsonrpc":"2.0","method":"Input.ExecuteAction","params":{"action":"togglefullscreen"},"id":"1"}')

I don't want to maintain a branch for each release, so I tried to be backward compatible.

I see you only use it twice. So imo it's ok for now. Do note that with current addon.xml you can't install it on Eden due to unmet dependency.

Always read the XBMC online-manual, FAQ and search the forums before posting.
Do NOT e-mail Team-XBMC members asking for support. Read/follow the forum rules.
For troubleshooting and bug reporting, make sure you read this first

For your mediacenter artwork go to
[Image: fanarttv.png]
find quote
Post Reply