PluginOverview » History » Version 2

Leonid Protasov, 08/19/2013 08:31 PM

1 1 Andreas Smas
h1. Overview
2 1 Andreas Smas
3 1 Andreas Smas
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 1 Andreas Smas
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 1 Andreas Smas
The Showtime plugins does 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 1 Andreas Smas
Each plugin resides in a directory of their own. This directory must contain a file called *plugin.json* which contain 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 2 Leonid Protasov
"glwview" - UI extentions
74 2 Leonid Protasov
"subtitles" - subtitles
75 1 Andreas Smas
76 1 Andreas Smas
h3. synopsis (RECOMMENDED)
77 1 Andreas Smas
78 1 Andreas Smas
A short one line summary of the plugin or the service it accesses
79 1 Andreas Smas
80 1 Andreas Smas
h3. author (OPTIONAL)
81 1 Andreas Smas
82 1 Andreas Smas
Plugin developer. Any UTF-8 characters is valid.
83 1 Andreas Smas
84 1 Andreas Smas
h3. homepage (RECOMMENDED)
85 1 Andreas Smas
86 1 Andreas Smas
A URI with the location of the plugin homepage
87 1 Andreas Smas
88 1 Andreas Smas
h3. icon (OPTIONAL)
89 1 Andreas Smas
90 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.
91 1 Andreas Smas
92 1 Andreas Smas
h3. description (OPTIONAL)
93 1 Andreas Smas
94 1 Andreas Smas
Long rich-text formatted description of the plugin.