PluginOverview » History » Version 11
Andreas Smas, 11/25/2014 12:09 PM
1 | 1 | Andreas Smas | h1. Overview |
---|---|---|---|
2 | 1 | Andreas Smas | |
3 | 6 | Andreas Smas | Plugins for Showtime are currently written in JavaScript. |
4 | 6 | Andreas Smas | |
5 | 7 | Andreas Smas | *Since 2010 showtime have been using SpiderMonkey 1.8.0-rc as Javascript engine. However, Spidermonkey planning to be phased out and be replaced with an engine called Duktape (http://duktape.org). Currently both engines are included in the binary. Most of the features are compatible and a special document will be crafted on how to upgrade plugins.* |
6 | 1 | Andreas Smas | |
7 | 3 | Leonid Protasov | This document assumes the reader has good understanding of JavaScript. There are plenty of books and sites on the subject so I don't want to waste space or time on teaching JavaScript. |
8 | 1 | Andreas Smas | |
9 | 3 | Leonid Protasov | The Showtime plugins do not interact directly to the user via the user interface (similar to a web browser) but rather it responds to browse and search requests and populate the internal data model with information that is then presented to the user via Showtime'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 | 9 | Andreas Smas | * @[email protected] - *(deprecated)* Loads the plugin into the SpiderMonkey engine. This will be removed (probably in Showtime 5.0) so any use is discouraged. |
51 | 1 | Andreas Smas | |
52 | 10 | Andreas Smas | h3. apiversion (OPTIONAL) |
53 | 10 | Andreas Smas | |
54 | 11 | Andreas Smas | Only applicable if type is @[email protected], ie. when running using the Duktape engine. This controls the API exposed by showtime to the plugin. |
55 | 10 | Andreas Smas | |
56 | 10 | Andreas Smas | * 1 - The version 1 API is _mostly_ compatible with the API exposed through the Spidermonkey engine. |
57 | 10 | Andreas Smas | * 2 - The version 2 API is a new API which more resembles modern javascript using modules and CommonJS interfaces. Please try to use this. |
58 | 10 | Andreas Smas | |
59 | 10 | Andreas Smas | 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 | 1 | Andreas Smas | Unique identifier for a plugin. The IDs are assigned by the Showtime 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 | 1 | Andreas Smas | Minimum version required of Showtime for this plugin to work. If the current version of Showtime is less than this version the user won't be able to install the plugin but will be notified about what version |
76 | 1 | Andreas Smas | of Showtime is required. The same goes if a plugin is updated and the new version requires a newer version of Showtime. Then the user will be refused to upgrade the plugin. If this field is omitted Showtime will assume the plugin works on all versions of Showtime. |
77 | 1 | Andreas Smas | |
78 | 1 | Andreas Smas | h3. version (RECOMMENDED) |
79 | 1 | Andreas Smas | |
80 | 1 | Andreas Smas | 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 Showtime will set the version to "Unknown" |
81 | 1 | Andreas Smas | |
82 | 1 | Andreas Smas | h3. category (RECOMMENDED) |
83 | 1 | Andreas Smas | |
84 | 2 | Leonid Protasov | Category of the plugin. If the field is omitted Showtime will set the category to "Unknown". Following categories are known: |
85 | 2 | 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 | 2 | Leonid Protasov | "subtitles" - subtitles |
90 | 1 | Andreas Smas | |
91 | 1 | Andreas Smas | h3. synopsis (RECOMMENDED) |
92 | 1 | Andreas Smas | |
93 | 1 | Andreas Smas | A short one line summary of the plugin or the service it accesses |
94 | 1 | Andreas Smas | |
95 | 1 | Andreas Smas | h3. author (OPTIONAL) |
96 | 1 | Andreas Smas | |
97 | 3 | Leonid Protasov | Plugin developer. Any UTF-8 characters are valid. |
98 | 1 | Andreas Smas | |
99 | 1 | Andreas Smas | h3. homepage (RECOMMENDED) |
100 | 1 | Andreas Smas | |
101 | 4 | Leonid Protasov | An URI with the location of the plugin homepage |
102 | 1 | Andreas Smas | |
103 | 1 | Andreas Smas | h3. icon (OPTIONAL) |
104 | 1 | Andreas Smas | |
105 | 1 | Andreas Smas | Path to plugin icon. The path is relative to the plugin root directory. If no icon is available Showtime will use a placeholder image instead. |
106 | 1 | Andreas Smas | |
107 | 1 | Andreas Smas | h3. description (OPTIONAL) |
108 | 1 | Andreas Smas | |
109 | 1 | Andreas Smas | Long rich-text formatted description of the plugin. |