PluginOverview » History » Version 4

Leonid Protasov, 01/03/2014 08:49 PM

1 1 Andreas Smas
h1. Overview
2 1 Andreas Smas
3 3 Leonid Protasov
Plugins for Showtime are currently written in JavaScript. The JavaScript engine inside Showtime is SpiderMonkey 1.8.0-rc1. Note that Showtime does not implement the same JavaScript API as normal web browsers. The basic JavaScript is there but there is no such thing as a DOM or AJAX, etc. 
4 1 Andreas Smas
5 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.
6 1 Andreas Smas
7 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).
8 1 Andreas Smas
9 1 Andreas Smas
h1. Structure of a plugin
10 1 Andreas Smas
11 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.
12 1 Andreas Smas
13 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
14 1 Andreas Smas
15 1 Andreas Smas
h2. plugin.json
16 1 Andreas Smas
17 1 Andreas Smas
18 1 Andreas Smas
plugin.json is a JSON (http://www.json.org/) encoded text file
19 1 Andreas Smas
containing information about the plugin
20 1 Andreas Smas
21 1 Andreas Smas
Example of a plugin.json file (from the Headweb plugin):
22 1 Andreas Smas
23 1 Andreas Smas
<pre><code class="javascript">
24 1 Andreas Smas
{
25 1 Andreas Smas
  "type": "javascript",
26 1 Andreas Smas
  "id": "headweb",
27 1 Andreas Smas
  "file": "headweb.js",
28 1 Andreas Smas
  "showtimeVersion": "3.1",
29 1 Andreas Smas
  "version": "1.0",
30 1 Andreas Smas
  "category": "",
31 1 Andreas Smas
  "author": "Andreas Öman",
32 1 Andreas Smas
  "homepage": "",
33 1 Andreas Smas
  "title": "Headweb",
34 1 Andreas Smas
  "icon": "headweb_square.png",
35 1 Andreas Smas
  "synopsis": "Headweb online video",
36 1 Andreas Smas
  "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>"
37 1 Andreas Smas
}
38 1 Andreas Smas
</code></pre>
39 1 Andreas Smas
40 1 Andreas Smas
41 1 Andreas Smas
Description of fields and requirement of their presence:
42 1 Andreas Smas
43 1 Andreas Smas
h3. type (REQUIRED)
44 1 Andreas Smas
45 1 Andreas Smas
Type of plugin, currently only "javascript" is supported.
46 1 Andreas Smas
47 1 Andreas Smas
h3. id (REQUIRED)
48 1 Andreas Smas
49 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]
50 1 Andreas Smas
51 1 Andreas Smas
h3. file (REQUIRED) 
52 1 Andreas Smas
  
53 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.
54 1 Andreas Smas
55 1 Andreas Smas
h3. title (RECOMMENDED)
56 1 Andreas Smas
  
57 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
58 1 Andreas Smas
59 1 Andreas Smas
h3. showtimeVersion (RECOMMENDED)
60 1 Andreas Smas
61 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
62 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.
63 1 Andreas Smas
64 1 Andreas Smas
h3. version (RECOMMENDED)
65 1 Andreas Smas
66 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"
67 1 Andreas Smas
68 1 Andreas Smas
h3. category (RECOMMENDED)
69 1 Andreas Smas
70 2 Leonid Protasov
Category of the plugin. If the field is omitted Showtime will set the category to "Unknown". Following categories are known:
71 2 Leonid Protasov
"TV" - online TV
72 2 Leonid Protasov
"video" - streaming video
73 4 Leonid Protasov
"music" - streaming music
74 2 Leonid Protasov
"glwview" - UI extentions
75 2 Leonid Protasov
"subtitles" - subtitles
76 1 Andreas Smas
77 1 Andreas Smas
h3. synopsis (RECOMMENDED)
78 1 Andreas Smas
79 1 Andreas Smas
A short one line summary of the plugin or the service it accesses
80 1 Andreas Smas
81 1 Andreas Smas
h3. author (OPTIONAL)
82 1 Andreas Smas
83 3 Leonid Protasov
Plugin developer. Any UTF-8 characters are valid.
84 1 Andreas Smas
85 1 Andreas Smas
h3. homepage (RECOMMENDED)
86 1 Andreas Smas
87 4 Leonid Protasov
An URI with the location of the plugin homepage
88 1 Andreas Smas
89 1 Andreas Smas
h3. icon (OPTIONAL)
90 1 Andreas Smas
91 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.
92 1 Andreas Smas
93 1 Andreas Smas
h3. description (OPTIONAL)
94 1 Andreas Smas
95 1 Andreas Smas
Long rich-text formatted description of the plugin.