PDA

View Full Version : SVN Scripts


Nuka1195
2007-02-23, 23:35
Updated: Feb 28th, 2007

This package is for skinners who want to include a link to a script in your skin and want some kind of message if the script doesn't exist.

What this does is, checks if the script exists, then runs it if it does. If not the user will get a dialog with the option to download the script. It grabs the latest tagged version.

Copy the folder from the package into your skin somewhere and link to the script in there.

<onclick>XBMC.RunScript(q:\skin\skin-name\extras\SVNScripts\XBMC Lyrics.py)</onclick>

*Updated:
This package includes all the scripts in SVN that have been tagged:

AccuWeather.py
Ambient Light Control Pad
Apple Movie Trailers.py
Poker Timer II
Tetris.py
XBMC Changelog.py
XBMC Lyrics.py
xStocks.py
Youtube.py (not tested, this is the original)
*more may be added in the future.

Download:
http://xbmc-scripting.googlecode.com/svn/tags/SVNScripts/SVNScripts.zip


*New:
There is also a version that supports sys.argv[]. No need for any updates when a new script is tagged.

*Note this version requires XBMC Rev-7908 or newer.

You link your button to launcher.py and supply the script name.

<onclick>XBMC.RunScript(q:\skin\skin-name\extras\SVNScripts_argv\launcher.py,XBMC Lyrics)</onclick>

***** committed to the main SVN trunk *****
Download version with sys.argv[] support from the main trunk.
http://xbmc-scripting.googlecode.com/svn/trunk/SVNScripts_argv

Thanks to Jezz_X for the original idea and Blittan for the download idea.

Abe87
2007-02-24, 00:00
Thanks for this Nuka.

This should be really useful.

Asteron
2007-02-24, 00:19
Hey this is a really good idea Nuka... :) great thinking as always. I guess if we could pass arguments there wouldnt be need to have different .py files?

Nuka1195
2007-02-24, 00:57
Yeah, it is, it was jezz's idea and blittan thought of the download.

If we had sys.argv[0], the script could just be named tight with no editing.

Asteron
2007-02-24, 04:12
If we had sys.argv[0], the script could just be named tight with no editing.
Ask and ye shall receive! http://sourceforge.net/tracker/index.php?func=detail&aid=1667605&group_id=87054&atid=581840

blittan
2007-02-24, 07:40
thought of that direction of development too, but was too tired when i coded the xbmcscripts one up.

nice thinking of you there :grin:

Nuka1195
2007-02-24, 08:42
Asteron, where the heck were you when i was trying to get this working? :)

Asteron
2007-02-24, 10:44
*shrug* It actually turned out pretty straightforward. Donno just put it up to SVN on 2007/02/24 Scripters can follow the following guide on the wiki to using arguments http://www.xboxmediacenter.com/wiki/index.php?title=Building_Scripts#Script_Arguments

Skinners should take note of the updated XBMC.RunScript definition here
http://www.xboxmediacenter.com/wiki/index.php?title=List_of_Built_In_Functions

Actually this is kinda big I think for skinners since alot of skins use python for things like selecting font color, now the skin can do all the GUI purely and let python do a simple backend without ever putting up its own gui. Doing the gui purely in the skin is sure to be easier for skinners.

For instance you can make a button that says "Purple Font" on it and the OnClick would be like
"XBMC.RunScript(Q:\skin\Project Mayhem III\extras\fontcolor.py,FFFF00FF)"

Maybe I should put this in a new topic?

Nuka1195
2007-02-24, 15:15
Might be a good idea for it's own thread and yes this adds a lot of possibilties.

Good job.

Nuka1195
2007-02-24, 19:18
@Asteron, is there anyway to set sys.argv[0] = scriptname?

Asteron
2007-02-24, 22:12
Nuka sys.argv[0] = scriptname but only when the script is launched by the builtin XBMC.RunScript(). This is the only place where I exposed argument support.

Really though most real scripts (not integrated into a skin) are just 'default.py' and so you might as well get a real name from os.getcwd()

edwinmcdunlap
2007-02-25, 02:51
Neat... I'm sure this will be very handy!

Solo0815
2007-02-25, 10:00
Nice!

That would be a nice idea for SVN-Skins, too ;)

Nuka1195
2007-02-25, 16:27
New version: Updated 1st post

Nuka1195
2007-02-28, 19:29
You may now get this in the main SVN trunk, just the argv version as that's the easiest to use. I also added a strip() to sys.argv[1] in case someone adds a space before or after the script name.

smuto
2007-03-04, 12:57
can u submit this to xbmc SVN?
one copy in a single location
'XBMC/python/Lib' - one module for every skin, always up to date

<onclick>XBMC.RunScript(q:\system\python\Lib\launcher.py,Ap ple Movie Trailers)</onclick>


mayby u can integrate launcher.py with script_exists_xbmcscripts.py
can u discussion with other people?
smuto