PluginOverview » History » Version 9

Andreas Smas, 11/25/2014 12:02 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 1 Andreas Smas
  "type": "javascript",
28 1 Andreas Smas
  "id": "headweb",
29 1 Andreas Smas
  "file": "headweb.js",
30 5 Leonid Protasov
  "showtimeVersion": "4.1.22",
31 5 Leonid Protasov
  "version": "1.5.3",
32 1 Andreas Smas
  "author": "Andreas Öman",
33 1 Andreas Smas
  "title": "Headweb",
34 1 Andreas Smas
  "icon": "headweb_square.png",
35 1 Andreas Smas
  "synopsis": "Headweb online video",
36 5 Leonid Protasov
  "category": "video",
37 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>",
38 5 Leonid Protasov
  "homepage":"https://github.com/andoma/showtime-plugin-headweb"
39 5 Leonid Protasov
}</code></pre>
40 1 Andreas Smas
41 1 Andreas Smas
42 1 Andreas Smas
Description of fields and requirement of their presence:
43 1 Andreas Smas
44 1 Andreas Smas
h3. type (REQUIRED)
45 1 Andreas Smas
46 8 Andreas Smas
Type of plugin, as described by the following list.
47 8 Andreas Smas
48 1 Andreas Smas
* @[email protected] - Loads the plugin using Duktape.
49 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.
50 9 Andreas Smas
51 1 Andreas Smas
52 1 Andreas Smas
h3. id (REQUIRED)
53 1 Andreas Smas
54 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]
55 1 Andreas Smas
56 1 Andreas Smas
h3. file (REQUIRED) 
57 1 Andreas Smas
  
58 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.
59 1 Andreas Smas
60 1 Andreas Smas
h3. title (RECOMMENDED)
61 1 Andreas Smas
  
62 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
63 1 Andreas Smas
64 1 Andreas Smas
h3. showtimeVersion (RECOMMENDED)
65 1 Andreas Smas
66 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
67 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.
68 1 Andreas Smas
69 1 Andreas Smas
h3. version (RECOMMENDED)
70 1 Andreas Smas
71 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"
72 1 Andreas Smas
73 1 Andreas Smas
h3. category (RECOMMENDED)
74 1 Andreas Smas
75 2 Leonid Protasov
Category of the plugin. If the field is omitted Showtime will set the category to "Unknown". Following categories are known:
76 2 Leonid Protasov
"TV" - online TV
77 2 Leonid Protasov
"video" - streaming video
78 4 Leonid Protasov
"music" - streaming music
79 2 Leonid Protasov
"glwview" - UI extentions
80 2 Leonid Protasov
"subtitles" - subtitles
81 1 Andreas Smas
82 1 Andreas Smas
h3. synopsis (RECOMMENDED)
83 1 Andreas Smas
84 1 Andreas Smas
A short one line summary of the plugin or the service it accesses
85 1 Andreas Smas
86 1 Andreas Smas
h3. author (OPTIONAL)
87 1 Andreas Smas
88 3 Leonid Protasov
Plugin developer. Any UTF-8 characters are valid.
89 1 Andreas Smas
90 1 Andreas Smas
h3. homepage (RECOMMENDED)
91 1 Andreas Smas
92 4 Leonid Protasov
An URI with the location of the plugin homepage
93 1 Andreas Smas
94 1 Andreas Smas
h3. icon (OPTIONAL)
95 1 Andreas Smas
96 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.
97 1 Andreas Smas
98 1 Andreas Smas
h3. description (OPTIONAL)
99 1 Andreas Smas
100 1 Andreas Smas
Long rich-text formatted description of the plugin.