NOTE! New code changes that affects all scripts!
#1
Exclamation 
Three changes are coming to XBMC pythons implementation that will affect scripts.

The first is os.getcwd() will no longer append a semi-colon to the result. this should not affect most scripts, but in the future use os.getcwd() only.

The second affects ALL windowxml and windowxmldialog scripts. the fallbackPath is now scriptPath. you pass the scripts working directory (eg os.getcwd() ) your skins then need to be placed in "resources" folder ( eg scriptfolder/resources/skins/default )

The third moves the language folder (xbmc newly introduced builtin support for language files) into the same "resources" folder. ( eg scriptfolder/resources/language/English )

If there are any scripts in the scripting svn or addons svn that stop working and the scripter is noshow. please post here and they will be fixed.

thanks
For python coding questions first see http://mirrors.xbmc.org/docs/python-docs/
#2
Thanks for the info, some questions to clarify:

2) think I'm conforming to that already, is this example folder structure correct ?

<script_name>\resources\skins\Default\media
<script_name>\resources\skins\Default\PAL

with other skins being:
<script_name>\resources\skins\xTV
<script_name>\resources\skins\Vision2
etc

then in script calling a WindowXML class with a command such as:

Code:
DIR_HOME = os.getcwd().replace( ";", "" )
DIR_RESOURCES = os.path.join( DIR_HOME , "resources" )

win = myClassXML("script-bbb-textbox.xml", DIR_RESOURCES, "Default")

I've asked this before in a thread but was told it should be happening already , but it isn't, that is;

It fallsback to look in 'Default' for missing XML - it would be good if it could do the same for media (fallback to Default\media).
That way graphic files could be common to all skins, any special/changed ones would be supplied in the appropriate skins\<skin_name>\media folder ?
Saves on duplication/space especially if you've a lot of skins.


3) xbmc newly introduced builtin support for language files Can you point me to some info on how to use this, its not in the wiki. I'm assuming this is separate to the Language.py were all using (in svn) ?

From when will xbmc support these requirments ?

Any extra info appreciated as I've new myTV on the verge of release that I'd like to ensure will work with new builds.

thanks
BBB
Retired from Add-on dev
#3
1. that needs to change. just pass the scripts path os.getcwd(). xbmc appends "resources" to that path. win = myClassXML("script-bbb-textbox.xml", os.getcwd(), "Default")

2. not sure might be possible

3. very simple. don't import language.py, and instead use __language__ = xbmc.Language( os.getcwd() ).getLocalizedString . Nothing else needs to change if you used the language.py

4. it is in branch currently.
For python coding questions first see http://mirrors.xbmc.org/docs/python-docs/
#4
my own slight mod of Language.py(fromsvn) adds a func that returns the path of the current language.
eg .
<script_name>\resources\language\Dutch

Then I can use that language path to read in a language translated 'readme.txt', if it exists otherwise I fallback to English. I think a language translated 'readme.txt' would be welcome by users.

Code:
def get_base_path( self ):
        """ returns full language base path """
        module_dir = os.path.dirname( sys.modules['language'].__file__ )
        return os.path.join( os.path.dirname( module_dir ), Language.LANGUAGE_DIR_NAME )

Can I discover the same 'in use language subfolder' using the new builtin ?


thanks
Retired from Add-on dev
#5
i'll see if i can add a method for it, but we're in a freeze, so not sure when it can get in
For python coding questions first see http://mirrors.xbmc.org/docs/python-docs/
#6
BBB: use xbmc.getLanguage() to find out what language is loaded in xbmc..

os.path.join(os.getcwd(), 'resources', 'language', xbmc.getLanguage())
#7
i think he wants to know what language the script is using. incase there is no swedish for instance. though that would be impossible Smile
For python coding questions first see http://mirrors.xbmc.org/docs/python-docs/
#8
As 'resources\languages' has now become a standard subfolder its made it a bit easier. I've put together a func that gets the language base_path, checks to see if the script has a folder of that language, if not defaults to English.

The returned path can be used to then check for the existance of that language specific 'readme.txt'

eg <script_name>/resources/languages/Dutch/readme.txt

Even if the language folder exists but theres no readme.txt , using the base_path ( <script_name>/resources/languages ) I can drop back to English.

Alls good, well it would be if I could find an upto date xbmc_pc.exe that supports the recent changes , does it exist ?

thanks
BBB
Retired from Add-on dev
#9
Hmm, I'm running build #14921 on Linux and my WindowXML objects are now reporting that they can't find the right XML file, even with the appropriate directories moved and code altered.

My file structure is thus:
/home/dave/.xbmc/scripts/iplayer/resources/skins/Default/PAL/script-iplayer-programmes.xml
/home/dave/.xbmc/scripts/iplayer/default.py

And in the script, the WindowXML is created thus:
Code:
WindowXML("script-iplayer-programmes.xml", os.getcwd(), "Default")

But the script throws up the error for the above line:
Code:
TypeError: XML File for Window is missing

Any ideas? I can't see what I've done wrong. Needless to say, it worked fine before!
#10
Please disregard - things now seem to be working properly in build #15111. Ta!
#11
The TED Talks script doesn't work anymore.

Could someone fix it or point me in the direction as to how I can fix it myself?

Thank you Smile
Martin
#12
PS. The TED Talks script is from xbmcscripts but is also found here:
http://www.aphaea.net/wordpress/?page_id=15
#13
Does TED Talks use WindowXML ?

If not, then there is something else that is broken in the script.
#14
blittan Wrote:Does TED Talks use WindowXML ?

If not, then there is something else that is broken in the script.

I don't know, it worked fine until the Atlantis build.

I hoped someone here could fix it, I'm not a programmer myself sadly.
#15
Hmmm had the same with the Football script.. I will check if it uses XML tonight...

Logout Mark Read Team Forum Stats Members Help
NOTE! New code changes that affects all scripts!0