Python script package specs
#1
hi,

xbmcscripts.com will launch a xml service sometime in the not awfully near future (along with a script for direct download to the xbox) and with that change all scripts will have to be in a certain format before submission or else they won't be approved. this change will of course be announced on the main page.

why do we need a common script package format?

this has a simple answer - xbmc integration (ala scriptrunner). in order to install scripts easily and show information from them there needs to be a standardized format.

this is what i have in mind at the moment.

-zip only (there's no rar libs for python afaik and no support for it in xbmc)
- all information about the script (changelog, whatever) is to be displayed in "readme.txt" inside the script.
- thumbnails is to be called "thumb.png"

all of this is open for suggestions. now i also need suggestions for how to handle the installation of the scripts. i am thinking of perhaps a xml inside the script with various information like name of script, version, launch file, description. this file would be up to the authors to make of course and would serve as information in the launcher. of course the xml could include data for name of readme and thumb, but files should be called that in either case i think. anything else that should be in?

there is one problem that exists with todays script, which is that many needs to be edited. this could be solved with all settings stored in xml and an editor inside the download script could edit it. it's rather hard to use xml in python though if you are a newbie which is a drawback, but maybe if someone wrote a good tutorial.

again, please, i need you input. anything that would make things easier to achieve is greatly appreciated.
xbmcscripts.com administrator
Reply
#2
this is a great initiative you are doing enderw :-) i am thinking out-loud for the rest of this...

png's should be a fixed size for easier layout on the site and in the script.

as far as metadata you may want to keep track of

