PluginOverview » History » Version 1

Andreas Smas, 02/08/2013 11:13 PM

1 1 Andreas Smas
2 1 Andreas Smas
h1. Overview
3 1 Andreas Smas
4 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. 
5 1 Andreas Smas
6 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.
7 1 Andreas Smas
8 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)
9 1 Andreas Smas
10 1 Andreas Smas
h1. Structure of a plugin
11 1 Andreas Smas
12 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.
13 1 Andreas Smas
14 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
15 1 Andreas Smas
16 1 Andreas Smas
h2. plugin.json
17 1 Andreas Smas
18 1 Andreas Smas
19 1 Andreas Smas
plugin.json is a JSON (http://www.json.org/) encoded text file
20 1 Andreas Smas
containing information about the plugin
21 1 Andreas Smas
22 1 Andreas Smas
Example of a plugin.json file (from the Headweb plugin):
23 1 Andreas Smas
24 1 Andreas Smas
<pre><code class="javascript">
25 1 Andreas Smas
{
26 1 Andreas Smas
  "type": "javascript",
27 1 Andreas Smas
  "id": "headweb",
28 1 Andreas Smas
  "file": "headweb.js",
29 1 Andreas Smas
  "showtimeVersion": "3.1",
30 1 Andreas Smas
  "version": "1.0",
31 1 Andreas Smas
  "category": "",
32 1 Andreas Smas
  "author": "Andreas Öman",
33 1 Andreas Smas
  "homepage": "",
34 1 Andreas Smas
  "title": "Headweb",
35 1 Andreas Smas
  "icon": "headweb_square.png",
36 1 Andreas Smas
  "synopsis": "Headweb online video",
37 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>"
38 1 Andreas Smas
}
39 1 Andreas Smas
</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 1 Andreas Smas
Type of plugin, currently only "javascript" is supported.
47 1 Andreas Smas
48 1 Andreas Smas
h3. id (REQUIRED)
49 1 Andreas Smas
50 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]
51 1 Andreas Smas
52 1 Andreas Smas
h3. file (REQUIRED) 
53 1 Andreas Smas
  
54 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.
55 1 Andreas Smas
56 1 Andreas Smas
h3. title (RECOMMENDED)
57 1 Andreas Smas
  
58 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
59 1 Andreas Smas
60 1 Andreas Smas
h3. showtimeVersion (RECOMMENDED)
61 1 Andreas Smas
62 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
63 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.
64 1 Andreas Smas
65 1 Andreas Smas
h3. version (RECOMMENDED)
66 1 Andreas Smas
67 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"
68 1 Andreas Smas
69 1 Andreas Smas
h3. category (RECOMMENDED)
70 1 Andreas Smas
71 1 Andreas Smas
Category of the plugin. If the field is omitted Showtime will set the category to "Unknown"
72 1 Andreas Smas
73 1 Andreas Smas
h3. synopsis (RECOMMENDED)
74 1 Andreas Smas
75 1 Andreas Smas
A short one line summary of the plugin or the service it accesses
76 1 Andreas Smas
77 1 Andreas Smas
h3. author (OPTIONAL)
78 1 Andreas Smas
79 1 Andreas Smas
Plugin developer. Any UTF-8 characters is valid.
80 1 Andreas Smas
81 1 Andreas Smas
h3. homepage (RECOMMENDED)
82 1 Andreas Smas
83 1 Andreas Smas
A URI with the location of the plugin homepage
84 1 Andreas Smas
85 1 Andreas Smas
h3. icon (OPTIONAL)
86 1 Andreas Smas
87 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.
88 1 Andreas Smas
89 1 Andreas Smas
h3. description (OPTIONAL)
90 1 Andreas Smas
91 1 Andreas Smas
Long rich-text formatted description of the plugin.