I think being able to run a file by using XBMC.RunFile(filepath) would be a very usefull addition, instead of having to specify Media or XBE or Script, since you can now specify a file of any type using Skin.SetFile. Any possibility of this being added? There are several things I could use it for myself
This is easy to do in python itself. Parse the filename and call the appropriate method. With the argv capability a script might be all you need.
You are saying for the skinning engine correct?
yeah, sorry, i meant for the skinning engine. Like, if you want to have a custom button that you can configure to launch a script or XBE of your choice using Skin.SetFile, then you would have to have something like what I'm suggesting.
<onclick>$INFO[Skin.String(Variable_From_SetFile)]</onclick>
should work fine
Code:
"""
Launcher script
"""
import sys
import os
import xbmc
import xbmcgui
if ( __name__ == "__main__" ):
if ( len( sys.argv ) > 1 ):
file = sys.argv[ 1 ].strip().lower()
extension = os.path.splitext( file )[ 1 ]
if ( os.path.isfile( file ) ):
if ( extension == ".py" ):
xbmc.executebuiltin( "XBMC.RunScript(%s)" % file )
elif( extension == ".xbe" ):
xbmc.executebuiltin( "XBMC.RunXBE(%s)" % file )
elif( extension in ".mp3|.avi|.wav" ):
xbmc.Player().play( file ),
else:
xbmcgui.Dialog().ok( "File not playable!", file, "This file is not playable" )
name that default.py and then call it from your <onclick> similar to the following.
XBMC.RunScript(Q:\\scripts\\launcher\\default.py,$INFO[Skin.String(FilePath)])
Where FilePath is the name of the skin string you set
Edit: hehe, or what Jezz_X said
Somebody is making some buttons customizable from the gui
at least nukas says it dosn't exist
thanks, totally forgot about that