PluginOverview » History » Version 25

Leonid Protasov, 06/29/2015 08:27 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 23 Leonid Protasov
*Starting from v4.9.401 Movian uses Duktape engine (http://duktape.org). 
6 1 Andreas Smas
7 22 Leonid Protasov
This document assumes the reader has some ECMAScript knowledge background. There are plenty of books and sites on learning the language itself so this guide is concentrated on the engine features.
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 25 Leonid Protasov
Is a JSON (http://www.json.org/) encoded text file containing information about the plugin. Example from the Headweb plugin:
20 1 Andreas Smas
21 1 Andreas Smas
<pre><code class="javascript">
22 1 Andreas Smas
{
23 10 Andreas Smas
  "type": "ecmascript",
24 10 Andreas Smas
  "apiversion": 1,
25 1 Andreas Smas
  "id": "headweb",
26 1 Andreas Smas
  "file": "headweb.js",
27 5 Leonid Protasov
  "showtimeVersion": "4.1.22",
28 5 Leonid Protasov
  "version": "1.5.3",
29 1 Andreas Smas
  "author": "Andreas Öman",
30 1 Andreas Smas
  "title": "Headweb",
31 1 Andreas Smas
  "icon": "headweb_square.png",
32 1 Andreas Smas
  "synopsis": "Headweb online video",
33 5 Leonid Protasov
  "category": "video",
34 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>",
35 5 Leonid Protasov
  "homepage":"https://github.com/andoma/showtime-plugin-headweb"
36 5 Leonid Protasov
}</code></pre>
37 1 Andreas Smas
38 1 Andreas Smas
39 1 Andreas Smas
Description of fields and requirement of their presence:
40 1 Andreas Smas
41 1 Andreas Smas
h3. type (REQUIRED)
42 1 Andreas Smas
43 8 Andreas Smas
Type of plugin, as described by the following list.
44 8 Andreas Smas
45 1 Andreas Smas
* @[email protected] - Loads the plugin using Duktape.
46 15 Leonid Protasov
* @[email protected] - used for on screen keyboard plugin
47 1 Andreas Smas
48 10 Andreas Smas
h3. apiversion (OPTIONAL)
49 10 Andreas Smas
  
50 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.
51 1 Andreas Smas
52 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.
53 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.
54 10 Andreas Smas
55 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
56 1 Andreas Smas
57 1 Andreas Smas
h3. id (REQUIRED)
58 1 Andreas Smas
59 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]
60 1 Andreas Smas
61 1 Andreas Smas
h3. file (REQUIRED) 
62 1 Andreas Smas
  
63 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.
64 1 Andreas Smas
65 1 Andreas Smas
h3. title (RECOMMENDED)
66 1 Andreas Smas
  
67 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
68 1 Andreas Smas
69 1 Andreas Smas
h3. showtimeVersion (RECOMMENDED)
70 1 Andreas Smas
71 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
72 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.
73 1 Andreas Smas
74 1 Andreas Smas
h3. version (RECOMMENDED)
75 1 Andreas Smas
76 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"
77 1 Andreas Smas
78 1 Andreas Smas
h3. category (RECOMMENDED)
79 1 Andreas Smas
80 16 Leonid Protasov
Category of the plugin. If the field is omitted Movian will set the category to "Unknown". Following categories are known:
81 15 Leonid Protasov
"tv" - online TV
82 2 Leonid Protasov
"video" - streaming video
83 4 Leonid Protasov
"music" - streaming music
84 2 Leonid Protasov
"glwview" - UI extentions
85 1 Andreas Smas
"subtitles" - subtitles
86 15 Leonid Protasov
"glwosk" - on screen keyboard
87 1 Andreas Smas
88 1 Andreas Smas
h3. synopsis (RECOMMENDED)
89 1 Andreas Smas
90 1 Andreas Smas
A short one line summary of the plugin or the service it accesses
91 1 Andreas Smas
92 1 Andreas Smas
h3. author (OPTIONAL)
93 1 Andreas Smas
94 3 Leonid Protasov
Plugin developer. Any UTF-8 characters are valid.
95 1 Andreas Smas
96 1 Andreas Smas
h3. homepage (RECOMMENDED)
97 1 Andreas Smas
98 4 Leonid Protasov
An URI with the location of the plugin homepage
99 1 Andreas Smas
100 1 Andreas Smas
h3. icon (OPTIONAL)
101 1 Andreas Smas
102 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.
103 1 Andreas Smas
104 1 Andreas Smas
h3. description (OPTIONAL)
105 1 Andreas Smas
106 1 Andreas Smas
Long rich-text formatted description of the plugin.