PluginOverview » History » Version 19

Leonid Protasov, 04/13/2015 09:09 AM

1 1 Andreas Smas
h1. Overview
2 1 Andreas Smas
3 18 Leonid Protasov
Plugins for Movian are written in ECMAScript.
4 6 Andreas Smas
5 18 Leonid Protasov
*Historically (since 2010 upto 2015 years) Movian Media Center included SpiderMonkey 1.8.0-rc JavaScript engine. Starting from Movian 4.9.401 SpiderMonkey is replaced with Duktape engine (http://duktape.org). 
6 1 Andreas Smas
7 13 Leonid Protasov
This document assumes the reader has good understanding of ECMAScript. There are plenty of books and sites on the subject so in this document is not going to waste space or time on teaching the ECMAScript language itself.
8 1 Andreas Smas
9 17 Leonid Protasov
Movian plugins do not interact directly to the user via the user interface (similar to a web browser) but rather respond to browse and search requests and populate the internal data model with information that is then presented to the user via Movian's user interface(s).
10 1 Andreas Smas
11 1 Andreas Smas
h1. Structure of a plugin
12 1 Andreas Smas
13 3 Leonid Protasov
Each plugin resides in a directory of it's own. This directory must contain a file *plugin.json* which contains information about the plugin.  For more information about this file, please see the section named plugin.json below.
14 1 Andreas Smas
15 1 Andreas Smas
Apart for the plugin.json file there are no further restrictions of what the files are named in the plugin directory or if files are placed in sub-directories, etc
16 1 Andreas Smas
17 1 Andreas Smas
h2. plugin.json
18 1 Andreas Smas
19 1 Andreas Smas
20 1 Andreas Smas
plugin.json is a JSON (http://www.json.org/) encoded text file
21 1 Andreas Smas
containing information about the plugin
22 1 Andreas Smas
23 1 Andreas Smas
Example of a plugin.json file (from the Headweb plugin):
24 1 Andreas Smas
25 1 Andreas Smas
<pre><code class="javascript">
26 1 Andreas Smas
{
27 10 Andreas Smas
  "type": "ecmascript",
28 10 Andreas Smas
  "apiversion": 1,
29 1 Andreas Smas
  "id": "headweb",
30 1 Andreas Smas
  "file": "headweb.js",
31 5 Leonid Protasov
  "showtimeVersion": "4.1.22",
32 5 Leonid Protasov
  "version": "1.5.3",
33 1 Andreas Smas
  "author": "Andreas Öman",
34 1 Andreas Smas
  "title": "Headweb",
35 1 Andreas Smas
  "icon": "headweb_square.png",
36 1 Andreas Smas
  "synopsis": "Headweb online video",
37 5 Leonid Protasov
  "category": "video",
38 5 Leonid Protasov
  "description": "<p>Headweb is a Swedish online video store.<p>For more information, visit <a href=\"http://www.headweb.com\">http://www.headweb.com</a>",
39 5 Leonid Protasov
  "homepage":"https://github.com/andoma/showtime-plugin-headweb"
40 5 Leonid Protasov
}</code></pre>
41 1 Andreas Smas
42 1 Andreas Smas
43 1 Andreas Smas
Description of fields and requirement of their presence:
44 1 Andreas Smas
45 1 Andreas Smas
h3. type (REQUIRED)
46 1 Andreas Smas
47 8 Andreas Smas
Type of plugin, as described by the following list.
48 8 Andreas Smas
49 1 Andreas Smas
* @[email protected] - Loads the plugin using Duktape.
50 15 Leonid Protasov
* @[email protected] - used for on screen keyboard plugin
51 1 Andreas Smas
52 10 Andreas Smas
h3. apiversion (OPTIONAL)
53 10 Andreas Smas
  
54 16 Leonid Protasov
Only applicable if type is @[email protected], ie. when running using the Duktape engine. This controls the API exposed by Movian to the plugin.
55 1 Andreas Smas
56 19 Leonid Protasov
* 1 - The version 1 API is the default and is compatible with the API which was exposed through the old SpiderMonkey engine.
57 13 Leonid Protasov
* 2 - The version 2 API is a new API which more resembles modern ECMAScript using modules and CommonJS interfaces. Please try to use this.
58 10 Andreas Smas
59 13 Leonid Protasov
The version 1 API is emulated using the version 2 API using JavaScript wrappers. The emulation code can be found here https://github.com/andoma/showtime/blob/master/resources/ecmascript/legacy/api-v1.js
60 1 Andreas Smas
61 1 Andreas Smas
h3. id (REQUIRED)
62 1 Andreas Smas
63 16 Leonid Protasov
Unique identifier for a plugin. The IDs are assigned by the Movian project. Any ID starting with the string "test" is reserved for development and can be used by plugin developers until a final ID has been assigned.  The assigned IDs will be ASCII lowercase.  To get an ID please mail [email protected]
64 1 Andreas Smas
65 1 Andreas Smas
h3. file (REQUIRED) 
66 1 Andreas Smas
  
67 1 Andreas Smas
Name of the plugin executable/script. Usually it's a good idea to give the file a name resembling the plugin ID.
68 1 Andreas Smas
69 1 Andreas Smas
h3. title (RECOMMENDED)
70 1 Andreas Smas
  
71 1 Andreas Smas
Short title of the Plugin. If omitted the 'id' field will be used instead which might look a bit bad due to lowercasing, etc
72 1 Andreas Smas
73 1 Andreas Smas
h3. showtimeVersion (RECOMMENDED)
74 1 Andreas Smas
75 16 Leonid Protasov
Minimum version required of Movian for this plugin to work. If the current version of Movian is less than this version the user won't be able to install the plugin but will be notified about what version
76 16 Leonid Protasov
of Movian is required. The same goes if a plugin is updated and the new version requires a newer version of Movian. Then the user will be refused to upgrade the plugin.  If this field is omitted Movian will assume the plugin works on all versions of Movian.
77 1 Andreas Smas
78 1 Andreas Smas
h3. version (RECOMMENDED)
79 1 Andreas Smas
80 16 Leonid Protasov
Version of the plugin. If this does not match the current installed version of a user's plugin the user will be presented with the possibility to upgrade the plugin. If the field is omitted Movian will set the version to "Unknown"
81 1 Andreas Smas
82 1 Andreas Smas
h3. category (RECOMMENDED)
83 1 Andreas Smas
84 16 Leonid Protasov
Category of the plugin. If the field is omitted Movian will set the category to "Unknown". Following categories are known:
85 15 Leonid Protasov
"tv" - online TV
86 2 Leonid Protasov
"video" - streaming video
87 4 Leonid Protasov
"music" - streaming music
88 2 Leonid Protasov
"glwview" - UI extentions
89 1 Andreas Smas
"subtitles" - subtitles
90 15 Leonid Protasov
"glwosk" - on screen keyboard
91 1 Andreas Smas
92 1 Andreas Smas
h3. synopsis (RECOMMENDED)
93 1 Andreas Smas
94 1 Andreas Smas
A short one line summary of the plugin or the service it accesses
95 1 Andreas Smas
96 1 Andreas Smas
h3. author (OPTIONAL)
97 1 Andreas Smas
98 3 Leonid Protasov
Plugin developer. Any UTF-8 characters are valid.
99 1 Andreas Smas
100 1 Andreas Smas
h3. homepage (RECOMMENDED)
101 1 Andreas Smas
102 4 Leonid Protasov
An URI with the location of the plugin homepage
103 1 Andreas Smas
104 1 Andreas Smas
h3. icon (OPTIONAL)
105 1 Andreas Smas
106 16 Leonid Protasov
Path to plugin icon. The path is relative to the plugin root directory. If no icon is available Movian will use a placeholder image instead.
107 1 Andreas Smas
108 1 Andreas Smas
h3. description (OPTIONAL)
109 1 Andreas Smas
110 1 Andreas Smas
Long rich-text formatted description of the plugin.