title - shown in a control list
author - tied to the xbmcscripts.com account
version number - check this against the version number on the server and compare
date - last updated date or local and server version (maybe use instead of version number)
description - a short one or two line description advertizing the
function of the script.
guide - a somewhat longer description / instructions
changelog - displayed if you hit the white/info button on a script? shown after update? maybe changelog + guide = readme.txt
thumbnail - shown in preview off to the side...
icon - shown in list control (if we could get the listview going in python!Wink
usage - edit incremented everytime you launch the script, list sorted by this...
rating - edit ability to vote on how well you like a script... stats stored on server...

scripts that require customization is a challenge... i am a fan of all settings being customizable in script myself with no editting of anything...

a settings manager is kind of tough... maybe something with
name = getsetting("name",defaultvalue)
...
savesetting("name",name)
...
maybe define a set of data types (int, string) that are managed?

some more conventions:
all files of a script reside in the directory
q:\scripts\<title>
the main python file to run is
q:\scripts\<title>\<title>.py

q:\scripts\temp should be used for tempfiles?

the .zip file contents...
Quote:<title.zip>
|
|--<title> a folder
|
readme.txt
description.xml
icon.png
thumb.png
<title>.py
other files

how about a skin manager while we are at it...
Reply
#3
you don't need to store theme as xml files at server.
one possebility is to store info in a mysql database, then use php script(serverside script) to generate the xml
(xml for communication and the xml for the scriptlauncher/downloader)for the xbox.

i think that the reson that scriptrunner was left, was that it was stored as xml files at server, witch resultet in a system that was timeconsuming to update with new scripts.
a database soulutoion would make it more admin friendly.

if you store them in a database you could make a custom upload page that has a fileupload field and other input formfields for the other info.that way the author really don't have to know xml to submit.

hope i did understand you and you understand me :thumbsup:
i will help if i can. i now asp, some php and mysql.
Reply
#4
ok, i think i gotta clear some thing up. don't worry about the serverside of things, it's as good as done but not available to public yet. it queries the mysql db where the scripts are already stored and gets info from here (name, date, description, download hits and of course link). i will only keep one db, not two seperate ones - hence all scripts already on the site will be readded sometime in compliance with whatever guidelines that come out of this. the drawback with this is that the only data i have to go after is date, which sometimes can be deceiving...especially if updated twice the same day. i don't think this drawback is too large though, compared to the easiness of using it the way it is now.

as for editing other scripts, it's a real challenge and not something that would be in early versions at least. i am quite sure i won't be coding this whole script alone as my skills aren't all that great, but at least the foundation needs to be worked out and i think that will be done by my only. we'll see...keep the ideas coming.

oh, and a skin site is out of the question, sorry. this is way too time consuming as it is...
xbmcscripts.com administrator
Reply
#5
i think that it would be great to have a common settings system for all scripts and that it could be run from scriptrunner. the simplest thing would be if all scripts included a changesettingsdialog() that scriptrunner somehow could call.


alternatively an xml solution might be the way to go. maybe like this:
Quote:settings>
       <group name="connection">
               <param name="host address" type="string">
                       <value><[cdata[monkey.com]]></value>
               </param>
               <param name="secure" type="boolean">
                       <value>1</value>
               </param>
               <param name="timeout" type="float">
                       <value>7.0</value>
                       <desc>socket timeout (seconds)</desc>
               </param>
               <param name="mode" type="select">
                       <option>server</option>
                       <option>client</option>
                       <option>server+client</option>
                       <value>0</value>
               </param>
       </group>
</settings>

in the change settings dialog you can not create new params/groups or change names/types. you can only change the values.

another type that might be nice to have is a string-list where you can append and remove entries.

from the scripts point of view:

Quote:import xbmcscriptsettings #a new common settings system
settings=xbmcscriptsettings.settings()
timeout=settings.get("connection/timeout")

settings.set("connection/timeout",10.0) #should it be saved in the destructor or explicitly?

it would also be great if you could do like this:

xbmcscriptsettings.changesettingsdialog()

however in many cases this wouldn't be flexible enough. for example flexibrowser would need a way of enabling and disabling plugins (which can not be written as a static list).
Reply
#6
wow.... how can i help?
Reply
#7
Quote:some more conventions:
all files of a script reside in the directory
q:\scripts\<title>
the main python file to run is
q:\scripts\<title>\<title>.py

the way i have my files setup is:

the python script resides in the main scripts folder, with a thumbnail.
q:\scripts\<title>.py (script)
q:\scripts\<title>.tbn (thumbnail)

there is only one folder in the main scripts folder, with subfolders for special files and images.
q:\scripts\extras folder\<title>\extras\

then a temp folder for each <title> (may not be necessary)
q:\scripts\extras folder\<title>\temp\

this keeps my scripts folder clean and nice for icon view. i link the submenu button on the home page directly to the scripts folder instead of the popup menu.

all additional files that need to be imported, i put in the python\lib folder. (does anybody know how to import a file in a location other than the current working directory or the python folder?)

i think this is a nice layout and makes the script screen work nice.

sorry, in case i missed it, but, if any of the scripts images (i.e. background) is skin dependent, then the script should eliminate any reference to a folder.
For python coding questions first see http://mirrors.xbmc.org/docs/python-docs/
Reply
#8
a script launcher/updater will obviate the need for keeping your scripts folder tidy... the launcher should support thumbnail icons as well as a preview picture and short description.
however, i agree that the final spec should look nice when the script folder is viewed manually and i like your idea...
Reply
#9
thanks for the input so far.

i agree that the folders should be tidy, but forcing all scripts to use a q:\scripts\data\scripname\scriptdata folder would be a bit too much. keeping extras in q:\scripts\scripname\data would be good enough imo.

would it be too much expecting users to be able to parse xml in their scripts for settings? somehow i think that perhaps scripts should handle settings inside themselves instead of a luncher script calling either a xml or a function inside the script. seems to me that it would make it easier both on me and give the coder more configurability. opinions?
xbmcscripts.com administrator
Reply
#10
my idea of installing is:
- download zip file with script
- unzip in a folder (maybe each user can set in scriptlauncher his favorite "base" folder for scripts)
- run a "install" method of the script, in this way script can finish the installation as it wants
Reply
#11
(sambarza @ april 20 2005,21:42 Wrote:my idea of installing is:
- download zip file with script
- unzip in a folder (maybe each user can set in scriptlauncher his favorite "base" folder for scripts)
- run a "install" method of the script, in this way script can finish the installation as it wants
hmm...in my opinion this wouldn't be neccessary and i'd bet most people wouldn't code the install part well enough - something that could screw things up quite a bit. i am pretty sure it will be straightforward unzip to dir using scriptname. if you have any more arguments why i should use another method please come with them though.
xbmcscripts.com administrator
Reply
#12
in that case we could have a zip looking like this:
\scripts\nrkbrowser\nrkbrowser.py
\scripts\nrkbrowser\script.tbn
\lib\clientcookie\*

extract the following to q: and then you would have extraction of libs too. the serverside script have to snatch the script.tbn out of the zip then. ohy well i have non good ideas to come with right now. but anyways i think this looks promising Wink
Reply
#13
Quote: i'd bet most people wouldn't code the install part well enough

install method will be not mandatory and however will be very easy to implement... and is easy to call...

in the case the method is missing the script is only extracted from the zip...

Quote:if you have any more arguments

for example in my script (xmbc-ecp) a template must be set in emule, in the install method i can display a simple popup saying:
"ok installed, now set in emule file emule.tmpl as template"

and then run my configuration wizard...

i want to say that an install method is easy to implement... why not implement? :d

Quote:in that case we could have a zip looking like this:
\scripts\nrkbrowser\nrkbrowser.py
\scripts\nrkbrowser\script.tbn
\lib\clientcookie\*
in zip there will be:

nrkbrowser\nrkbrowser.py
nrkbrowser\script.tbn
nrkbrowser\clientcookie\*

unzip to:
<basefolder>\nrkbrower\nrkbrowser.py
<basefolder>\nrkbrowser\script.tbn
<basefolder>\nrkbrowser\clientcookie\*

<basefolder> is a setting in scriptlauncher...

for the library i prefer copy in personal script folder not in shared library folder... (the size of the library is not so important)

you can change library path with:
sys.path.append(sys.path[0] + "\\emuleconnector")
Reply
#14
(nuka1195 @ april 20 2005,19:30 Wrote:(does anybody know how to import a file in a location other than the current working directory or the python folder?)
see flexibrowser i'm importing from a subfolder.
bernd
Reply
#15
thank you bernd and nice job with your script.
For python coding questions first see http://mirrors.xbmc.org/docs/python-docs/
Reply

Logout Mark Read Team Forum Stats Members Help
Python script package specs0