Scripting Interface Design Overview

Peter Zhou peterzhoulei at gmail.com
Wed Apr 29 11:47:53 CEST 2009


1. The Qt binding generator
The default qtscript engine doesn't support Qt APIs, we need to load
the Qt modules manually when using the scripts.
The generator actually generates the API modules which can be loaded
by the engine.


2. script manager
The script manager loads each running script into the memory and
starts a script engine instance for each script.
The startScriptEngine function loads all the amarok API modules, and
the user can load the Qt APIs using loadQtBinding
function(ScriptImporter.h).

The amarok API modules are under the scriptengine directory, including:

Collection
Engine
Info (script working path, version, etc.)
Network(downloading tool)
Lyrics (interacting with the applets)
OSD
Playlist
Statusbar
Config (to store configuration info for the scripts)
Window (adding menus and other GUI related APIs)
Scriptable Service(loading the scriptable service, and the APIs of the
Service Plugin Manager)

Other tool classes:
MetaTypeExporter: for exporting the track meta type to the script engine
AmarokScript: General control tools, like quitAmarok(), debug(), alert(), etc.


There are several remaining work really concerns me:

1. Improving stability:
This is the top priority of preventing a script crashing Amarok. No
crash should be occur even the Qt bindings cannot be loaded into
Amarok.

2. Unit Test
well, this is currently Sven's work :)

3. An API version check function to notify users to update scripts

4. There are some API missing, and some to be improved:
  3.1 the collection API should be improved by exporting meta types
for collections. e.g someCollection.totalNum, someCollection.name,
someCollection.genres...
  3.2 configured signal is missing. There is no standard way to notify
a script for settings
  3.3 some other minor API missing


And btw. We need an encoding class to solve all the encoding issues. I
wrote it long time ago, but don't have time to test it yet :(


-- 
Cheers,
Peter ZHOU
-------------------------------
http://www.peterzl.net/


More information about the Amarok-devel mailing list