Notice to addon devs

  Thread Rating:
  • 2 Votes - 5 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Post Reply
Martijn Offline
Team Kodi
Posts: 11,937
Joined: Jul 2011
Reputation: 170
Location: Dawn of time
Post: #16
Use of string ID inside add-ons

It seems we haven't been to paying enough attention to which string IDs add-ons use. So for new add-ons will be paying more close attention and ask the authors to stay within the defined range before accepting.
  • strings 30000 thru 30999 reserved for plugins and plugin settings
  • strings 31000 thru 31999 reserved for skins
  • strings 32000 thru 32999 reserved for scripts
  • strings 33000 thru 33999 reserved for common strings used in add-ons

For add-ons already available we would like to ask kindly if possible to update the usage of the used string IDs within these defined ranges (or at least anywhere between 30000 and 33999)
If you you already have your add-on added to transifex it should be possible to transfer current translations to the new range.

Here's current list of add-ons in repo that are outside the defined range:
http://pastebin.com/rAsnf66X

Note:
If you are using skin xml files that may also be shipped within skins you need temporary keep the old ID to prevent breaking current skins that still have the xml files with the old ids. Just having the English ones should suffice. After this request the skinner to update the files accordingly.

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-05 23:46 by Martijn.)
find quote
malte Offline
Skilled Python Coder
Posts: 1,351
Joined: Jan 2010
Reputation: 28
Location: Germany
Post: #17
Is there a price for being on these lists every time? Smile

Quote:If you you already have your add-on added to transifex it should be possible to transfer current translations to the new range.
How would I do this? Just upload the new string.xml with new ids?

Quote:If you are using skin xml files that may also be shipped within skins you need temporary keep the old ID to prevent breaking current skins that still have the xml files with the old ids.
So I will have both ids in the string.xml (old and new) until all skins are updated?
find quote
takoi Offline
Team-Kodi Member
Posts: 803
Joined: Oct 2009
Reputation: 12
Location: Norway
Post: #18
(2013-09-29 18:04)Martijn Wrote:  Do not use os.getcwd()
This is the list of add-ons that are still using it:
Quote:service.watchdog
Should only be used in a script bundled with one of libraries (watchmedo.py). Never called in the addon. Could remove the file..
(This post was last modified: 2013-10-09 13:05 by takoi.)
find quote
Martijn Offline
Team Kodi
Posts: 11,937
Joined: Jul 2011
Reputation: 170
Location: Dawn of time
Post: #19
(2013-10-09 13:00)takoi Wrote:  
(2013-09-29 18:04)Martijn Wrote:  Do not use os.getcwd()
This is the list of add-ons that are still using it:
Quote:service.watchdog
Should only be used in a script bundled with one of libraries (watchmedo.py). Never called in the addon. Could remove the file..

shouldn't be a problem to leave it there
reason is that os.getcwd() could report the wrong folder when used inside XBMC.
i just did grep for that command. didn't look if it was actually used Smile

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:13 by Martijn.)
find quote
takoi Offline
Team-Kodi Member
Posts: 803
Joined: Oct 2009
Reputation: 12
Location: Norway
Post: #20
Yeah, I understand the issue and figured that's what you did, grep for it, so I'm just letting you know it isn't usedSmile
find quote
Martijn Offline
Team Kodi
Posts: 11,937
Joined: Jul 2011
Reputation: 170
Location: Dawn of time
Post: #21
(2013-10-07 17:49)malte Wrote:  Is there a price for being on these lists every time? Smile

Quote:If you you already have your add-on added to transifex it should be possible to transfer current translations to the new range.
How would I do this? Just upload the new string.xml with new ids?

Quote:If you are using skin xml files that may also be shipped within skins you need temporary keep the old ID to prevent breaking current skins that still have the xml files with the old ids.
So I will have both ids in the string.xml (old and new) until all skins are updated?
sorry for late response.
indeed just duplicate the strings, Transifex will pick them up once synced and as it has translation memory it shouldn't be to much effort on the translators side to adapt to these.

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
Eldorado Offline
Fan
Posts: 534
Joined: May 2009
Reputation: 14
Post: #22
(2013-09-19 22:44)Martijn Wrote:  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
else:
    
import simplejson as _json 

I'm having issues with this and it seems to be platform specific

I recently switched my script.module.metahandlers addon to use this method and when trying to load the json object returned from TMDB I receive an error that the 'loads' object does not exist:

Code:
12:48:49 T:2747266144   DEBUG: metahandler: Requesting TMDB : http://api.themoviedb.org/3/movie/tt1961680?language=en&api_key=b91e899ce561dd19695340c3b26e0a02&
12:48:49 T:2747266144   ERROR: metahandler: Error connecting to TMDB: 'module' object has no attribute 'loads'

Here's what I'm doing in code:

Code:
meta = simplejson.loads(net.http_GET(url,{"Accept":"application/json"}).content)

Basically net.http_GET() is a quick function that does an http request, this has always worked previously

So far this has been reported on OpenElec and Raspbmc installs, Windows and iOS have been verified as working fine, all running Frodo 12.2
find quote
ronie Online
Team-Kodi Member
Posts: 9,442
Joined: Jan 2009
Reputation: 165
Post: #23
(2013-11-04 00:41)Eldorado Wrote:  
Code:
12:48:49 T:2747266144   DEBUG: metahandler: Requesting TMDB : http://api.themoviedb.org/3/movie/tt1961680?language=en&api_key=b91e899ce561dd19695340c3b26e0a02&
12:48:49 T:2747266144   ERROR: metahandler: Error connecting to TMDB: 'module' object has no attribute 'loads'

i've seen that issue before.
if you encounter this error, you most likely have some third party addon installed that includes
either a json.py or simplejson.py module.


edit: see
http://forum.xbmc.org/showthread.php?tid=151806

Always read the Kodi online-manual, FAQ and search the forum before posting.
Do not PM or e-mail Team-Kodi members directly asking for support. Read/follow the forum rules.
For troubleshooting and bug reporting please make sure you read this first.
(This post was last modified: 2013-11-04 01:15 by ronie.)
find quote
Eldorado Offline
Fan
Posts: 534
Joined: May 2009
Reputation: 14
Post: #24
Ah... thanks ronie!

I think for now I'll just go back to the old method of using simplejson.. a bit annoying when people include common libs in their addons
find quote
Martijn Offline
Team Kodi
Posts: 11,937
Joined: Jul 2011
Reputation: 170
Location: Dawn of time
Post: #25
I had a json.py file I wrote myself. Same issue. Also don't import json as json but call it something else.

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
Rodrigo Offline
Junior Member
Posts: 7
Joined: Nov 2013
Reputation: 1
Post: #26
This is what I'm using atm:

Code:
import _json
if not 'load' in dir(_json):
    import simplejson as _json
(This post was last modified: 2013-11-14 17:33 by Rodrigo.)
find quote
rivy Offline
Junior Member
Posts: 19
Joined: Feb 2012
Reputation: 2
Post: #27
@Martijn,

In the Pandora addon (@ https://github.com/rivy/xbmc-pandora ), I'm currently forced to use:

PHP Code:
xbmc.Playerxbmc.PLAYER_CORE_MPLAYER ).playurlitem 

The audio stream URLs returned from Pandora are in .mp3 and .mp4 formats. And, in Frodo and the current monthly release of Gotham, leaving the xbmc.Player() to the default/AUTO logic causes a codec search failure (though only for the .mp4's):

Quote:19:05:15 T:10484 NOTICE: PANDORA: Item 0 http://audio-dc6-t1-3.pandora.com/access...3Paw%3D%3D
19:05:15 T:10484 NOTICE: PANDORA: Item 1 <xbmcgui.ListItem object at 0x1020B290>
19:05:16 T:11056 ERROR: CAudioDecoder: Unable to Init Codec while loading file http://audio-dc6-t1-3.pandora.com/access...3Paw%3D%3D

Is this a bug in the xbmc.Player()?

Or will there be some other method to push the Player() toward an audio codec search in Gotham?

Where should I go from this to avoid breaking the plugin when Gotham is released?

Thanks.
(This post was last modified: 2014-01-19 08:04 by rivy.)
find quote
Martijn Offline
Team Kodi
Posts: 11,937
Joined: Jul 2011
Reputation: 170
Location: Dawn of time
Post: #28
Sounds like a bug as it should detect what the mp4 actually is and play it as a music stream

please create a ticket on trac.xbmc.org and provide ways on how to reproduce (addon / stream and so on)

the logic for now won t be removed but about 99$ of the addons used it without it being actually needed. in your case it seems still needed due to some reason.

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
Bstrdsmkr Offline
Posting Freak
Posts: 803
Joined: Oct 2010
Reputation: 17
Post: #29
In the mean time I wonder if you might be able to bypass it by manually specifying a mime type on the listitem
find quote
rivy Offline
Junior Member
Posts: 19
Joined: Feb 2012
Reputation: 2
Post: #30
@Martijn,

I've posted a trac bug @ http://trac.xbmc.org/ticket/14854

@Bstrdsmkr,

Thanks for the suggestion. I'll try that idea.
find quote