P. 1
PlexPlug-inFramework

PlexPlug-inFramework

|Views: 93|Likes:
PlexPlug-inFramework
PlexPlug-inFramework

More info:

Published by: Divine Ruler Equality Allah on May 20, 2013
Copyright:Attribution Non-commercial

Availability:

Read on Scribd mobile: iPhone, iPad and Android.
download as PDF, TXT or read online from Scribd
See more
See less

09/21/2013

pdf

text

original

Plex Plug-in Framework Documentation

Release 2.1.1

Plex, Inc.

May 25, 2011

CONTENTS

1 2

Introduction How plug-ins work 2.1 Differences between plug-ins and regular Python programs . . . . . . . . . . . Bundles 3.1 Configuration files . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3.2 Directories . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

1 3 3 5 6 8

3

4

Channel Plug-ins 11 4.1 Getting started with channel development . . . . . . . . . . . . . . . . . . . . 11 4.2 Site Configurations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13 4.3 Services . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 25 Agent Plug-ins 5.1 Getting started with agent development . . . . . . 5.2 Searching for results to provide matches for media 5.3 Adding metadata to media . . . . . . . . . . . . . 5.4 Metadata Model Classes . . . . . . . . . . . . . . 33 33 35 39 39

5

. . . .

. . . .

. . . .

. . . .

. . . .

. . . .

. . . .

. . . .

. . . .

. . . .

. . . .

. . . .

. . . .

. . . .

. . . .

6

API Reference 47 6.1 Standard API . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 47 Site Configuration Reference 7.1 Tags (Alphabetical) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7.2 XML DTD . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7.3 Keyboard Keycode Lookup . . . . . . . . . . . . . . . . . . . . . . . . . . . Indices and tables 91 91 102 105 107 109 111

7

8

Python Module Index Index

i

ii .

and concentrates on making the areas of Python most frequently used when developing plug-ins even easier to access. The framework consists of an API containing a set of tightly integrated methods. and the runtime environment manages most of the interaction between plug-ins and the media server.CHAPTER ONE INTRODUCTION The Plex Plug-in Framework provides a simple yet powerful platform that enables developers to easily create plug-ins for Plex Media Server. and can achieve a great deal of functionality in hardly any time. and a small runtime environment that manages the execution of a plug-in’s code. allowing the developer to focus on functionality. Plug-ins created using the Plex Plug-in Framework are typically very small and lightweight. The framework API builds upon a great foundation provided by the Python programming language. The API handles a lot of the boilerplate code internally. You’ll be amazed by what you can accomplish! 1 .

1 2 Chapter 1. Introduction .Plex Plug-in Framework Documentation. Release 2.1.

html#int) or bool (http://docs. int (http://docs.1. routing them to the correct place within a plug-in. in a separate Python instance. A plug-in isn’t a program in its’ own right . All of the plug-in’s code needs to be contained within functions. 2.python. There are a few key areas where regular Python rules do not apply that you should be aware of. or with the operation of the server.org/library/functions.1 Code structure Because plug-ins are executed within the framework’s runtime environment. 2. request handling.CHAPTER TWO HOW PLUG-INS WORK Each media server plug-in runs in its’ own process. anything more complicated (especially involving framework functions) may produce unexpected results or fail completely.html#str). and sending a response back to the server. This is because the runtime environment needs to be fully initialized before using any of the framework methods. Although it is generally safe to initialize simple variables with types like str (http://docs. Plug-in’s don’t behave quite like normal Python programs.html#bool) outside a function. the code structure is more strict than in a normal Python program. and calls specific functions in the plug-in when necessary.1 Differences between plug-ins and regular Python programs Because media server plug-ins are a little different to regular Python programs. Plug-ins communicate with the media server over sockets and act like mini HTTP servers.python. which dynamically loads the plug-in code as part of the initialization routine. The runtime handles common tasks like run loop management. logging and data storage. This ensures that plug-ins can’t interfere with each other. receiving standard HTTP requests and responding with XML-formatted data.the framework’s runtime environment is the program. and code in plug-ins that exists outside a function is executed as soon as the plug-in is loaded. Any code you want to execute when the plug-in 3 .org/library/functions. they can behave strangely in certain situations.the framework will handle receiving requests.python. This process is completely transparent to the plug-in developer .org/library/functions.

html#module-urllib2) modules to make HTTP requests. but all of the code required to perform a request can be replaced by calling a single method in the HTTP (page 69) API. If you take the time to familiarize yourself with how the framework operates and the features it provides.3 Plug-in execution Another side effect of the plug-in architecture is that plug-ins are incapable of running by themselves. Release 2. you’ll become much more productive when writing plug-ins. 2.Plex Plug-in Framework Documentation. While creating the framework APIs.1.1. 2.1.2 The framework APIs One of the biggest hurdles for existing Python developers to overcome is breaking old habits when it comes to developing plug-ins.org/library/urllib. 4 Chapter 2.org/library/urllib2. many developers may already be familiar with using the urllib (http://docs. How plug-ins work .python.python. For instance. plug-ins must be started by the media server.1 loads should be put inside the Start() (page 13) function.html#module-urllib) and urllib2 (http://docs. Because they rely heavily on the framework APIs and the runtime environment. More information can be found in the functions section. This also has other benefits. like automatic cookie handling and the option to cache the server’s response. a great deal of care was taken to make plug-in development as easy as possible.

This directory contains all files and other directories belonging to the plug-in.bundle extension. right-click on it & select “Show Package Contents”. Here’s an example of the contents of a bundle: The bundle directory itself contains only one item: the Contents directory. On Windows or Linux. The Contents directory should include the following items: 5 . allowing you to manipulate them as such in Finder. A bundle is a specially organized directory with a . To view the contents of a bundle.CHAPTER THREE BUNDLES Each plug-in’s code and support files are stored in a self-contained bundle. Mac OS X treats bundles as if they were files. bundles appear as regular folders.

iOS. This information is used by the framework when loading the plug-in.plexapp.plist file: <?xml version="1.amt</string> </dict> </dict> </dict> 6 Chapter 3. Note: This file is required.plist file contains information in the Apple property list format about the bundle’s contents.plist file The Info.plugins. set up defaults and alter how the runtime environment operates.apple. Release 2.Android.264</string> </array> <key>PlexURLServices</key> <dict> <key>Apple Movie Trailers</key> <dict> <key>URLPattern</key> <string>http://.1 Configuration files The framework uses certain configuration files to provide information about the bundle. Here is an example Info. Bundles .plugins.0" encoding="UTF-8"?> <!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.1 3.LGTV</string> <key>PlexFrameworkVersion</key> <string>2</string> <key>PlexMediaContainer</key> <array> <string>M4V</string> <string>MOV</string> </array> <key>PlexVideoCodec</key> <array> <string>H.Plex Plug-in Framework Documentation.plexapp.amt</string> <key>PlexAudioCodec</key> <array> <string>AAC</string> </array> <key>PlexClientPlatforms</key> <string>MacOSX.0"> <dict> <key>CFBundleIdentifier</key> <string>com. <plist version="1.1 The Info.1.1. 3.*</string> <key>Identifier</key> <string>com.com/.*apple\.

1 </plist> The following properties may be defined: CFBundleIdentifier A string property containing a unique identifier for the plug-in. Note: This property is optional. Note: This property is optional. Release 2.1.Plex Plug-in Framework Documentation. PlexFrameworkVersion A string property specifying the bundle’s target framework version. Configuration files 7 .mysite. This should be set to 2 to target the current framework version. The array should contain constants from AudioCodec (page 89).1. PlexPluginClass A string plug-in identifying the class of the bundle. The array should contain constants from VideoCodec (page 89). This should be in the reverse DNS format (e. More information about these keys can be found here (page 25). This should be set to either Content or Agent. PlexClientPlatforms A string specifying a comma-separated list of client platforms supported by the bundle’s contents. Note: This property is optional. PlexAudioCodec An array of strings identifying the containers returned by the plug-in.myplugin).g. 3. PlexURLServices PlexSearchServices PlexRelatedContentServices These properties describe the services available within the bundle. PlexVideoCodec An array of strings identifying the containers returned by the plug-in. Note: These properties are optional. com. The list should contain constants from ClientPlatform (page 88). PlexMediaContainer An array of strings identifying the containers returned by the plug-in. The array should contain constants from Container (page 89).

Information about loading these resource files in plug-in code is provided in the Resource (page 66) API reference.1 The Code directory The Code directory contains all of the plug-in’s source code files. like icons or background images.py file The __init__.3 The Resources directory The Resources directory contains any resource files required by the plug-in. 3.2. Bundles .Plex Plug-in Framework Documentation. 3. It is responsible for any initialization required.1 3.1. only files created by the developer.2 Directories The remaining files inside the bundle are separated into specific directories. Release 2.1.2 The Services directory The Services directory contains source code files for the plug-in’s services.2. 3.2 The DefaultPrefs. 8 Chapter 3. and loading any extra source code files. More information about services can be found here (page 25).2. See Also: The Start() (page 13) function The predefined framework function which can be used to initialize your plugin. The __init__. More information about the preferences file format can be found here (page 85).py file is the main source code file of the plug-in.json is a JSON-formatted file containing a set of preferences used by the plug-in. depending on their purpose. Third-party code should not be included here.json file DefaultPrefs. and the default values to use if the user hasn’t specified their own. 3.

String files should have a . en-us.Plex Plug-in Framework Documentation. Release 2.1 3. en.g.4 The Strings directory The Strings directory contains JSON-formatted text files for each language the plug-in supports.2.2.g. Directories 9 . More information about string files can be found in the Locale (page 79) API reference.1.json). The name may also include an optional country code (e.json extension and be named according to the ISO specification for language codes (e.json). 3.

Plex Plug-in Framework Documentation, Release 2.1.1

10

Chapter 3. Bundles

CHAPTER

FOUR

CHANNEL PLUG-INS
Channel plug-ins are the plug-ins users interact with most frequently. They integrate into the Plex client user interface, providing a new branch of media for the user to explore. Developers can easily create plug-ins that provide a hierarchy of media for the user to explore.

4.1 Getting started with channel development
4.1.1 What are channels?
Channels are plug-ins that provide playable content to clients via the media server. They can extend the server’s media tree to provide access to almost any type of content available online, and present a rich, browsable hierarchy to the user.

4.1.2 Understanding contexts
Before starting to write code, the developer should understand the concept of contexts within the runtime environment. A context is an encapsulation of certain state information. When your plug-in first starts, a single context is created - this is referred to as the global context. As a plug-in receives requests, the framework creates a new context for each one - these are referred to as request contexts. Many of the framework’s APIs are context aware, meaning that they are able to act on information stored in the current context. What this means for the developer is that they need to do much less work to effectively support multiple parallel requests. The framework will ensure that API calls from plug-in code return values based on the correct context, affecting all manner of things from string localization, to user preferences, to supported object types. There is only one caveat to this method - global objects cannot be modified from request contexts. Since plug-ins can potentially serve thousands of simultaneous requests, a global object could be modified by one request while it was still in use by another. Rather than use global objects, the developer should attempt to maintain state by passing arguments between functions, or using one of the data storage APIs provided by the framework.

11

Plex Plug-in Framework Documentation, Release 2.1.1

4.1.3 Configuring the Info.plist file
To indicate that the bundle contains a channel plug-in, the PlexPluginClass key should be set to Content in the Info.plist file.

4.1.4 Adding a prefix
Channel plug-ins add themselves to the user interface by first defining a prefix. Once a prefix has been registered, the plug-in effectively ‘owns’ all requests received by the media server beginning with that prefix. To register a prefix, the developer must define a function to be the main prefix handler using the @handler (page 47) decorator:
@handler(’/video/example’, ’Example’) def Main(): pass

Any incoming requests with the /video/example prefix will now be routed to this plug-in, and requests matching the path exactly will be directed to this function, and the channel will appear as a new icon in each supported client’s Channels menu.

4.1.5 Creating a menu hierarchy
To create the beginning of a browsable tree of metadata items, the developer needs to create an ObjectContainer (page 52), populate it with objects and return it to the client. The objects in this container can point to other functions within the plug-in, allowing the developer to define a rich navigation hierarchy. The simplest and most common use of function callbacks is to connect a DirectoryObject (page 62) to a function that will generate another ObjectContainer (page 52) (providing a new level of navigation) using the Callback() (page 48) function:
def Main(): oc = ObjectContainer( objects = [ DirectoryObject( key = Callback(SecondMenu), title = "Example Directory" ) ] ) return oc def SecondMenu(): oc = ObjectContainer( ... ) return oc

12

Chapter 4. Channel Plug-ins

rating) This function is called when the user sets the rating of a metadata item returned by the plug-in. They act as handlers to the urls that the WebVideoItem() passes out. 4. 4. Pretend the you could fire up a web browser. 4.1 Overview A Site Configuration file allows a Flash or Silverlight player to be played within a web browser.2. and optionally return a MessageContainer to display any error information to the user.Plex Plug-in Framework Documentation. SetRating(key. go to your favorite video site and draw a rectangle around just the video player. ValidatePrefs() This function is called when the user modifies their preferences. Start() This function is called when the plug-in first starts.2 Site Configurations Note: Playback of Flash or Silverlight content using site configurations is currently only supported on Mac OS X. It can be used to perform extra initialisation tasks such as configuring the environment and setting default attributes. attempting a login to validate a username and password). Site Configurations are complements to WebVideoItem() in the plugin framework. They will be called when specific events occur. The developer can check the newly provided values to ensure they are correct (e. Release 2.6 Predefined functions The framework reserves a few predefined function names.2. then you should not use a site configuration file.g. Site Configurations 13 . The video player would then be zoomed in to fill the screen and all of other web page junk is just thrown away so that you can watch the video without any distractions.1. 4. The developer can implement these functions if they wish to.1 The Callback() (page 48) function can also be used to return image data for thumbnails or background art. The key argument will be equal to the value of the item’s rating_key attribute. or provide data for a media object (usually by redirecting to the real source). When you should NOT create a Site Config If you have access to the video stream directly.1.

2 Gathering Player Information When creating site configs.flv. Release 2. ~/Library/Application Support/Plex Media Server/Site Configurations/yourfile.xml 4. you will use these URLs in order to create two regular expressions for the <site> (page 100) tag The first URL you will need is the URL of the page which contains the Flash or Silverlight player. X/Y coordinates of buttons on the player 4. You can use tools like the Net inspector in Firebug or you can sometimes find the stream URL passed in as a parameter to the player if you view the HTML source. X/Y coordinates of other elements / colors on the screen You’ll use this information later on to do things like “click on a button” or “find out what color the pixel is here” This information can be a real pain to get without some tools and techniques to help you out. Height and Width of the video player 3. You can simply copy and paste the URL from your browser URL bar.Plex Plug-in Framework Documentation.2. URLs You will need two urls saved away somewhere for future reference. . Here are just a few. You can use the “View Source” function of your web browser and then search for the URL that is used in the <embed> tag for the plugin. 1. often you will need to have access to information such as: 1. Some formats will just not work.xml 2. Url’s of the webpage / player 2. Later on. Now that you have these URL’s save them away in a text file for later use. RTMPE (note the E) or other formats which have DRM will have to be played with the flash/silverlight player and warrant the creation of a Site Configuration file Where to put them Site configurations can go one of two places. The other URL you will need is the URL of the Flash or Silverlight player.1.1 You will have to do some sleuthing to see if you can get access to the . (recommended) Inside of your plugin bundle file MyPlugin. Channel Plug-ins .bundle/Contents/Site Configurations/yourfile. 14 Chapter 4.mp4 or RTMP streams directly.

com/) for Firefox (http://getfirefox. Colors You can use the DigitlColor Meter tool which comes with OSX to find out the hex color value of any pixel on the screen.2. From here. Site Configurations 15 . you’ll be able to hit Command-C to copy the x/y coordinates of the current mouse position so that you can use this information later on with tags such as <click> (page 93) and <move> (page 96). With FreeRuler in the foreground.com/software/freeruler/). You should now see (5) height and width information for the selected element on the page.1. 4. Click on the (4) “Layout” tab over on the right. Free Ruler Another excellent tool to use (http://www. (OSX) is called Free Ruler Download and install this program and you will be able to overlay the horizontal and vertical rulers over the top/left edge of the flash player.1 Player Size and Coordinates Firebug Install Firebug (http://getfirebug. Release 2.pascal.Plex Plug-in Framework Documentation. (1) open Firebug and (2) click on the “Inspect” icon and then click on the (3) flash player in the page. Information about this element list CSS style information now shows on the right hand side.com) and then simply visit the webpage containing the video player.

More on States and Events (page 18) Seekbars A seekbar is a representation of your progress through a video. use the ‘simple’ or ‘thumb’ value for the type attribute on the <seekbar> (page 99) tag.com/mgid. The plugin regular expression must match the url for the embedded player. then the regular expression which is the most specific (longer) wins and the site configuration file containing that regular expression is run.com" initialState="playing" version="1. This URL is usually found in the <embed> tag of the web page.2. It shows you information such as: 1. This is an advanced topic and you would use ‘javascript’ for the type attribute on the <seekbar> (page 99) tag.0"> <!-..southparkstudios. Channel Plug-ins .Plex Plug-in Framework Documentation.com/episodes" plugin="http://media. For these.mtvnservices.*southparkstudios. This regular expression is scanned whenever a WebVideoItem url is played. Control for skip forward / skip backward Some seekbars are graphical in nature only. A bare bones example looks like so: <site .3 The XML File The <site> Element Site configuration files all start out with the <site> tag along with the proper <xml? definition.1 4. 16 Chapter 4. --> </site> The site and plugin attributes are actually regular expressions which match URL’s The site regular expression must match the URL for the webpage which contains the flash or silverlight plugin...1. If another site configuration file has a url which also matches the url. How far through the video you are 2.. site="http://www. Release 2. The initialState attribute tells the player to begin the the <state> (page 100) tag with the corresponding name attribute. Some Flash/Silverlight players expose hooks in their players which allow javascript to actually control and retrieve information from the player.

Once we find a color that does NOT match. under this line. The seekbar on this player starts at (63. These coordinates are not relative to the actual web page.Plex Plug-in Framework Documentation. We create a line created by “drawing” from <start> to <end>. then we immediately stop and record that position as the current playing position. then we’ll consider that portion played. These coordinates are not relative to the actual web page.290) and ends at (388. we’ll stop looking. If. The site config then does the math for the portion of played / unplayed and now knows how to do a few things: 1. We create a line created by “drawing” from <start> to <end>. we see pixels colored #4f4f4f or #616161. where to click the mouse when you skip ahead or skip back 2.1 Simple This is a seekbar which shows progrss as a bar going from left to right across the player. If.1. It does NOT have a “thumb” for you to grab/drag in order to skip to a different place in the video. Here is an example: <seekbar type="simple"> <start x="63" y="290" /> <end x="388" y="290" /> <played> <color rgb="4f4f4f" /> <color rgb="616161" /> </played> </seekbar> This example says the following in plain english. but of the actual flash/silverlight player.2. It is very similar to a ‘simple’ seekbar but the way the colors are interpreted is a litte different. how to update the progress bar in Plex Thumb This is a seekbar which has a “thumb” for you to grab and drag around to set the position of the video.290).290) and ends at (388. 4. Site Configurations 17 . Release 2.290). The seekbar on this player starts at (63. under this line we see the color #d3d3d3. Here is an example: <seekbar type="thumb"> <start x="63" y="290" /> <end x="388" y="290" /> <played> <color rgb="d3d3d3" /> </played> </seekbar> This example says the following in plain english. but of the actual flash/silverlight player.

seek($.currentTime()/$. Playing the video 2. which is aware of other events and actions. you’ll notice the $ variable.1 Javascript As mentioned above.duration()" </seekbar> There are a few things that should be mentioned about the example above. <seekbar type="javascript"> <percentComplete equals="$. some video players have exposed javascript API’s for their video players. Channel Plug-ins . It is equal to the DOM node of the flash player which was identified when the site configuration file was loaded. ‘event’ and ‘action’ Examples of states: 1.seek($.seek($.&amp.Plex Plug-in Framework Documentation. We’ll go into detail about the <action> (page 91) and <event> (page 95) tags later on but here are a few examples of the terms ‘state’..duration() * 100. Taking action typically involves also moving into another state. Release 2. An Ad is playing 4. It is somewhat equivalant to Plex having done this for you where the element in question is the actual embeded SWF file: $ = document.10)" plus="$. $.30)" plus="$.currentTime() > 0 &amp.0" /> <bigStep minus="$.currentTime() + 3 <smallStep minus="$. First. Video is paused 3.currentTime() . Video is done playing Examples of events: 1. Noticed a certain color or colors somewhere on the screen Examples of actions: 1..1.currentTime() + <end condition="$. For those sites that have done this.getElementById(. you can access the values from those functions and pass them back over to Plex.) States and Events The web video player allows you to define states of being as well as events and actions that are valid during those states.currentTime() > $.currentTime() . User pressed the button named pause 2. Click a button 18 Chapter 4. Video is buffereing 5.seek($. You will be using events to detect a change and you’ll then take “action”. This is a special variable that Plex creates when the page is loaded.

Release 2. Each state may have 0 or more <event> (page 95) tags.com/mgid. 4. mouse.1. remote control etc). The “play” in <command> (page 94) tag DOES matter but we will dive into that later.southparkstudios. Then the user runs the command named “play” and we’ll click on (15. It is simply a label so that we can <goto> (page 96) it and reference it with initialState.304) and then go to the “paused” state. then we’re going to click on the screen at (15. We could have called the “playing” state “foo” and the .com" initialState="playing" version="1.2.0"> <!-.*southparkstudios. We’ve found a SWF file and we are going to enter the initial state with the name of “playing”.1 2. Plex Media Server does not care.Plex Plug-in Framework Documentation.mtvnservices. If the user causes the command named “pause” to run (could be keyboard.com/episodes" plugin="http://media.304) again and then enter the “playing” state. Move to another state Lets take a look at a full example: site="http://www. Site Configurations 19 .PAUSED --> <state name="paused"> <event> <condition> <command name="play" /> </condition> <action> <click x="15" y="304" /> <goto state="playing" /> </action> </event> </state> </site> <site Here is what this file is saying. Note that the name attribute of the <state> (page 100) tag doesn’t inherently mean anything.PLAYING --> <state name="playing"> <event> <condition> <command name="pause" /> </condition> <action> <click x="15" y="304" /> <goto state="paused" /> </action> </event> </state> <!-.

Release 2. Named Condition Definitions (page 21)) • <frameLoaded> (page 95) • <javascript> (page 96) • <pref> (page 99) • <title> (page 101) • <url> (page 102) Example: <state name="playing"> <event> <condition> <and> <!-.conditional --> <color x="46" y="45" rgb="ffffff"/> <!-. see: .Plex Plug-in Framework Documentation.. Specifics on the usage of each tag is detailed in the documentation for each tag individually. Logic Tags: • <and> (page 92) • <or> (page 97) • <not> (page 97) Conditional Tags: • <color> (page 93) • <command> (page 94) • <condition> (page 93) (special case.conditional --> <or> <!-.logic tag --> <command name="pause" /> <!-. Channel Plug-ins . Conditions are then built up through a combination of logic tags and conditionals.1.1 Event Conditions Each <event> (page 95) tag has one <condition> (page 93) tag and one <action> (page 91) tag inside.logic tag --> <color x="45" y="45" rgb="ffffff"/> <!-.conditional --> </or> </and> </condition> <action> <click x="15" y="304" /> <goto state="paused" /> </action> </event> </state> 20 Chapter 4.

The following example defined a named conditional. as a definition of a named condition which can be called out and used in event conditions. These <action> (page 91) tags can then have one or more actions as children. They are executed in the order that they are defined from top to bottom. Think of these as condition “functions” that can be re-used in more than one <state> (page 100).0"> <!-.mtvnservices.com/mgid. each <event> (page 95) tag has one <condition> (page 93) tag and one <action> (page 91) tag inside. ‘buffering_colors_showing’ and then calls out to that condition later on in the “playing” state: <site site="http://www.1 Event Actions As mentioned previously.1. Site Configurations 21 .com/episodes" plugin="http://media. As an event condition (see: Event Conditions (page 20)) or in this case. Specifics on the usage of each action is detailed in the documentation for each tag individually.com" initialState="playing" version="1.2. Release 2.Plex Plug-in Framework Documentation.*southparkstudios. Action Tags: • <click> (page 93) • <goto> (page 96) • <lockPlugin> (page 96) • <move> (page 96) • <pause> (page 98) • <run> (page 99) • <type> (page 101) • <visit> (page 102) Named Condition Definitions The <condition> (page 93) tag is used in one of two ways.southparkstudios.NAMED CONDITIONAL DEFINITION --> <condition name="buffering_colors_showing"> <and> <color x="1" y="1" rgb="ffffff"/> <color x="2" y="2" rgb="ffffff"/> </and> </condition> <state name="playing"> <event> 4.

You can specify a user agent using the agent attribute of the <site> (page 100) tag.1. You can randomize the user agent by setting randomAgent to true in the <site> (page 100) tag...1 <condition> <and> <command name="pause" /> <not> <condition name="buffering_colors_showing"/> </not> </and> </condition> <action> <click x="15" y="304" /> <goto state="paused" /> </action> </event> </state> <!-. Release 2. TODO: what is the default user agent? Access to Preferences There are several ways you can use preferences. For instance. when filling out a form in the site config. --> </site> As you can see. Advanced User Agents Some sites have strange user agent requirements or block requests based on the user agent.. this can make for powerful condition reuse especially when you combine named conditions with logic tags such as <or> (page 97). Channel Plug-ins .Plex Plug-in Framework Documentation. you can test to see if a preference key exists by using the <pref> (page 99) conditional tag like so: <condition> <pref name="username" exists="true"/> </condition> The value of preference variables are also available for use in other tags as well. you can type the value of a pref using the <type> (page 101) tag like so: 22 Chapter 4. In conditionals.

2. <type> (page 101) text attribute 4. <javascript> (page 96) script attribute Changed in version Plex: 0. Filling Out Forms This can be tricky and you’ll need to use a combination of techniques to do this including detecting if a form is present.xml site configuration file: <!-."/> Preference variable replacement works in the following elements/attributes: 1.1 <type text="${username}"/> You can also use preference variable replacements in javascript expressions and several other places like so: <run script="doLogin(’${username}’.login prompt --> <state name="login"> <event> <condition> <and> <condition name="prompting-for-login"/> <pref name="login" exists="true"/> <pref name="password" exists="true"/> 4.’${password}’). <setCookie> (page 99) value attribute 2.8. clicking on form elements.Plex Plug-in Framework Documentation. Setting Cookies You can set cookies for plugins too! Just take a look at the <setCookie> (page 99) tag documentation for more details. filling them in etc. This included ‘bool’ preferences so for instance expect the string ‘true’ and not the javascript value of true when referencing ‘bool’ preferences.1. <end> (page 95) condition attribute 7.8. Site Configurations 23 . here is an example from the mlb. <bigStep> (page 92) plus and minus attributes 6. Release 2. <run> (page 99) script attribute 3.3 <setCookie> (page 99) value attribute can accept javascriptChanged in version Plex: 0. <smallStep> (page 101) plus and minus attributes 5. the preference value is returned as a string.3 <javascript> (page 96) script attribute can accept javascript Note: When referencing preference variables using javascript.

Release 2.wait for the form to animate closed --> <pause time="2000"/> <goto state="playing"/> </action> </event> </state> Javascript Execution Javascript can be run in two places. you’ll need to use the <run> (page 99) tag. <run script="myVariable=10.click the password input --> <pause time="10"/> <click x="116" y="439"/> <pause time="100"/> <type text="${password}"/> <!-. Channel Plug-ins . example assuming myVariable is 10 : 24 Chapter 4."/> See the syntax for the <run> (page 99) tag for more details.1. Conditions If you would like to test a javascript expression for truth inside of a <condition> (page 93).submit the form --> <pause time="100"/> <type key="13"/> <!-. Actions If you would like to run javascript inside of an action.Plex Plug-in Framework Documentation.set focus --> <click x="116" y="409"/> <pause time="10"/> <!-."double click" the email input to select all --> <click x="116" y="409"/> <click x="116" y="409"/> <pause time="100"/> <type text="${login}"/> <!-.1 </and> </condition> <action> <!-. ex. then you’ll need to use the <javascript> (page 96) tag.

Release 2. find a piece of media in a predictable manner. tags.g.true condition <javascript script="myVariable == 99 ? 1 : 0" matches="1"/> <!-. it is difficult to treat the content as anything other than a navigable tree of media there is no standard way to obtain meaningful information about a specific piece of media.3 Services The Plex development platform provides a great deal of power and flexibility for developing self-contained channel plug-ins. The following example illustrates a definition for a URL service handling content from YouTube: <key>PlexURLServices</key> <dict> <key>YouTube</key> <dict> <key>Identifier</key> <string>com. Defining a URL service To add a URL service to a plug-in. In order to solve this limitation. However.youtube</string> 4.false condition 4. these plug-ins can (and often do) present very different media hierarchies and handle media from a wide range of sources. For example. Because of this inconsistency. The code is often simpler and easier to reuse too! Three types of service are currently available: 4. A service consists of a set of functions that work together to perform a specific task in a welldefined manner.1.3. allowing much deeper integration into the Plex ecosystem .Plex Plug-in Framework Documentation. Services 25 .1 <javascript script="myVariable" matches="10"/> <!-. given the URL “http://youtube.com/watch?v=vzKbhxY1eQU”. a lot of new and interesting functionality can be leveraged. the URL service would return a video clip object with appropriate title. the plug-in framework includes the concept of “services”. media format/codec information. summary.media easily be searched for or linked with related content. and additional features will be enabled in future.3.). cast. or establish relationships between multiple pieces of media. with all the richness of the Plex library metadata (e. the developer just to make a small addition to the plug-in’s Info.true condition --> <javascript script="myVariable == 10 ? 1 : 0" matches="1"/> <!-. The magic of a URL service is its ability to convert arbitrarily formatted web content into a normalized schema for a piece of media.plugins. and other relevant details. Because the behaviour of these services is always consistent between plug-ins.plist file. restricting what channel plug-ins are capable of. etc.plexapp.1 URL Services URL services are responsible for taking a website’s URL and returning standardized Plex metadata objects.

Plex Plug-in Framework Documentation, Release 2.1.1

<key>URLPattern</key> <string>http://.*youtube\.com/(watch)?\?v=</string> <key>TestURLs</key> <array> <string>http://youtube.com/watch?v=vzKbhxY1eQU</string> </array> </dict> </dict>

PlexURLServices is a dictionary that can define multiple URL services. Services must be uniquely named. Each service must have a URLPattern defined. The value should be a regular expression that matches URLs that can be handled by the service. Plex uses this expression to determine which service should be used to handle a given URL. The Identifier of the service must be a globally unique string, and cannot be shared with any other URL service, even ones in different bundles. While optional, this string must be provided in order to link a URL service with a related content service. Additionally, each service can optionally define an array of TestURLs. This array should contain a list of URLs that the service is capable of handling. Plex’s automated testing system will use these URLs to verify that the service is functioning correctly and generate an alert if any problems occur. Developers are strongly encouraged to add a list of testable URLs to allow errors to be caught quickly. Creating a source file Once a service has been defined in the Info.plist file, the developer needs to add a file containing the service’s source code. The file should be named ServiceCode.pys (the .pys extension indicates that the file contains service code) and added to a subdirectory with the same name as the key used in the service definition. Continuing the YouTube example above, the path of the file would be as follows:
Contents/URL Services/YouTube/ServiceCode.pys

Writing the code URL services should define the following functions: MetadataObjectForURL(url) This function should create and return a metadata object (for example, a VideoClipObject) and populate it with metadata from the given URL. Only the metadata should be added here - the object’s key and rating_key properties will be synthesised based on the URL. Note: Although the object’s media items can be created here, this isn’t necessary. If no items are provided, they will be populated using the function defined below.

26

Chapter 4. Channel Plug-ins

Plex Plug-in Framework Documentation, Release 2.1.1

Parameters url (str (http://docs.python.org/library/functions.html#str)) – The URL of the web page to use as a source for generating the metadata object. Returns A metadata object representing the media available at the given URL. MediaObjectsForURL(url) This function should create and return a list of media objects and part objects representing the media available at the given URL. Callbacks may be used if obtaining the final media location requires additional computation. Note: This function is expected to execute and return very quickly, as it could be called several times for different URLs when building a container. As such, developers should avoid making any API calls that could delay execution (e.g. HTTP requests). Parameters url (str (http://docs.python.org/library/functions.html#str)) – The URL of the web page to use as a source for generating the metadata object. Returns Media objects representing the media available at the given URL. Return type list NormalizeURL(url) This function should return a “normalised” version of the given URL. Plex uses the URL as a unique identifier for a given piece of content, but the same media will often appear at different URLs, even simply due to additional query string arguments. For example, the following URLs all point to the same video: •http://www.youtube.com/watch?v=dQw4w9WgXcQ •http://www.youtube.com/?v=dQw4w9WgXcQ •http://youtube.com/watch?v=dQw4w9WgXcQ

•http://www.youtube.com/watch?v=dQw4w9WgXcQ&feature=list_related&playnext=1&list=MLG In this case, the normalised version of this URL would be: •http://youtube.com/?v=dQw4w9WgXcQ This function is called automatically before passing the URL to the above two functions. They will always receive normalised URLs. Note: This function is expected to execute and return very quickly, as it could be called several times for different URLs when building a container. As such, developers should avoid making any API calls that could delay execution (e.g. HTTP requests).

4.3. Services

27

Plex Plug-in Framework Documentation, Release 2.1.1

Note: This function is optional. If each piece of media is only accessible via a single URL, the developer may omit this function. Parameters url (str (http://docs.python.org/library/functions.html#str)) – The URL to be normalised. Returns A normalised version of the URL. Return type str Testing the service The simplest way of testing a URL service is to use the built-in lookup function. Using the example URL given above, the service could be tested by making the following HTTP request:

$ curl "http://localhost:32400/system/services/url/lookup?url=http%3A%2F%2Fwww.y

<?xml version=’1.0’ encoding=’utf-8’?> <MediaContainer size="1" identifier="com.plexapp.system" mediaTagPrefix="/system <Video url="http://youtube.com/?v=dQw4w9WgXcQ" key="/system/services/url/looku <Media indirect="1"> <Part file="" key="/:/plugins/com.plexapp.system/urlservice_function/Y2VyZ </Media> <Media indirect="1"> <Part file="" key="/:/plugins/com.plexapp.system/urlservice_function/Y2VyZ </Media> <Media indirect="1"> <Part file="" key="/:/plugins/com.plexapp.system/urlservice_function/Y2VyZ </Media> <Genre tag="Music"/> <Tag tag="Rick"/> <Tag tag="Astley"/> <Tag tag="Sony"/> <Tag tag="BMG"/> <Tag tag="Music"/> <Tag tag="UK"/> <Tag tag="Pop"/> </Video> </MediaContainer>

Calling the service from plug-in code The URL service can be invoked using the Service API. However, this is rarely the best course of action. Using the URL service to generate a full metadata object is often slow, and since plug-ins are usually providing a large container of items to be returned to a client, calling the service for each item in the container would cause an unacceptable delay for the user. The most beneficial use of URL services within plug-ins is to use them to generate the media objects, but not the metadata. Since creating the media objects should always be fast, and 28 Chapter 4. Channel Plug-ins

4. The value of each item should be a dictionary containing information about the service. rating = video_rating.no two search services (even in separate bundles) may share an identifier. They are far simpler than URL services. search services are defined in the plug-in’s Info.videosurf</value> </dict> </dict> As with URL services. PlexSearchServices is a dictionary that can contain multiple search services. This should be a globally unique identifier for the search service .1 the plug-in will usually have access to the metadata from the web page used to generate the container. Release 2.2 Search Services Search services are responsible for accepting a search query and returning a container of metadata objects that match the query. Currently the only item stored in this dictionary is Identifier. summary = video_summary.youtube.3. url = ’http://www.1.plist file.3. originally_available_at = video_date.fast execution and use of the extra features enabled by using the service.search. and usually benefit from being able to reuse some of the service code. The following example illustrates the definition of the VideoSurf search service: <key>PlexSearchServices</key> <dict> <key>VideoSurf</key> <dict> <key>Identifier</key> <string>com. Services 29 . The key of each item should be a name for the service unique to the bundle.Plex Plug-in Framework Documentation. the framework will automatically call the URL service to populate the list of media items and set the metadata object’s key and rating_key properties if the developer sets the metadata object’s url property: video = VideoClipObject( title = video_title. this hybrid approach offers the best of both worlds . All installed search services are able to contribute to results from Plex’s universal search feature. Search services may share an identifier with an URL service or related content service. Defining a search service Like URL services. In order to simplify implementation of this common case.com/watch?v=dQw4w9WgXcQ’ ) 4.plexapp.

If the items to be returned can be handled by a URL service.plexapp. and is useful for services that return results from multiple sources (like VideoSurf). The file should be named ServiceCode.1 Creating a source file Similarly. Continuing the VideoSurf example above. it can be invoked by setting the url property of the objects.system/urlservice_function/Y2VyZ </Media> 30 Chapter 4.plist file.pys extension indicates that the file contains service code) and added to a subdirectory with the same name as the key used in the service definition.Plex Plug-in Framework Documentation.plexapp. If no source title is given.plexapp.plexapp. the service’s name is used. Parameters query (str (http://docs.pys (the .com/watch?v=BqeJlOWdyLs" key="/system/services/ <Media indirect="1"> <Part file="" key="/:/plugins/com. the source_title property can be set on the returned objects if required.sea <?xml version=’1. Mixed object types can be added to the container if necessary .0’ encoding=’utf-8’?> <MediaContainer size="20" identifier="com. Returns A container of items matching the given query.pys Writing the code Search services should define the following function: Search(query) This function should accept a user-entered query and return a container of relevant results.system" mediaTagPrefix="/syste <Video url="http://www.the client is responsible for separating them into relevant groups.html#str)) – The search query entered by the user. Channel Plug-ins . This will be displayed by the client to indicate the result’s source. Release 2.python.1. the service could be tested by making the following HTTP request: $ curl "http://localhost:32400/system/services/search?identifier=com. Using the example service above and the query “dog”.org/library/functions.system/urlservice_function/Y2VyZ </Media> <Media indirect="1"> <Part file="" key="/:/plugins/com. Return type ObjectContainer (page 52) Testing the service The simplest way of testing a search service is to use the built-in search function. the path of the file would be as follows: Contents/Search Services/VideoSurf/ServiceCode. the developer needs to add a file containing the service’s source code after defining the service in the Info.youtube. In addition to the standard metadata properties.

Like search services. they too can usually benefit from being able to reuse some of the URL service code. This allows Plex to select related content for an item based on its URL. The value of each item should be a dictionary containing information about the service. Each related content services must be associated with a URL service by assigning a common identifier to both. PlexRelatedContentServices is a dictionary that can contain multiple related content services.pys (the ..search..they are responsible for accepting a metadata object and returning a new container of metadata objects that are related to the one provided.plist file. Currently the only item stored in this dictionary is Identifier.plexapp.system/urlservice_function/Y2VyZ </Media> </Video> .3. Release 2. This should be a globally unique identifier for the related content service .videosurf</value> </dict> </dict> As with other services. Defining a related content service Like other services.Plex Plug-in Framework Documentation. Services 31 .1 <Media indirect="1"> <Part file="" key="/:/plugins/com. related content services are defined in the plug-in’s Info. </MediaContainer> 4.1.pys extension indicates that the file contains service code) and added to a subdirectory with the same name as the 4. The following example illustrates the definition of a related content service for YouTube: <key>PlexRelatedContentServices</key> <dict> <key>YouTube</key> <dict> <key>Identifier</key> <string>com.no two related content services (even in separate bundles) may share an identifier.3.plexapp. Creating a source file The developer needs to add a file containing the service’s source code after defining the service in the Info. The key of each item should be a name for the service unique to the bundle. The file should be named ServiceCode.plist file.3 Related Content Services Related content services are similar to search services .

In addition to the standard metadata properties. If no source title is given. If the items to be returned can be handled by a URL service.pys Writing the code Search services should define the following function: RelatedContentForMetadata(metadata) This function should accept a metadata object and return a container of related items.Plex Plug-in Framework Documentation.1 key used in the service definition. Parameters metadata – The metadata object to present related content for. the service’s name is used.the client is responsible for separating them into relevant groups. Release 2. it can be invoked by setting the url property of the objects. Returns A container of items related to the given metadata object.1. the source_title property can be set on the returned objects if required. This will be displayed by the client to indicate the result’s source. Mixed object types can be added to the container if necessary . Continuing the YouTube example above.youtube. Return type ObjectContainer (page 52) Testing the service The simplest way of testing a related content service is to use the builtin lookup function. and is useful for services that return results from multiple sources (like VideoSurf). Using the example service above and the sample URL http://www.com/watch?v=dQw4w9WgXcQ. the service could be tested by making the following HTTP request: $ curl "http://localhost:32400/system/services/relatedcontent/lookup?url=http%3A 32 Chapter 4. Channel Plug-ins . the path of the file would be as follows: Contents/Related Content Services/YouTube/ServiceCode.

When a new piece of media is found. However. but the list may also be presented to the user if they need to manually override the automatic match. their runtime operation is slightly different. 5.2 Understanding the metadata retrieval process Rather than communicating with agent plug-ins directly. The primary agent for the section will be called and provided with a set of hints that the media server was able to extract from the file’s name and embedded metadata. 5. the media server issues agent requests via a service provided by the framework. allowing metadata from almost any source to be added to media in the library.CHAPTER FIVE AGENT PLUG-INS Agent plug-ins mostly operate behind the scenes. Agent plug-ins do not need to register prefixes or define a navigation hierarchy. This method is called synchronously . and as such have access to the same APIs. While they use the same framework as channel plug-ins.1. Agent plug-ins provide search results and metadata for Plex’s media library system.1 Getting started with agent development 5.the media server will wait 33 . As with channel plug-ins. This allows many requests to be queued and processed asynchronously. hardly ever requiring any user interaction. agent development is very simple. The best match will be automatically selected by the media server. Once the concepts behind the operation of agent plug-ins are understood. Instead they must define a class capable of performing the functions required to integrate with Plex’s metadata retrieval process. and metadata for the media once it’s been matched. It is the responsibility of the agent to return a set of search results that are potential matches for the media.1. they can be easily created and extended by developers.1 What are agents? Agents are plug-ins that provide search results used for matching media. Agents will be called depending on the configuration of the section containing the media. they are just as important as channel plug-ins. the media server will issue a search to attempt to match the media with a known piece of metadata online.

. but the developer should attempt to make their method complete as quickly as possible in order to improve the user experience. results. Agent. the media server issues an update request to the agents..4 Defining an agent class This is an example of an agent class definition: class MyAgent(Agent. manual): . The update methods of the agents associated with the library section are called. and as such it should return as quickly as possible. Agent. Release 2. force) . def update(self. This method is called asynchronously. After the update methods in all required agents have completed..Artist or Agent. 5. as this can place undue burden on web servers and degrade the media server’s performance. metadata.1.TV_Shows. The update method may be used to update an existing metadata object . Agents should inherit from either Agent. media..Language.3 Configuring the Info.1.Movies): name = ’My Agent’ languages = [ Locale. The following class attributes may be defined: 34 Chapter 5. 5. and passed a metadata object. the PlexPluginClass key should be set to Agent in the Info.Album. Once a piece of media has been matched successfully. Agent Plug-ins .1. the framework’s agent service creates a composite version of the metadata object including as much data as possible from the user’s selected sources.Movies. using the priority order they specified. ] primary_provider = True fallback_agent = False accepts_from = None contributes_to = None def search(self. There is no limit on the amount of time an agent can take to download metadata.plist file To indicate that the bundle contains an agent plug-in. It is then the agent’s responsibility to fill in any available metadata that hasn’t already been populated.Plex Plug-in Framework Documentation.plist file. lang.1 for it to complete so results can be selected or displayed.English. media. The combined metadata object is then loaded by the media server and used to populate the library database.it is the developer’s responsibility to check the object’s contents and avoid downloading metadata that’s already there (especially images). lang.

This attribute is optional. This will be one of the constants added to the agent’s languages attribute. This attribute is optional. • results (ObjectContainer (page 52)) – An empty container that the developer should populate with potential matches. This attribute is required. languages A list of strings defining the languages supported by the agent. • media (Media (page 36)) – An object containing hints to be used when performing the search. media. This attribute is required fallback_agent A string containing the identifier of another agent to use as a fallback. results. This attribute is optional.1 name A string defining the name of the agent for display in the GUI. If an agent is secondary (primary_provider is set to False) it will only be able to contribute to data provided by another primary agent. Primary providers can be selected as the main source of metadata for a particular media type. it calls the agent’s search method: search(self.1. • lang (str (http://docs. Release 2. The search and update methods are detailed in the following sections.2 Searching for results to provide matches for media When the media server needs an agent to perform a search. These values should be taken from the constants defined in the Locale (page 79) API.2. Searching for results to provide matches for media 35 . this fallback agent will be called to attempt to find a better match. 5. contributes_to A list of strings containing the identifiers of primary agents that the agent can contribute secondary data to. lang. manual) Parameters • self – A reference to the instance of the agent class.python. Note: The list of available contributors for a particular agent is a composite of the accepts_from and contributes_to attributes of the various agents involved. This attribute is required. accepts_from A list of strings containing the identifiers of agents that can contribute secondary data to primary data provided by this agent.html#str)) – A string identifying the user’s currently selected language.Plex Plug-in Framework Documentation. primary_provider A boolean value defining whether the agent is a primary metadata provider or not. 5. and is computed at runtime.org/library/functions. If none of the matches returned by an agent are a close enough match to the given set of hints.

the metadata object from the primary agent will be provided here.Plex Plug-in Framework Documentation. Note: This attribute is only available for Movie and TV Show metadata searches.html#bool)) – A boolean value identifying whether the search was issued automatically during scanning. as used by OpenSubtitles. For media that contains several individual playable items (e. duration The duration of the media. extracted from its’ filename or embedded metadata.python. filename The name of the media file on disk. primary_agent If the search is being called in a secondary agent. this attribute will be None. the hints for the most recent item are provided. Release 2. name A string identifying the name of the item. year The year associated with the item. this attribute will be None. Note: This attribute is only available for Movie and TV Show metadata searches. show The name of the show the episode belongs to. Note: This attribute is only available for Movie and TV Show metadata searches. extracted from its’ filename or embedded metadata. the identifier of the primary agent will be provided here. albums or TV shows). If the search is being called in a primary agent. Note: This attribute is only available for Movie and TV Show metadata searches. 36 Chapter 5. openSubtitlesHash A string identifying the hash of the file. Agent Plug-ins .g.org/library/functions.1 • manual (bool (http://docs. extracted from the video file. primary_metadata If the search is being called in a secondary agent.org.1. If the search is being called in a primary agent. or manually by the user (in order to fix an incorrect match) class Media The media object provided to the search method provides the developer with all the hints found by the media server while scanning for media.

1. season The season of the show the episode belongs to. episode The episode number. album The name of the album.g. Note: This attribute is only available for Artist and Album metadata searches.Plex Plug-in Framework Documentation.2. index The position of the track in the album. For example. These items and parts can be accessed using Python’s standard item getting syntax. Release 2. The syntax for accessing these items is relatively straightforward and intuitive. Note: This attribute is only available for Artist and Album metadata searches.1 Note: This attribute is only available for TV Show metadata searches. Note: This attribute is only available for Album metadata searches. artist The name of the artist. This tree contains more comprehensive information about all items belonging to this piece of media and their locations on disk. The media object also provides access to the media hierarchy identified by the scanner and stored in the database. Searching for results to provide matches for media 37 . to access the first part of the first item in the tree: media. Note: This attribute is only available for TV Show metadata searches.items[0].parts[0] The tree can also be used to access the sub-items of the media (e. episodes and albums). Note: This attribute is only available for TV Show metadata searches. 5. Note: This attribute is only available for Artist and Album metadata searches. track The name of the track. The tree contains the media item & media part structure used by Plex’s library system and the Object classes.

org. or setting the attribute directly on the object after it has been created. and can be helpful for identifying the correct item when two similarly or identically named results are returned. Results with a score of 85 or greater are considered “good enough” for automatic matching. The developer should use the hints provided by the media object to add a series of search result objects to the provided results object.Plex Plug-in Framework Documentation. Agent Plug-ins .items[0]. Each attribute can be set by passing a keyword argument to the constructor. as used by OpenSubtitles. with 100 being considered an exact match. lang A string defining the language of the metadata that would be returned by the given 38 Chapter 5. This will be displayed to the user if they choose to manually match a piece of media.episodes[1]. score An integer defining how close the result matches the provided hints. The provided value will be passed to the update method if the metadata needs to be downloaded. with the highest-scoring result being selected by default.1.1 For example. openSubtitlesHash A string identifying the hash of the file.seasons[1]. id A string that uniquely identifies the metadata. Seasons and episodes will always use the canonical number as the key. the media items and media parts always start with an index of 0. so the developer should ensure that the value can be used later to access the metadata without the provided hints. Results should be instances of the MetadataSearchResult (page 38) class.parts[0] Note: As shown above. class MetadataSearchResult The MetadataSearchResult class includes the following attributes. Note: This attribute is only available for Movie and TV Show metadata searches. This will be displayed to the user if they choose to manually match a piece of media. name A string defining the name of the matched metadata item. Release 2. This can be in any format. to access the first part of the first item of episode 1 of season 1: media. class MediaPart file A string identifying path to the media file on disk. This should be a value between 0 and 100. year An integer defining the year associated with the matched metadata item.

html#bool)) – A boolean value identifying whether the user forced a full refresh of the metadata.org/library/functions. Adding metadata to media 39 . metadata. a new. If this is the first time the update function has been called for this metadata item.org/library/functions.1. This is especially important when storing image or audio data. If this argument is True. • metadata – A pre-initialized metadata object if this is the first time the item is being updated. • media (Media (page 36)) – An object containing information about the media hierarchy in the database. or the existing metadata object if the item is being refreshed. regardless of whether it has been populated previously.python. update(self. all metadata should be refreshed. It is the developer’s responsibility to check for existing content stored within the object.4 Metadata Model Classes The model classes used to provide metadata objects to the update method share many common attributes with the framework’s Object API. empty object will be passed. and avoid populating data that is already present. this object will contain all the data previously added by the agent. These classes are never instantiated directly 5. it is added to the update queue.python. This should be equal to one of the constants defined in the Locale (page 79) API. media.1 result.Plex Plug-in Framework Documentation. When called. As the framework processes queued items. If the item has been updated previously. Release 2.3. the function will be passed an instance of a metadata model class (detailed in the next topic). • lang (str (http://docs. but does not provide any of the extra hints used in the search function. 5.3 Adding metadata to media Once an item has been successfully matched.html#str)) – A string identifying which language should be used for the metadata. as downloading this unnecessarily can place undue burden on the servers used by the agent and slow down the metadata updating process. Note: The Media (page 36) object provided to the update function exposes the media tree in the database. it calls the update method of the relevant agents. This will be one of the constants defined in the agent’s languages attribute. • force (bool (http://docs. lang):: Parameters • self – A reference to the instance of the agent class. 5.

original_title A string specifying the movie’s original title. collections A set of strings specifying the movie’s genre. trivia A string containing trivia about the movie. Agent Plug-ins . in milliseconds. studio A string specifying the movie’s studio. they are generated automatically and passed to the update method as the metadata argument. home movie. tags A set of strings specifying the movie’s tags. class Movie Represents a movie (e.1. independent film. The attributes supported by each class are listed below. Release 2. content_rating A string specifying the movie’s content rating. duration An integer specifying the duration of the movie. content_rating_age A string specifying the minumum age for viewers of the movie. rating A float between 0 and 10 specifying the movie’s rating. year An integer specifying the movie’s release year. a theatrical release. tagline A string specifying the movie’s tagline. quotes A string containing memorable quotes from the movie.) genres A set of strings specifying the movie’s genre. etc. summary A string specifying the movie’s summary.g. 40 Chapter 5. originally_available_at A date object specifying the movie’s original release date.Plex Plug-in Framework Documentation. title A string specifying the movie’s title.1 by the developer.

title A string specifying the episode’s title. originally_available_at A date object specifying when the episode originally aired. See below for information about proxy objects.4. See 5. summary A string specifying the episode’s summary. Release 2. themes A container of proxy objects representing the movie’s theme music. directors A set of strings specifying the movie’s directors. absolute_index An integer specifying the absolute index of the episode within the entire series. Metadata Model Classes 41 .1 writers A set of strings specifying the movie’s writers. countries A set of strings specifying the countries involved in the production of the movie. directors A set of strings specifying the episode’s directors. producers A set of strings specifying the movie’s producers. writers A set of strings specifying the episode’s writers.Plex Plug-in Framework Documentation. guest_stars A set of strings specifying the episode’s guest stars. thumbs A container of proxy objects representing the episode’s thumbnail images.1. rating An integer attribute with a valuebetween 0 and 10 specifying the episode’s rating. class Episode Represents an episode of a TV show or other episodic content. See below for information about proxy objects. art A container of proxy objects representing the movie’s background art. producers A set of strings specifying the episode’s producers. See below for information about proxy objects. posters A container of proxy objects representing the movie’s posters.

in milliseconds. class Season Represents a season of a TV show. content_rating A string specifying the show’s content rating. summary A string specifying the season’s summary.Plex Plug-in Framework Documentation. duration An integer specifying the duration of the episode. class TV_Show Represents a TV show. rating A float between 0 and 10 specifying the show’s rating. Agent Plug-ins . posters A container of proxy objects representing the season’s posters.1. banners A container of proxy objects representing the season’s banner images. studio A string specifying the studio that produced the show. title A string specifying the show’s title. 42 Chapter 5. summary A string specifying the show’s summary. Release 2. originally_available_at A date object specifying the date the show originally started airing.1 below for information about proxy objects. in milliseconds. collections A set of strings specifying the show’s collections. See below for information about proxy objects. tags A set of strings specifying the show’s tags. episodes A map of Episode (page 41) objects. genres A set of strings specifying the show’s genres. or the top-level of other episodic content. See below for information about proxy objects. duration An integer specifying the approximate duration of each episode in the show.

5.Plex Plug-in Framework Documentation. See below for information about proxy objects. See below for information about proxy objects. posters A container of proxy objects representing the artist’s posters. posters A container of proxy objects representing the show’s posters. class Artist Represents an artist or group.1. See below for information about proxy objects. themes A container of proxy objects representing the artist’s theme music. genres A set of strings specifying the artist’s genres. tags A set of strings specifying the artist’s tags. collections A set of strings specifying the collections the artist belongs to. class Album Represents a music album. banners A container of proxy objects representing the show’s banner images. See below for information about proxy objects. art A container of proxy objects representing the show’s banner images. title A string specifying the artist’s name. summary A string specifying the artist’s biography.1 countries A set of strings specifying the countries involved in the production of the show. rating A float between 0 and 10 specifying the artist’s rating. See below for information about proxy objects. See below for information about proxy objects. Release 2. Metadata Model Classes 43 .4. themes A container of proxy objects representing the show’s theme music. art A container of proxy objects representing the artist’s background art. See below for information about proxy objects.

countries A list of strings specifying the countries involved in the production of the album.) name A string specifying the track’s name. background images or theme music tracks available. producers A list of strings specifying the album’s producers.1 Proxy objects Proxy objects are used for associating image and audio files with metadata. This makes downloading the data for each possible choice time-consuming and places undue burden on the servers providing the data.todo:: Describe rating A float between 0 and 10 specifying the album’s rating.1 genres A list of strings specifying the album’s genres. tracks A map of Track (page 44) objects representing the album’s tracks.1. studio A string specifying the album’s studio.Plex Plug-in Framework Documentation. originally_available_at A date object specifying the album’s original release date.4.g. summary A string specifying the album’s summary. but the user will usually only require one of each. posters A container of proxy objects representing the album’s covers. tags A list of strings specifying the album’s tags. title A string specifying the album’s title. See below for information about proxy objects. music.. audiobook. etc. Agent Plug-ins . original_title A string specifying the album’s original title. collections . podcast. Metadata objects will often have many posters. Release 2. 5. 44 Chapter 5. class Track Represents an audio track (e.

Preview(data.Media(data.g. Release 2. Using proxies is simple.Preview(poster_thumbnail_data) The sort_order attribute can be set to specify the order in which the possible choices are presented to the user. The proxy should be assigned to a proxy container attribute.e. i.1.posters[full_poster_url] = Proxy. Items with lower sort order values are listed first. 5. using the media’s full URL as the key: metadata. a thumbnail image for a high-resolution poster. or a short clip of a theme music file.4. When the user selects a piece of media referred to by a preview proxy. e. sort_order=None) This proxy should be used when no preview version of the media is available. Metadata Model Classes 45 . Proxy. sort_order=None) This proxy should be used when a preview version of the final piece of media is available. the media server will automatically download the final piece of media for use by clients.Plex Plug-in Framework Documentation.1 To remedy this. the data is the real media file data. There are two types of proxy available: Proxy. the framework uses proxy objects to reduce the amount of data that needs to be downloaded during the initial metadata update.

Release 2. Agent Plug-ins .1.Plex Plug-in Framework Documentation.1 46 Chapter 5.

including communicating with the media server. All plug-ins should be registered under one of the four main top-level directories: video. Any subsequent requests with a matching prefix will be directed to that plug-in by the media server: @handler(’/video/example’.1 Standard API 6.png”. name. This performs a variety of tasks automatically. ’Example’) def Main(): pass The decorated function definition should not include any required arguments.1 Controlling the runtime environment All plug-in code executes inside a runtime environment provided by the framework. creating contexts in which to handle incoming requests.1.html#str)) – The prefix at which to register the plug-in. art=”art-default. Parameters • prefix (str (http://docs.python.org/library/functions. thumb=”icon-default. The framework provides a number of APIs for controlling the runtime environment and accessing contextual request information. photos or applications. and formatting responses for consumption by clients.CHAPTER SIX API REFERENCE Contents: 6. music.png”) This function should always be used as a decorator. 47 . Global functions The following global functions are provided: handler(prefix. It enables the developer to register a function in their code as a prefix handler.

html#str)) – The path for the new route. ext=None. Route paths can include keyword arguments enclosed in braces that will be passed to the function when it is executed: @route(’/video/example/myRoute/{x}’) def MyFunction(x): print x Callback(f. Release 2.python. title = "Callback Example" ) ] ) return oc def FunctionB(x): print ’FunctionB called:’. Parameters • path (str (http://docs.python. It allows functions to be assigned routes under a registered prefix (e. • method (str (http://docs. This enables the developer to give their plug-in a REST-like API with very little effort. to be displayed in the client user interface. This can be either a string.org/library/functions. route(path. the given function will be executed with the arguments provided. x=’abc’).Plex Plug-in Framework Documentation. the developer should consider adding routes to their plug-in’s functions if this is important. It is used to specify that a function does not return data directly.org/library/functions.1. either GET or PUT. using classes explained in the next section: @handler(’/video/example’. method=’GET’) This function should always be used as a decorator. but instead returns an ObjectContainer (page 52) with 48 Chapter 6.html#str)) – The HTTP method the route should be assigned to. **kwargs) Generates a callback path for the given function.1 • name – The title of the registered prefix. A route will be used if one is available. ’Example’) def FunctionA(): oc = ObjectContainer( objects = [ DirectoryObject( key = Callback(FunctionB. otherwise an internal callback URL will be generated. /video/example/myRoute). If a request is made for the returned URL. x return None indirect() This function should only be used as a decorator. Here is a short example of using a callback. Since these are not easily readable or modifiable. or the key of a localized string (see Locale (page 79) for more information).g. API Reference .

cols=None. Plugin.Prefixes Returns a list of all prefixes currently registered by the plug-in. it is sometimes useful to be able to have more control over the routing system. which provides view group management and manages the registration and calling of prefix of route handler functions. Parameters value (int (http://docs.org/library/functions. Return type str Plugin. While the route decorator above is sufficient for most uses. mediaType=’items’.1. the fewer resources will be given to this plug-in. rtype list Plugin. The value should be between 0 (the default) and 20.1..Identifier A read-only attribute containing the identifier of the plug-in. which affects how system resources are allocated.html#int)) – The level of ‘niceness’ to apply Plugin.Nice(value) Alters the plug-in’s ‘niceness’ level. Standard API 49 .1 a single item referring to the final location of the data.AddViewGroup(name. Plugin The Plugin API includes methods and attributes for interacting with the global plug-in object. rows=None.ViewGroups Plugin.Plex Plug-in Framework Documentation. viewMode=’List’.python. 6.. menu=None. Using the decorator is simple: @indirect @route(’/video/example/myRoute/play’) def Play(x): . type=None.Traceback(msg=’Traceback’) Route The Route module provides additional methods for working with routes. The higher the value. and these can’t be computed easily or quickly. Release 2. summary=None) Plugin. allowing other plug-ins and applications to make use of them instead. The framework will automatically adjust generated callback paths and the XML returned to clients to indicate that the function does not return a direct response. This is useful when the server the stream resides on requires a specific user agent string or cookies before it will serve the media. thumb=None.

This is unnecessary for most plug-ins. Return type str Platform. API Reference .1. for example. method=’GET’. Returns The current CPU architecture. MIPS. Returns The current platform. but allows instance methods of objects to be added as routes as well as unbound functions.CPU Reports the current server’s CPU architecture. Request. 50 Chapter 6. mips64 or armv5tel. or the plug-in relies on a feature not supported by all versions of the media server. either MacOSX. Platform.Connect(path. Platform The Platform API provides information about the server platform the plug-in is currently running on. the code needs to call external binaries only available on certain platforms. f. While almost all plug-in code can be used cross-platform safely. Note: These methods can only be used inside a request context. Release 2. Windows or Linux. Return type dict Response The Response API allows the developer to modify the HTTP response that will be returned to the client. but in some cases it can be useful to be able to specify additional response data.HasSilverlight Reports whether the server supports playback of Silverlight video content.1 Route. Return type bool Request The Request API provides access to the HTTP request currently being handled by the plug-in.Plex Plug-in Framework Documentation. it is sometimes desirable to perform platform-specific checks if. **kwargs) Provides equivalent functionality to the route decorator. Return type str Platform.OS Reports the current server’s operating system. either i386.Headers A dictionary of the HTTP headers received by the plug-in for the current request. Note: These methods can only be used inside a request context.

Return type list of the constants defined in 6. one ClientPlatform (page 88).org/wiki/List_of_HTTP_status_codes) of the response.1.Plex Plug-in Framework Documentation. Returns The client platform.Headers[’MyHeader’] = ’MyValue’ Response.1.1 Response. allowing the developer to offer content selectively based on the capabilities of the device.2 Objects The framework’s class library makes returning content to the media server or a client very simple and easy to understand. Return type str Client.Status An integer value specifying the HTTP status (http://en. Client. Object classes Each object class includes a number of attributes. Using the classes provided. containing constants defined in Protocol (page 88). either as part of the constructor. The runtime environment will automatically convert the returned objects into the media server’s standard XML format. Returns A list of protocols supported by the client. Client code The Client API provides information about the client currently accessing the plug-in.Protocols Reports the protocols supported by the client currently accessing the plug-in. the developer can construct rich trees of objects using the same metadata types as Plex’s own library system. Standard API 51 .Headers A dictionary of keys and values that will be returned to the client as HTTP headers: HTTP.Platform Reports the platform of the client currently accessing the plug-in. Attributes for each object can be set in two ways. or by setting the attribute individually later on: 6. Note: These methods can only be used inside a request context.wikipedia. Release 2.1.

API Reference .tagline = "Movie Tagline" Additionally. This should be the name of a group previously registered with Plugin. Release 2. ObjectContainer is the type most frequently returned to other applications.AddViewGroup() (page 49). view_group A string specifying the name of the view group the client should use when displaying the container’s contents. attributes can be set on the classes themselves. 52 Chapter 6.1. studio = "Movie Studio" ) movie. Any objects created afterwards will inherit the default attribute from the class: MovieObject. It provides clients with an ordered list of items in response to a request.1 movie = MovieObject( title = "Movie Title".studio = "Movie Studio" The following classes are available: • ObjectContainer (page 52) • MovieObject (page 54) • VideoClipObject (page 56) • EpisodeObject (page 56) • SeasonObject (page 57) • TVShowObject (page 58) • ArtistObject (page 59) • AlbumObject (page 59) • TrackObject (page 60) • DirectoryObject (page 62) • PopupDirectoryObject (page 62) • InputDirectoryObject (page 63) • PrefsObject (page 63) • MediaObject (page 64) • PartObject (page 65) The attributes supported by each class are listed below. Containers class ObjectContainer(**kwargs) A container for other objects.Plex Plug-in Framework Documentation.

. They instruct the client to isplay a message dialog on loading the container. This attribute should be set to one of the container type constants identified here. mixed_parents A boolean indicating that the objects in the container do not share a common parent object (for example. no_history A boolean specifying whether the container should be added to the client’s history stack. user_agent A string specifying the user agent header that needs to be sent to the server when attempting to play items from the container. the client will cache a container for use when navigating back up the directory tree. For example. The container can also be populated by passing a list of objects to the constructor as the objects argument: 6. Standard API 53 . Release 2. if Container B in the sequence A => B => C had no_cache set to True. . no_cache A boolean indicating whether the container can be cached or not. navigating back from C would take the user directly to A. If no_cache is set to True.1.Plex Plug-in Framework Documentation. tracks in a playlist). navigating back from C would take the user directly to A. title1 A string specifying the first title to display in the user interface.todo:: Link to container types art A string specifying an image resource that should be used as the container’s background art. replace_parent A boolean specifying whether the container should replace the previous container in the client’s history stack. the container will be requested again when navigating back. For example. if Container C in the sequence A => B => C had replace_parent set to True. where header is the message dialog’s title and message is the body. http_cookies A string specifying any HTTP cookies that need to be passed to the server when attempting to play items from the container. title2 A string specifying the second title to display in the user interface.1. header message The header and message attributes are used in conjunction.1 content Identifies the type of the objects inside the container. add(obj) Adds the object obj to the container. Under normal circumstances.

html#len) function to get the number of objects they contain.) url A string specifying the URL of the movie. API Reference . Note: If the url attribute is set (invoking a URL service). This is usually a function callback generated using Callback() (page 48).org/library/functions. in milliseconds. tags A list of strings specifying the movie’s tags.1.1 oc = ObjectContainer( objects = [ MovieObject( title = "Movie" ).Plex Plug-in Framework Documentation. duration An integer specifying the duration of the movie. the key attribute is set automatically. home movie. Release 2. the key and rating_key attributes will be set and the list of media objects will be generated automatically. independent film. genres A list of strings specifying the movie’s genre. 54 Chapter 6. key A string specifying the path to the movie’s full metadata object. The function should return an ObjectContainer containing a single metadata object with the maximum amount of metadata available. the rating_key attribute is set automatically. a theatrical release. etc. VideoClipObject( title = "Video Clip" ) ] ) len(container) Containers can be passed to the len() (http://docs. rating_key A string specifying a unique identifier for the movie.python. If a URL service that matches the given URL is available. Metadata objects class MovieObject(**kwargs) Represents a movie (e. This unique value is used by the media server for maintaining play counts and providing other advanced features.g. Note: If the url attribute is set (invoking a URL service).

1. countries A list of strings specifying the countries involved in the production of the movie. directors A list of strings specifying the movie’s directors. quotes A string containing memorable quotes from the movie. content_rating_age A string specifying the minumum age for viewers of the movie.g. trivia A string containing trivia about the movie. source_title A string specifying the source of the movie (e. art A string specifying an image resource to use as the movie’s background art. writers A list of strings specifying the movie’s writers.Plex Plug-in Framework Documentation. tagline A string specifying the movie’s tagline. Standard API 55 . originally_available_at A date object specifying the movie’s original release date. Netflix or YouTube) title A string specifying the movie’s title. original_title A string specifying the movie’s original title. summary A string specifying the movie’s summary. Release 2. producers A list of strings specifying the movie’s producers. 6. studio A string specifying the movie’s studio. year An integer specifying the movie’s release year. content_rating A string specifying the movie’s content rating. thumb A string specifying an image resource to use as the movie’s thumbnail.1 rating A float between 0 and 10 specifying the movie’s rating.1.

. the key and rating_key attributes will be set and the list of media objects will be generated automatically. VideoClipObject has the same attributes as MovieObject.Plex Plug-in Framework Documentation. API Reference . url A string specifying the URL of the movie.1.g. Note: If the url attribute is set (invoking a URL service). rating_key A string specifying a unique identifier for the episode. 56 Chapter 6. the rating_key attribute is set automatically.1 add(obj) Adds the MediaObject (page 64) instance obj to the movie’s item list. summary A string specifying the episode’s summary. This unique value is used by the media server for maintaining play counts and providing other advanced features. writers A list of strings specifying the episode’s writers. class EpisodeObject(**kwargs) Represents an episode of a TV show or other episodic content. Release 2..) ] ) class VideoClipObject(**kwargs) Represents a video clip (e. producers A list of strings specifying the episode’s producers. a YouTube or Vimeo video). The items can also be populated by passing a list of objects to the constructor as the items argument: m = MovieObject( items = [ MediaObject(. guest_stars A list of strings specifying the episode’s guest stars. originally_available_at A date object specifying when the episode originally aired. title A string specifying the episode’s title. directors A list of strings specifying the episode’s directors. If a URL service that matches the given URL is available. rating An integer attribute with a valuebetween 0 and 10 specifying the episode’s rating.

art A string specifying an image resource to use as the episode’s background art.Plex Plug-in Framework Documentation. rating_key A string specifying a unique identifier for the season. Release 2.1.. source_title A string specifying the source of the episode (e. thumb A string specifying an image resource to use as the episode’s thumbnail.) ] ) class SeasonObject(**kwargs) Represents a season of a TV show. This is usually a function callback generated using Callback() (page 48). This unique value is used by 6. Netflix or YouTube) duration An integer specifying the duration of the episode. the key attribute is set automatically. The function should return an ObjectContainer containing a single metadata object with the maximum amount of metadata available. The items can also be populated by passing a list of objects to the constructor as the items argument: obj = EpisodeObject( items = [ MediaObject(. key A string specifying the path to a container representing the season’s content. Note: If the url attribute is set (invoking a URL service).1.1 absolute_index An integer specifying the absolute index of the episode within the entire series. Standard API 57 .g. summary A string specifying the season’s summary. show A string identifying the show the episode belongs to. in milliseconds. key A string specifying the path to the episode’s full metadata object. This is usually a function callback generated using Callback() (page 48).. season An integer identifying the season the episode belongs to. add(obj) Adds the MediaObject (page 64) instance obj to the episode’s item list.

1 the media server for maintaining play counts and providing other advanced features. summary A string specifying the show’s summary. genres A list of attributes specifying the show’s genres. show A string specifying the show the season belongs to. source_title A string specifying the source of the season (e. Release 2. API Reference . tags A list of attributes specifying the show’s tags. in milliseconds. Netflix or YouTube) thumb A string specifying an image resource to use as the season’s thumbnail. This unique value is used by the media server for maintaining play counts and providing other advanced features.1.g. episode_count An integer specifying the number of episodes in the season. Netflix or YouTube) title A string specifying the show’s title. source_title A string specifying the source of the show (e. title A string specifying the title to display for the season in the user interface. rating_key A string specifying a unique identifier for the show. or the top-level of other episodic content. This is usually a function callback generated using Callback() (page 48). duration An integer specifying the approximate duration of each episode in the show. key A string specifying the path to a container representing the show’s content. index An integer specifying the season’s index. art A string specifying an image resource to use as the season’s background art. rating A float between 0 and 10 specifying the show’s rating.Plex Plug-in Framework Documentation. class TVShowObject(**kwargs) Represents a TV show.g. 58 Chapter 6.

art A string specifying an image resource to use as the show’s background art. Rhapsody or Spotify) title A string specifying the artist’s name. Standard API 59 . key A string specifying the path to a container representing the artist’s content. summary A string specifing the artist’s biography. tags A list of strings specifying the artist’s tags. genres A list of strings specifying the artist’s genres. source_title A string specifying the source of the artist (e. rating A float between 0 and 10 specifying the artist’s rating. episode_count An integer specifying the TV show’s total number of episodes.1.g. duration An integer specifying the total duration of the artist’s albums. art A string specifying an image resource to use as the artist’s background art. countries A list of strings specifying the countries involved in the production of the show. thumb A string specifying an image resource to use as the show’s thumbnail. studio A string specifying the studio that produced the show. class ArtistObject(**kwargs) Represents an artist or group.1 originally_available_at A date object specifying the date the show originally started airing.1. 6.Plex Plug-in Framework Documentation. thumb A string specifying an image resource to use as the artist’s thumbnail. in milliseconds. This is usually a function callback generated using Callback() (page 48). track_count An integer specifying the total number of tracks available for the artist. Release 2. content_rating A string specifying the show’s content rating.

Release 2.g. API Reference . key A string specifying the path to a container representing the album’s tracks. genres A list of strings specifying the album’s genres.) 60 Chapter 6. etc. originally_available_at A date object specifying the album’s original release date. in milliseconds. audiobook. Rhapsody or Spotify) artist A string specifying the artist the album belongs to.1. thumb A string specifying an image resource to use as the album’s thumbnail.Plex Plug-in Framework Documentation. duration An integer specifying the duration of the album. music. class TrackObject(**kwargs) Represents an audio track (e. original_title A string specifying the album’s original title. source_title A string specifying the source of the album (e. art A string specifying an image resource to use as the album’s background art. This is usually a function callback generated using Callback() (page 48). rating A float between 0 and 10 specifying the album’s rating. track_count An integer value specifying the number of tracks the album contains. studio A string specifying the album’s studio. countries A list of strings specifying the countries involved in the production of the album. title A string specifying the album’s title. podcast.g. summary A string specifying the album’s summary.1 class AlbumObject(**kwargs) Represents a music album. tags A list of strings specifying the album’s tags. producers A list of strings specifying the album’s producers.

1. Note: If the url attribute is set (invoking a URL service). index An integer specifying the track’s index in the parent album. Release 2. title A string specifying the track’s title. Rhapsody or Spotify) thumb A string specifying an image resource to use as the track’s thumbnail. in milliseconds. Standard API 61 . the key attribute is set automatically. artist A string specifying the artist the track belongs to. rating A float between 0 and 10 specifying the track’s rating. If a URL service that matches the given URL is available. album A string specifying the album the track belongs to.1 url A string specifying the URL of the track. the key and rating_key attributes will be set and the list of media objects will be generated automatically. This unique value is used by the media server for maintaining play counts and providing other advanced features. key A string specifying the path to the track’s full metadata object.1. duration An integer specifying the duration of the track. the rating_key attribute is set automatically. Note: If the url attribute is set (invoking a URL service). source_title A string specifying the source of the track (e.g. tags A list of strings specifying the track’s tags.Plex Plug-in Framework Documentation. rating_key A string specifying a unique identifier for the track. genres A list of strings specifying the track’s genres. 6. The function should return an ObjectContainer containing a single metadata object with the maximum amount of metadata available. This is usually a function callback generated using Callback() (page 48).

and are not added to the client’s history stack. API Reference . This is usually a function callback generated using Callback() (page 48).PopupDirectoryObjects are presented as a pop-up menu where possible. add(obj) Adds the MediaObject (page 64) instance obj to the track’s item list.1 art A string specifying an image resource to use as the track’s background art.Plex Plug-in Framework Documentation. duration An integer specifying the duration of the objects provided by the directory. The only difference is in the presentation of the directory’s content on the client . thumb A string specifying an image resource to use as the directory’s thumbnail. art A string specifying an image resource to use as the directory’s background art. tagline A string specifying the directory’s tagline. summary A string specifying the directory’s summary.. 62 Chapter 6.. class PopupDirectoryObject(**kwargs) Similar to DirectoryObject above. in milliseconds. The items can also be populated by passing a list of objects to the constructor as the items argument: obj = TrackObject( items = [ MediaObject(.1. Directory objects are usually used when creating a navigation hierarchy. key A string specifying the path to a container representing the directory’s content. key A string specifying the path to a container representing the directory’s content. title A string specifying the directory’s title. This is usually a function callback generated using Callback() (page 48). Release 2.) ] ) Generic browsing objects class DirectoryObject(**kwargs) Represents a generic container of objects.

tagline A string specifying the directory’s tagline. summary A string specifying the directory’s summary. key A string specifying the path to a container representing the directory’s content. in milliseconds. Release 2. thumb A string specifying an image resource to use as the directory’s thumbnail. 6. The client will display an input dialog with the given prompt. tagline A string specifying the object’s tagline. Standard API 63 . tagline A string specifying the directory’s tagline. title A string specifying the object’s title. art A string specifying an image resource to use as the directory’s background art. duration An integer specifying the duration of the objects provided by the directory. title A string specifying the directory’s title. prompt A string specifying the prompt that should be displayed to the user in the input dialog displayed after selecting the object. summary A string specifying the directory’s summary. class InputDirectoryObject(**kwargs) Represents a container of objects generated from a query inputted by the user.1. art A string specifying an image resource to use as the directory’s background art. class PrefsObject(**kwargs) Represents an item that invokes the user preferences dialog when selected.1 title A string specifying the directory’s title. thumb A string specifying an image resource to use as the directory’s thumbnail. which contains the query entered by the user. The function must accept a query argument. This is usually a function callback generated using Callback() (page 48).1.Plex Plug-in Framework Documentation.

Each metadata object may have multiple media objects associated with it. This attribute should be set to one of the constants defined in Container (page 89). resolutions and/or containers (where available). 6 for 5. audio_codec A string specifying the media’s audio codec.1. 2 for stereo. The list should contain values defined in Protocol (page 88). All media objects for the metadata object should refer to the same media. The list should contain values defined in Platform (page 50).g. thumb A string specifying an image resource to use as the object’s thumbnail. video_codec A string specifying the media’s video codec. art A string specifying an image resource to use as the object’s background art. Release 2.1). If the list is empty. 64 Chapter 6.1 summary A string specifying the object’s summary. aspect_ratio An integer specifying the media’s aspect ratio (width / height). This attribute should be set to one of the constants defined in AudioCodec (page 89). container A string specifying the media’s container. audio_channels An integer specifying the number of audio channels the media has (e. but in different formats. protocols A list of strings specifying the protocols that the server and client must support in order to play the media directly. the item will be available on all platforms. bitrate An integer specifying the media’s bitrate. Media objects class MediaObject(**kwargs) Represents a single piece of media. This attribute should be set to one of the constants defined in VideoCodec (page 89).Plex Plug-in Framework Documentation. video_resolution An integer specifying the vertical resolution of the video. allowing the client to choose the most appropriate item for playback. platforms A list of strings specifying the client platforms the media item should be made available to. API Reference .

height=None. RTMPVideoURL(url. WindowsMediaVideoURL(url. clip=None. duration An integer specifying the duration of the media.Plex Plug-in Framework Documentation. in milliseconds. Standard API 65 . This can be an absolute URL. width=None..1. live=False) Returns a URL that starts WebKit playback of the given RTMP URL using Plex’s hosted RTMP player..1. The client will play each part contiguously.1 video_frame_rate An integer representing the frame rate of the media. in milliseconds. add(obj) Adds the PartObject (page 65) instance obj to the media object’s list of parts. the developer can simply use one of the functions below to set the value of a PartObject (page 65)‘s key: PartObject( key = WebVideoURL(url) ) WebVideoURL(url) Returns a URL that starts WebKit playback of the given web page URL. URL generating functions The framework also provides three functions for handling URLs that require Plex’s WebKit playback capabilities. but can contain more if the media is split across several files or URLs. Most MediaObject instances will usually only have one part. or a callback to another function generated using Callback() (page 48). There must be a matching site configuration (page 13). The media object can also be populated by passing a list of objects to the constructor as the parts argument: media = MediaObject( parts = [ PartObject(. width=None. key A string specifying the location of the part. duration An integer specifying the duration of the part. Release 2. clips=None.) ] ) class PartObject(**kwargs) Represents a part of a piece of media. To instruct the client to play the given URL using WebKit. height=None) Returns a URL that starts WebKit playback of the given Windows Media URL using Plex’s hosted Silverlight player. 6.

*args. globalize=True. 6.SharedExternalPath(itemname) Generates an externally accessible path for the named shared resource. A list of valid shared resource names is provided below. Note: The alias S() is equivalent to this method. To enable this.GuessMimeType(path) Attempts to guess the MIME type of a given path based on its extension. This is sufficient for most plug-ins. 66 Chapter 6. binary=True) Loads the named shared resource file and returns the data as a string. and provides various methods of synchronization. a specific API for threading is provided.1 6. Thread. in certain cases the developer may need to exert more control over the execution of their code. Note: The alias R() is equivalent to this method. Resource.Load(itemname. Thread The Thread API allows the developer to create multiple threads of execution. Resource. Resource.Create(f.1. binary=True) Loads the named resource file and returns the data as a string. Resource. **kwargs) Creates a new thread which executes the given function. This method is usually used to assign bundled images to object attributes.1.1. Release 2. API Reference .AddMimeType(mimetype.3 Accessing bundled resources Resource The Resource API provides methods that can be used to load files contained in the bundle’s Resources directory.Plex Plug-in Framework Documentation. Parameters f (function) – The function to execute. using the arguments and keyword arguments provided.4 Threading The framework uses threading extensively under the hood to handle multiple concurrent requests and perform certain sets of tasks concurrently.LoadShared(itemname. extension) Assigns the specified MIME type to the given extension. Resource. however.ExternalPath(itemname) Generates an externally accessible path for the named resource. Resource.

html#float)) – The number of seconds to sleep for.org/library/threading.python.Event(key=None) Returns the event object with the given key. **kwargs) Similar to the Create method above.python.python. Parameters key (str or None) – The key of the named event to return. globalize=True. Thread. If no named lock object exists. Release 2.ReleaseLock(key) Releases the named lock for the given key.html#str)) – The key of the named lock to acquire. Return type Lock objects) (http://docs.CreateTimer(interval. Return type Event objects) 6. but executes the function in a background thread after the given time interval rather than executing it immediately.org/library/functions. *args.AcquireLock(key) Acquires the named lock for the given key. If the developer chooses not to globalize a thread.org/library/functions.1. Standard API (http://docs. Thread. a new one is created and returned.python. Parameters • interval (float (http://docs. Parameters interval (float (http://docs. Parameters key (str (http://docs. a new one is created and returned.see contexts).html#float)) – The number of seconds to wait before executing the function • f (function) – The function to execute.1 Note: By default. threads are globalized (removed from the current request context and executed in the global context . it is their responsibility to ensure the main request thread stays alive while the new thread is running to avoid the request context being released too early.python. Thread. Note: It is the developer’s responsibility to ensure the lock is released correctly. Parameters key (str (http://docs. If no key is provided. If no named event object exists. anonymous event object is returned. a new. a new. If no key is provided. f.Lock(key=None) Returns the lock object with the given key. Thread.org/library/threading.html#str)) – The key of the named lock to acquire.org/library/functions.org/library/functions. anonymous lock object is returned.Plex Plug-in Framework Documentation.1.Sleep(interval) Pauses the current thread for a given time interval. Parameters key (str or None) – The key of the named lock to return. Thread.python.html#event- 67 .html#lock- Thread.

Block(key) Clears a named event.html#str)) – The key of the named event. If no named semaphore object exists. Network Network.python.python. Return type bool Thread.org/library/functions. Release 2. The HTTP methods in particular simplify the underlying request mechanism. Return type str 68 Chapter 6.html#semaphoreobjects) 6. or False if the timeout occurred first.html#float)) – The number of seconds to wait before aborting. or the timeout interval elapses (if provided). causing any threads that subsequently wait for the event will block. timeout=None) If the named event is unset. • timeout (float (http://docs.Wait(key. this will usually be a local IP address.1.1 Thread. Thread.Address Returns the server’s IP address. Parameters key (str (http://docs.org/library/threading. Parameters key (str or None) – The key of the named semaphore to return. API Reference . providing features such as automatic caching and cookie support.Plex Plug-in Framework Documentation. Parameters • key (str (http://docs.org/library/functions. Returns True if the named event was set while waiting. Thread.html#str)) – The key of the named event. unblocking any threads currently waiting on it.python. Unless the server is connected directly to the internet. Parameters key (str (http://docs.Unblock(key) Sets a named event.org/library/functions. The framework includes a number of features that make networking as simple as possible.org/library/functions. Return type Semaphore (http://docs. a new one is created and returned.python. If no key is provided.1.html#str)) – The key of the named event.python. limit=1) Returns the semaphore object with the given key. anonymous semaphore object is returned. a new.Semaphore(key=None.5 Networking Communicating with the outside world is one of the most common things plug-ins need to do. this method causes the current thread to block until the event is set.

html#int)) – The maximum age (in second) of cached data before it should be considered invalid. • headers (dict (http://docs. Return type socket objects) (http://docs. • timeout (float (http://docs. • cacheTime (int (http://docs.SSLSocket() Creates a new SSLSocket object. the HTTP request will be made immediately when the object is created (by default.Request(url. Return type str Network. HTTP. encoding=None.python.Socket() Creates a new socket object.Hostname Returns the server’s hostname.org/library/functions.python.org/library/functions. immediate=False. The only additional requirement is that the do_handshake() method is called after establishing a connection.python.org/library/socket. Standard API 69 . data=None) Creates and returns a new HTTPRequest (page 70) object. timeout=<object object at 0x10042bc40>. errors=None.html#bool)) – If set to True.org/library/functions.python.1. headers={}. but support SSL connections. • values (dict (http://docs. Release 2. Return type str Network. cacheTime=None.python.1.org/library/functions. Parameters • url (str (http://docs. 6. These objects operate almost identically to the socket objects returned by the above method.1 Network. sleep=0.html#socket- Network.python. values=None.python.html#dict)) – Any custom HTTP headers that should be added to this request. • immediate (bool (http://docs.html#dict)) – Keys and values to be URL encoded and provided as the request’s POST body.html#str)) – The URL to use for the request.PublicAddress Returns the public IP address of the network the server is currently connected to.org/library/stdtypes.org/library/stdtypes. requests are delayed until the data they return is requested).html#float)) – The maximum amount of time (in seconds) to wait for the request to return a response before timing out. HTTP The HTTP API provides methods for making HTTP requests and interacting with the framework’s HTTP subsystem.Plex Plug-in Framework Documentation.

encoding=None. HTTP. password.GetCookiesForURL(url) HTTP. This method returns nothing . errors=None) Instructs the framework to pre-cache the result of a given HTTP request in a background thread. headers A dictionary of HTTP headers returned by the server in response to the request.SetPassword(url.python.ClearCookies() Clears the plug-in’s HTTP cookies.RandomizeUserAgent(browser=None) Sets the plug-in’s user agent string to a random combination of browser & operating system versions. API Reference . load() Instructs the object to issue the HTTP request. • data (str (http://docs.Headers A dictionary containing the default HTTP headers that should be issued with requests: HTTP. By default.html#str)) – The raw POST data that should be sent with the request.CacheTime The default cache time (in seconds) used for all HTTP requests without a specific cache time set. HTTP.html#float)) – The amount of time (in seconds) that the current thread should be paused for after issuing a HTTP request. cacheTime=None. values=None. if it hasn’t done so already. this value is 0.it is designed to ensure that cached data is available for future calls to HTTP.org/library/functions.Headers[’User-Agent’] = ’My Plug-in’ class HTTP.python. Type float HTTP. realm=None) HTTP. HTTP. headers={}. and issue it when necessary.Plex Plug-in Framework Documentation. If the data is retrieved from the cache.org/library/functions.Request() (page 69). username.html#str)) – The browser to generate a user agent string for. These objects are returned from HTTP. They encapsulate information about a pending HTTP request.Request. Either Firefox or Safari. Release 2.HTTPRequest This class cannot be instantiated directly.org/library/functions. This attribute cannot be used in conjunction with values.PreCache(url.ClearCache() Clears the plug-in’s HTTP cache. Parameters browser (str (http://docs. this value is ignored. HTTP.1 • sleep (float (http://docs. 70 Chapter 6. HTTP. This is to ensure undue burden is not placed on the server.python.1. or None to randomly select the browser used.

html) libraries.html#xmlrpclib.ServerProxy (http://docs.html) 6. XML The XML API provides methods for converting between XML-formatted strings and trees of XML Element objects. 6.python. text=None. XMLRPC The XMLRPC API provides access to Python’s (http://docs. Return type _Element (http://lxml.1.html#module-xmlrpclib) module. Release 2. **kwargs) Returns a new XML element with the given name and text content.Proxy(url. Standard API 71 . The framework’s default HTTP headers will be used. xmlrpclib allowing de- XMLRPC. Manipulating elements returned by the etree library using XPath is a very powerful way of finding and accessing data within a XML document. Note: It is strongly recommended that developers read lxml’s XPath Tutorial (http://lxml. Any keyword arguments provided will be set as attributes. velopers to easily communicate with XMLRPC services. and return that content to either a client or the media server itself. Parameters • name (str (http://docs. Because data available online comes in a variety of formats.Element(name.python.org/library/functions.etree. encoding=None) Returns an xmlrpclib.de/tutorial.html#the-element-class) and objectify (http://lxml.de/api/lxml.de/objectify.org/library/xmlrpclib. Learning to use XPath efficiently will greatly simplify the plug-in’s code. manipulate that data to extract meaningful content from it. • text (str (http://docs.6 Parsing and manipulating data The most common requirement for plug-ins is the ability to retrieve data.de/xpathxslt.1. XML._Element-class.Ser object for the given url.html#str)) – The text content of the new element. The underlying functionality is provided by the lxml etree (http://lxml. New XML element trees can also be constructed. the framework includes a number of data parsing libraries capable of handling the most common types of data format and provides simple APIs for converting between these formats and regular Python objects.org/library/functions.python.1.python.1 content A string containing the response’s body.org/library/xmlrpclib.html#xpath).html#str)) – The name of the new element.Plex Plug-in Framework Documentation.

timeout=<object object at 0x10042bc40>. • sleep (float (http://docs.org/library/functions.python. encoding=’utf8’) Converts the XML element object el to a string representation using the given encoding. encoding=None) Converts string to a HTML element object.ElementFromString(string.ElementFromURL(url.objectify.Plex Plug-in Framework Documentation.StringFromObject(obj.org/library/stdtypes.de/api/lxml.de/api/lxml. sleep=0) Retrieves the content for a given HTTP request and parses it as objectified XML using the above method.html#dict)) – Values to pass as URL encoded content for a POST request.python. Return type _Element (http://lxml.org/library/functions. encoding=’utf-8’) Attempts to create objectified XML from the given object. Release 2. XML. ensuring undue burden isn’t placed on web servers.python.html) XML. XML.python. values=None.etree._Element-class. API Reference . sleep=0) Retrieves the content for a given HTTP request and parses it as XML using the above method. cacheTime=None. • cacheTime (float (http://docs. Parameters • url (str (http://docs.1 XML. • values (dict (http://docs.html#float)) – The maximum amount of time (in seconds) that the framework should wait for a response before aborting. autoUpdate=False.ObjectFromURL(url.org/library/stdtypes. errors=None.python.html#float)) – The number of seconds the current thread should pause for if a network request was made.org/library/functions.html) XML. Return type ObjectifiedElement (http://lxml.1. timeout=<object object at 0x10042bc40>.org/library/functions. encoding=None. • timeout (float (http://docs.python. values=None. 72 Chapter 6.html#dict)) – Custom HTTP headers to add to the request. this value is ignored. headers={}. cacheTime=None.html#str)) – The URL to retrieve content from.StringFromElement(el. headers={}. encoding=None.html#float)) – The maximum age (in seconds) that cached data should still be considered valid.ObjectifiedElementclass. XML.ObjectFromString(string) Parses string as XML-formatted content and attempts to build a Python object using the objectify library. • headers (dict (http://docs. If cached data was used. errors=None.

org/library/functions.python. HTML.html#str)) – The URL to retrieve content from. Parameters • name (str (http://docs. • cacheTime (float (http://docs.org/library/functions.de/api/lxml.Element(name. encoding=’utf8’) Converts the HTML element object el to a string representation using the given encoding. • text (str (http://docs.python.python.html) 6. If cached data was used.org/library/functions. • values (dict (http://docs.org/library/functions.html#dict)) – Values to pass as URL encoded content for a POST request.python. HTML The HTML API is similar to the XML API.html#str)) – The text content of the new element. ensuring undue burden isn’t placed on web servers.org/library/stdtypes. this value is ignored.StringFromElement(el.html#float)) – The number of seconds the current thread should pause for if a network request was made. Return type HtmlElement (http://lxml. text=None. • timeout (float (http://docs.html#float)) – The maximum age (in seconds) that cached data should still be considered valid.ElementFromString(string) Converts string to a HTML element object.de/lxmlhtml. Return type HtmlElement class.de/api/lxml.1 Parameters • url (str (http://docs.python.org/library/stdtypes.Plex Plug-in Framework Documentation. HTML.HtmlElement-class. Standard API 73 . Release 2.html.org/library/functions.html. • headers (dict (http://docs. • sleep (float (http://docs. but is better suited to parsing HTML content.python. Any keyword arguments provided will be set as attributes. **kwargs) Returns a new HTML element with the given name and text content.1.html#float)) – The maximum amount of time (in seconds) that the framework should wait for a response before aborting.python.html#str)) – The name of the new element.html) library.python.html#dict)) – Custom HTTP headers to add to the request.1.HtmlElement- HTML.org/library/functions. It is powered by the lxml html (http://lxml.html) (http://lxml.

1 HTML. Parameters • url (str (http://docs.org/library/stdtypes. API Reference . • sleep (float (http://docs. cacheTime=None. If cached data was used.org/library/functions. • values (dict (http://docs.ObjectFromURL(url. Note: The framework includes two JSON parsers .html#str)) – The URL to retrieve content from.ObjectFromString(string.html#dict)) – Values to pass as URL encoded content for a POST request.Plex Plug-in Framework Documentation.org/library/functions. errors=None. • headers (dict (http://docs. timeout=<object object at 0x10042bc40>. usually a dictionary. If a string is unable to be parsed by the fast parser. an error will be logged indicating the position in the string where parsing failed.python.python. ensuring undue burden isn’t placed on web servers. as slow JSON parsing can have a severely detrimental effect on performance. If possible.org/library/functions. cacheTime=None. especially on embedded systems.one is fast.1.org/library/functions. JSON. but very strict.json.html#dict)) – Custom HTTP headers to add to the request. Release 2. sleep=0) 74 Chapter 6.html#float)) – The maximum amount of time (in seconds) that the framework should wait for a response before aborting.python. the developer should check for and resolve these errors. while the second is slower but more tolerant of errors.ElementFromURL(url.python.org/library/stdtypes. More information about the JSON format can be found here (http://www. • cacheTime (float (http://docs.python. errors=None.python. and vice versa. values=None. timeout=<object object at 0x10042bc40>.html#float)) – The maximum age (in seconds) that cached data should still be considered valid. • timeout (float (http://docs.org/). headers={}. encoding=None) Converts a JSON-formatted string into a Python object. this value is ignored. encoding=None.html#float)) – The number of seconds the current thread should pause for if a network request was made. values=None. encoding=None. sleep=0) Retrieves the content for a given HTTP request and parses it as HTML using the above method.StringFromObject(obj) Converts the given object to a JSON-formatted string representation. JSON. headers={}. JSON. JSON The JSON API provides methods for easily converting JSON-formatted strings into Python objects.

html#float)) – The maximum amount of time (in seconds) that the framework should wait for a response before aborting. headers={}.1.python.html#float)) – The maximum age (in seconds) that cached data should still be considered valid.Plex Plug-in Framework Documentation.org/library/stdtypes. errors=None.python.org/library/stdtypes.org/library/functions. ensuring undue burden isn’t placed on web servers. • headers (dict (http://docs. values=None. • values (dict (http://docs. • values (dict (http://docs.python. • sleep (float (http://docs.html#dict)) – Values to pass as URL encoded content for a POST request.org/library/stdtypes. 6.org/library/functions.1.html#dict)) – Values to pass as URL encoded content for a POST request.ObjectFromURL(url. YAML. encoding=None. this value is ignored. Standard API 75 . • cacheTime (float (http://docs.html#str)) – The URL to retrieve content from.html#float)) – The maximum age (in seconds) that cached data should still be considered valid.html#str)) – The URL to retrieve content from. If cached data was used. Release 2.python.python.org/library/functions.org/library/functions.html#dict)) – Custom HTTP headers to add to the request. Parameters • url (str (http://docs. Parameters • url (str (http://docs.1 Retrieves the content for a given HTTP request and parses it as JSON-formatted content using the above method. YAML YAML.html#dict)) – Custom HTTP headers to add to the request.html#float)) – The number of seconds the current thread should pause for if a network request was made. timeout=<object object at 0x10042bc40>.org/library/stdtypes. cacheTime=None.python. • cacheTime (float (http://docs. • headers (dict (http://docs.ObjectFromString(string) Parses the given YAML-formatted string and returns the object it represents.python.python.python. sleep=0) Retrieves the content for a given HTTP request and parses it as YAML-formatted content using the above method.org/library/functions.python. • timeout (float (http://docs.org/library/functions.

python.html#dict)) – Custom HTTP headers to add to the request.org/library/stdtypes. this value is ignored.org/library/functions.org/library/functions.python. RSS.html#float)) – The number of seconds the current thread should pause for if a network request was made.html#str)) – The URL to retrieve content from. API Reference . RDF or ATOM feed using the above method. • sleep (float (http://docs. ensuring undue burden isn’t placed on web servers.feedparser. • values (dict (http://docs.python. If cached data was used.html#float)) – The maximum amount of time (in seconds) that the framework should wait for a response before aborting.FeedFromURL(url. ensuring undue burden isn’t placed on web servers.python. autoUpdate=False.org/library/functions. • sleep (float (http://docs. RSS The RSS API provides methods for parsing content from RSS.python.FeedFromString(string) Parses the given string as an RSS.python. this value is ignored. • headers (dict (http://docs. headers={}.Plex Plug-in Framework Documentation. values=None. errors=None. please consult the documentation (http://www. For more information about the objects returned by the feed parser. 76 Chapter 6.org/library/functions.html#float)) – The maximum age (in seconds) that cached data should still be considered valid. encoding=None.org/library/functions.org) library to achieve this functionality.html#float)) – The maximum amount of time (in seconds) that the framework should wait for a response before aborting.org/docs/) here. • timeout (float (http://docs.org/library/functions.org/library/stdtypes. sleep=0) Retrieves the content for a given HTTP request and parses it as an RSS. If cached data was used. Release 2. cacheTime=None.python.1. RDF and ATOM feeds. RSS.python. timeout=<object object at 0x10042bc40>.html#dict)) – Values to pass as URL encoded content for a POST request. Parameters • url (str (http://docs.feedparser. RDF or ATOM feed (automatically detected). The framework includes the excellent Universal Feed Parser (http://www.html#float)) – The number of seconds the current thread should pause for if a network request was made.1 • timeout (float (http://docs. • cacheTime (float (http://docs.

Parameters • url (str (http://docs.org/library/stdtypes.html#str)) – The URL to retrieve content from.ObjectFromURL(url.com/library/mac/#documentation/Darwin/Reference/ManPages/man5/plist.org/library/functions. Plist. data can easily be converted between property lists and regular Python objects. this value is ignored. 6. 6.python. headers={}. The top-level object of a property list is usually a dictionary. To assist with this.org/library/stdtypes.html#dict)) – Values to pass as URL encoded content for a POST request.1.Plex Plug-in Framework Documentation. sleep=0) Retrieves the content for a given HTTP request and parses it as a Plist using the above method.apple.1 Plist The Plist API greatly simplifies handling content in Apple’s XML-based property list format. If cached data was used.html#float)) – The maximum amount of time (in seconds) that the framework should wait for a response before aborting. values=None. More information about the property list format can be found here (http://developer.python.org/library/functions.python. errors=None.python.html#dict)) – Custom HTTP headers to add to the request.html). Plist.html#float)) – The number of seconds the current thread should pause for if a network request was made.StringFromObject(obj) Converts a given object to a Plist-formatted string representation. Standard API 77 .1. encoding=None. • timeout (float (http://docs.7 Data storage and caching It is often useful for developers to be able to store data for use by the plug-in later on. • cacheTime (float (http://docs.python. timeout=<object object at 0x10042bc40>. the framework provides three methods of data storage. Plist. • values (dict (http://docs. ensuring undue burden isn’t placed on web servers.1. cacheTime=None. Using these methods.5.html#float)) – The maximum age (in seconds) that cached data should still be considered valid.org/library/functions.python.ObjectFromString(string) Returns an object representing the given Plist-formatted string. enabling the developer to choose the method most suitable for their requirements.org/library/functions. Release 2. • headers (dict (http://docs. • sleep (float (http://docs.

The data storage locations are unique for each plug-in. Returns The contents of the data item stored on disk.1 Data The Data API provides methods for storing and retrieving arbitrary data.LoadObject(item) Loads a Python object previously stored as a data item.python. Note: The actual location of data files stored by these methods may vary between platforms. data) Stores binary data as a data item with the given name. Release 2.python. Returns The contents of the data item stored on disk.Load(item) Loads a previously stored binary data item.org/library/functions. • data (object (http://docs.org/library/functions. Plug-ins are generally not allowed to access the user’s file system directly. Return type str Data.html#str)) – The name of the data item to load. Data.org/library/functions.python.Plex Plug-in Framework Documentation. Data. obj) Stores a Python object as a data item with the given name.html#str)) – The binary data to store. Parameters item (str (http://docs. preventing one plug-in from modifying data stored by another.org/library/functions.python.org/library/functions.SaveObject(item. Parameters • item (str (http://docs. Parameters • item (str (http://docs.Save(item.python. API Reference . but can use these methods to load and save files in a single directory assigned by the framework.html#str)) – The name of the data item to store. Data.html#object)) – The Python object to store.html#str)) – The name of the data item to store.html#str)) – The name of the data item to load.org/library/functions.python. • data (str (http://docs. Return type object Data. Parameters item (str (http://docs.1.Exists(item) Checks for the presence of a data item with the given name 78 Chapter 6.

Dict[key] = x Stores the contents of the variable in the dictionary using the given key.org/library/functions. Dict. but the devloper can call this method to ensure recent changes are persisted.1 Parameters item (str (http://docs.g.python.html#str)) – The name of the data item to remove. key in Dict Evaluates as True if the dictionary contains the given key. but certain objects will cause errors (e. which can be used as a key-value store by the developer. their spoken language and geographical location). Many other types of object will be accepted correctly.1. Standard API 79 . x = Dict[key] Retrieves the value for the given key from the dictionary.org/library/functions. Release 2.python.Save() Causes the dictionary to be saved to disk immediately. The dictionary is automatically persisted across plug-in relaunches.Plex Plug-in Framework Documentation. Return type bool Data. Returns The existence of the item. The framework will automatically save the file periodically. 6. Parameters item (str (http://docs.1. Dict The Dict API provides access to a global singleton dictionary object.8 Location Services Locale The Locale API provides methods for determining locale information about the current user (for example. XML and HTML element objects).html#str)) – The name of the data item to check for. 6. Dict.1. The developer should convert these objects to a more basic type before attempting to store them.Remove(item) Removes a previously stored data item with the given name. and can safely be accessed from any thread. Note: Only basic Python data types are officially supported by the dictionary.Reset() Removes all data from the dictionary.

Locale. and formats it using the given arguments.LocalStringWithFormat(key. See String files for more information on proividing localized versions of strings. Release 2.1. US.org/wiki/List_of_ISO_639-1_codes). API Reference 80 . obtained via IP-based geolocation.DefaultLocale Returns the default locale currently in use by the plug-in.Match(name) Attempt to match a given string to a language. Returns the unknown code (xx) if no match could be found.g.CurrentLocale Returns the locale of the user currently making a request to the plug-in. *args) Retrieves the localized version of a string with the given key. Locale. Strings from the user’s current locale are given highest priority. followed by strings from the default locale. e. or None if no locale was provided. Locale. The following languages are currently defined: Language Unknown Afar Abkhazian Afrikaans Akan Albanian Amharic Arabic Aragonese Armenian Assamese Avaric Avestan Aymara Azerbaijani Bashkir Bambara Code xx aa ab af ak sq am ar an hy as av ae ay az ba bm Continued on next page Chapter 6.Geolocation Returns the user’s country.1 Locale. e. classmethod Language.g. Locale.Language Locale.wikipedia. en-us. Locale.Language provides constants representing every language known by the framework.Plex Plug-in Framework Documentation.LocalString(key) Retrieves the localized version of a string with the given key. These constants represent two-character ISO 639-1 language codes (http://en.

Standard API 81 . Release 2.1 Table 6.1 – continued from previous page Basque eu Belarusian be Bengali bn Bihari bh Bislama bi Bosnian bs Breton br Bulgarian bg Burmese my Catalan ca Chamorro ch Chechen ce Chinese zh ChurchSlavic cu Chuvash cv Cornish kw Corsican co Cree cr Czech cs Danish da Divehi dv Dutch nl Dzongkha dz English en Esperanto eo Estonian et Ewe ee Faroese fo Fijian fj Finnish fi French fr Frisian fy Fulah ff Georgian ka German de Gaelic gd Irish ga Galician gl Manx gv Greek el Guarani gn Gujarati gu Haitian ht Hausa ha Hebrew he Herero hz Continued on next page 6.Plex Plug-in Framework Documentation.1.1.

1 Table 6. Release 2.1 – continued from previous page Hindi hi HiriMotu ho Croatian hr Hungarian hu Igbo ig Icelandic is Ido io SichuanYi ii Inuktitut iu Interlingue ie Interlingua ia Indonesian id Inupiaq ik Italian it Javanese jv Japanese ja Kalaallisut kl Kannada kn Kashmiri ks Kanuri kr Kazakh kk Khmer km Kikuyu ki Kinyarwanda rw Kirghiz ky Komi kv Kongo kg Korean ko Kuanyama kj Kurdish ku Lao lo Latin la Latvian lv Limburgan li Lingala ln Lithuanian lt Luxembourgish lb LubaKatanga lu Ganda lg Macedonian mk Marshallese mh Malayalam ml Maori mi Marathi mr Malay ms Malagasy mg Continued on next page 82 Chapter 6.1.Plex Plug-in Framework Documentation. API Reference .

1 – continued from previous page Maltese mt Moldavian mo Mongolian mn Nauru na Navajo nv SouthNdebele nr NorthNdebele nd Ndonga ng Nepali ne NorwegianNynorsk nn NorwegianBokmal nb Norwegian no Chichewa ny Occitan oc Ojibwa oj Oriya or Oromo om Ossetian os Panjabi pa Persian fa Pali pi Polish pl Portuguese pt Pushto ps Quechua qu RaetoRomance rm Romanian ro Rundi rn Russian ru Sango sg Sanskrit sa Serbian sr Sinhalese si Slovak sk Slovenian sl Sami se Samoan sm Shona sn Sindhi sd Somali so Sotho st Spanish es Sardinian sc Swati ss Sundanese su Swahili sw Continued on next page 6. Release 2.Plex Plug-in Framework Documentation.1. Standard API 83 .1 Table 6.1.

Prefs The Prefs API provides a simple method for retrieving a given preference.1.9 Reading user preferences The framework provides a basic system for defining and retrieving user preferences.1. API Reference . Allowing the user to modify and save preferences is handled automatically by the clients and the framework .the developer only needs to read them at the required points in their code. x = Prefs[id] Retrieves the value of the user preference with the given id. Release 2. 84 Chapter 6.1 – continued from previous page Swedish sv Tahitian ty Tamil ta Tatar tt Telugu te Tajik tg Tagalog tl Thai th Tibetan bo Tigrinya ti Tonga to Tswana tn Tsonga ts Turkmen tk Turkish tr Twi tw Uighur ug Ukrainian uk Urdu ur Uzbek uz Venda ve Vietnamese vi Volapuk vo Welsh cy Walloon wa Wolof wo Xhosa xh Yiddish yi Yoruba yo Zhuang za Zulu zu Brazilian pb NoLanguage xn 6.1 Table 6.Plex Plug-in Framework Documentation.

"pref1". "Enum preference". Standard API 85 . { "id": "label": "type": "default": }. "pref3". "pref2". "value3"]. "text". { "id": "label": "type": "option": "default": "secure": }. { "id": "label": "type": "values": "default": }. etc. "true". All methods return a lowercase string containing a hexadecimal representation of the data’s hash. "text".1.Plex Plug-in Framework Documentation. The following code demonstrates the available preference types: [ { "id": "label": "type": "default": }. "bool". "Text preference". ["value1". The files should contain a JSON-formatted array. Release 2. ] "pref4". Hash. composed of a dictionary for each preference.1.SHA1(data) 6. "Boolean preference". "hidden". "Default Value". "enum". "". "value2". "Hidden text preference (passwords. "value3".MD5(data) Hash.1.1 Preference files Preference files are used to define a set of preferences available for a plug-in. "true". # Indicates that the value should not be tr 6.10 Utilities Hash The Hash API provides methods for calculating common hashes of binary data.

1. String.SHA224(data) Hash. second) Computes the Levenshtein distance (http://en.Encode(s) Encodes the given string using the framework’s standard encoding (a slight variant on Base64 which ensures that the string can be safely used as part of a URL).SHA384(data) Hash. If usePlus is True. This string is guaranteed to be unique.CRC32(data) String The String API provides several methods for performing common utility functions on strings. Letters. digits.UUID() Generates a universally unique identifier (UUID) string. String. Release 2.-’ are never quoted. If usePlus is True.Pluralize(s) Attempts to return a pluralized version of the given string (e. String.LevenshteinDistance(first. usePlus=False) Replace %xx escapes by their single-character equivalent. String.Decode(s) Decodes a string previously encoded using the above function.Plex Plug-in Framework Documentation. second) Returns the longest substring contained within both strings.StripTags(s) Removes HTML tags from a given string.Quote(s. String.g.Unquote(s. String. spaces are escaped as a plus character instead of %20.SHA512(data) Hash.StripDiacritics(s) Removes diacritics from a given string. String. String. and the characters ’_. 86 Chapter 6.org/wiki/Levenshtein_distance) between two given strings.1 Hash.SHA256(data) Hash. String.LongestCommonSubstring(first. plus characters are replaced with spaces. API Reference . usePlus=False) Replaces special characters in s using the %xx escape. converts boot to boots). String.wikipedia.

python.html#datetime-objects) Datetime.RandomItemFromList(l) Returns a random item selected from the given list.1.org/library/datetime.org/library/datetime. Valid argument names are days. Util. 6. b) Returns a random integer N such that a <= N <= b.RandomInt(a.python. Return type datetime (http://docs.Delta(**kwargs) Creates a timedelta object representing the duration given as keyword arguments.TimestampFromDatetime(dt) Converts the given datetime object to a UNIX timestamp.Random() Returns a random number between 0 and 1. Util. milliseconds.org/library/datetime.python.html#datetime-objects) Util The Util API provides other useful utility functions. Return type datetime (http://docs.org/library/datetime.python. Datetime. Release 2. Return type timedelta (http://docs.Plex Plug-in Framework Documentation. minutes.1. Standard API 87 . seconds. Return type int Datetime.1 Datetime The Datetime API provides a number of methods for manipulating Python datetime objects and converting them to and from other formats like timestamps or string representations. Return type datetime (http://docs.ParseDate(date) Attempts to convert the given string into a datetime object.html#datetime-objects) Datetime. microseconds. hours and weeks.Now() Returns the current date and time.FromTimestamp(ts) Converts the given UNIX timestamp to a datetime object. Return type float Util.html#timedeltaobjects) Datetime. This object can then be added to or subtracted from an existing datetime object.

*args.MacOSX ClientPlatform.Exception(fmt. 6.Plex Plug-in Framework Documentation. which is formatted using any additional arguments and keyword arguments provided. but appends the current stack trace to the log message. Release 2.1.Shoutcast Protocol. **kwargs) Log.Warn(fmt. *args. The different methods represent the different log levels available.11 Debugging Log The Log API allows the developer to add their own messages to the plug-in’s log file.HTTPVideo 88 Chapter 6. The first argument to each method should be a format string.Windows ClientPlatform. **kwargs) Log. **kwargs) The same as the Critical method above.Info(fmt. Note: This method should only be called when handling an exception.WebKit Protocol.iOS ClientPlatform. *args. **kwargs) Log. **kwargs) Log.12 Constants Client Platforms ClientPlatform. *args. in increasing levels of severity.Roku Protocols Protocol.HTTPMP4Video Protocol.Error(fmt.Critical(fmt.Debug(fmt.1 6. **kwargs) Log.1.Android ClientPlatform.1.LGTV ClientPlatform. API Reference . *args. *args.Linux ClientPlatform. Log.

Release 2.AAC AudioCodec.Genres ContainerContent.Playlists 6.Secondary ContainerContent.HTTPMP4Streaming View Types ViewType.Plex Plug-in Framework Documentation.AVI Object Container Content Types ContainerContent.1.HTTPLiveStreaming Protocol.NoSummary SummaryType.List Summary Text Types SummaryType.MP4 Container.Short SummaryType.MOV Container.Long Audio Codecs AudioCodec.1.RTMP Protocol. Standard API 89 .Grid ViewType.H264 Container File Types Container.1 Protocol.MP3 Video Codecs VideoCodec.MKV Container.Mixed ContainerContent.

Seasons ContainerContent. Release 2.GenericVideos ContainerContent.Albums ContainerContent.Episodes ContainerContent.Tracks ContainerContent.Artists 90 Chapter 6.1 ContainerContent.Plex Plug-in Framework Documentation.Shows ContainerContent. API Reference .1.Movies ContainerContent.

<state name="playing"> <event> <condition> <command name="pause"/> </condition> <action> <goto state="paused"/> </action> </event> </state> Here is a list of action tags: • <click> (page 93) • <goto> (page 96) • <lockPlugin> (page 96) • <move> (page 96) • <pause> (page 98) • <run> (page 99) • <type> (page 101) • <visit> (page 102) 91 .1 <action> <!ELEMENT action (click|goto|lockPlugin|move|pause|run|type|visit)*> The <action> elemement is used inside a state and event element and tells the player “what do to” when it’s corresponding condition is true. eg.1.1 Tags (Alphabetical) 7.CHAPTER SEVEN SITE CONFIGURATION REFERENCE 7.

the following code would replace ${mystepsize} with the value of the preference named mystepsize: <bigStep plus="myPlayerObj. Release 2. For example.2 <and> <!ELEMENT and (and|color|command|condition|frameLoaded|javascript|not|or|pref|ti This element is used inside of <condition> (page 93) tags to build out boolean logic.skipBackward(10) Both the minus and plus attributes may also contain a preference based replacement variable.1. the <and> tag may have more than one of any operator/conditional.skipForward(${mystepsize}). Unlike the <condition> and <not> tags.3 <bigStep> <!ELEMENT bigStep EMPTY> <!ATTLIST bigStep minus CDATA #REQUIRED> <!ATTLIST bigStep plus CDATA #REQUIRED> This is only used in Javascript (page 18) seekbars. Site Configuration Reference . ex. It defines two javascript expressions to be executed." minus="myPlayerObj.skipB 92 Chapter 7. One when big stepping forward and one backwards. <bigStep plus="myPlayerObj.1 7. <condition name="foo"> <and> <or> <color x="1" y="1" rgb="ffffff"/> <color x="2" y="2" rgb="ffffff"/> </or> <not> <color x="3" y="3" rgb="ffffff"/> </not> <color x="4" y="4" rgb="ffffff"/> </and> </condition> 7.skipForward(10)." minus="myPlayerObj.Plex Plug-in Framework Documentation.1. See also: • Event Conditions (page 20) • <condition> (page 93) ex.1.

or. See: Event Conditions (page 20) The <condition> tag may only have one (or none) of either an operator (and. javascript. then the operation is equality. eg: rgb="FFFFFF" rgb="#FFFFFF" rgb="#FFF" rgb="FFF" ok no no no If the op attribute is omitted. Otherwise the rgb value is used as reference for brighter-than or dimmer-than 7. Release 2. The rgb attribute is in the hex RGB value.1 7. url) 7. Negative (relative) coordinates are allowed. When directly under the <site> (page 100) tag it is acting as a named conditional block. title. See: Named Condition Definitions (page 21) When under the <event> (page 95) tag it is acting as an inline definition. command. It should not include the ‘#’ symbol nor should it be abbreviated as it can be in CSS. frameLoaded. Tags (Alphabetical) 93 .1. condition.1. pref.6 <click> <!ELEMENT <!ATTLIST <!ATTLIST <!ATTLIST click click click click EMPTY> x CDATA #REQUIRED> y CDATA #REQUIRED> skipMouseUp (true|false) "false"> 7.Plex Plug-in Framework Documentation. not) or a condition tag (color.5 <color> <!ELEMENT <!ATTLIST <!ATTLIST <!ATTLIST <!ATTLIST color color color color color EMPTY> x CDATA "0"> y CDATA "0"> rgb CDATA #IMPLIED> op (dimmer-than|brighter-than) #IMPLIED> This condition allows you to test pixel colors underneath a specific x and y coordinate.1.1.4 <condition> <!ELEMENT condition (and|color|command|condition|frameLoaded|javascript|not|or|p <!ATTLIST condition name CDATA #IMPLIED> The condition tag can be a child of either the <site> (page 100) tag or the <event> (page 95) tag.1. X/Y coordinates are relative to the size of the player and not the entire web page.

Negative (relative) coordinates are allowed. X/Y coordinates are relative to the size of the player and not the entire web page.8 <crop> <!ELEMENT <!ATTLIST <!ATTLIST <!ATTLIST <!ATTLIST crop crop crop crop crop EMPTY> x CDATA #REQUIRED> y CDATA #REQUIRED> width CDATA #REQUIRED> height CDATA #REQUIRED> This tag is used to crop the video player. Valid values for the name attribute are: • pause • play • bigstep+ • bigstep• smallstep+ • smallstep• chapter+ • chapter- 7. 7. then set the skipMouseUp attribute to true. If you do not want a mouse up event to be fired. mouse or remote control.1.1.7 <command> <!ELEMENT command EMPTY> <!ATTLIST command name CDATA #REQUIRED> <!-. Usually it’s used to chop out blank space and or some player control so that the screen it zoomed in to focus soley on the video content. then they are considered “auto” and will not crop the right or bottom.1. Release 2. Site Configuration Reference . If width and height are set to 0.pause|play|bigstep+|smallstep+|bigs This condition can be used to test for Plex video player events.Plex Plug-in Framework Documentation. 94 Chapter 7. To crop from the right or bottom just reduce the width and height attributes. If the player has extra data that you would like to crop out you can note the pixel width and height that you wish to crop from the top (y) and left (x). These occur in response to the keyboard.1 This condition allows you to click at a specific x and y coordinate.

This is the x/y coordinate where you would like the mouse to rest after clicking on a position in the seekbar. For Javascript (page 18) seekbars.Plex Plug-in Framework Documentation. Sometimes a players controls need to fade back out and you need to put the mouse in a “safe” place. For example.11 <event> <!ELEMENT event (condition. the following code would replace ${username} with the value of the preference named username: <end condition="’${username}’ == ’david’"> See: Seekbars (page 16) 7.12 <frameLoaded> <!ELEMENT frameLoaded EMPTY> A condition which evaluates as true when the webpage has been loaded. See: States and Events (page 18) 7.action)> A container who’s parent is the <state> (page 100) and that contains a <condition> (page 93) and a <action> (page 91) tag. the condition attribute may also contain a preference based replacement variable.10 <end> <!ELEMENT <!ATTLIST <!ATTLIST <!ATTLIST end end end end EMPTY> x CDATA "0"> y CDATA "0"> condition CDATA #IMPLIED> For Simple (page 17) and Thumb (page 17) seekbars you should specify the x/y coordinates of the end of the playback timeline indicator. Release 2.1.1. you should specify the condition attribute with a javascript expression evaluating to true if the player is at the “end” In the case of Javascript (page 18) seekbars.1.1.1 7. Tags (Alphabetical) 95 .9 <dead> <!ELEMENT dead EMPTY> <!ATTLIST dead x CDATA "0"> <!ATTLIST dead y CDATA "0"> Used in seekbars.1. 7.1. 7.

Site Configuration Reference .1.true condition --> <javascript script="myVariable == 10 ? 1 : 0" matches="1"/> <!-.1 7.3 <javascript> (page 96) script attribute can accept javascript replacement <!ELEMENT javascript EMPTY> <!ATTLIST javascript script CDATA #REQUIRED> <!ATTLIST javascript matches CDATA #REQUIRED> This condition takes a javascript expression in the script attribute and an value to compare the expression to in the matches attribute.Plex Plug-in Framework Documentation.16 <move> <!ELEMENT move EMPTY> <!ATTLIST move x CDATA #REQUIRED> <!ATTLIST move y CDATA #REQUIRED> 96 Chapter 7.1.13 <goto> <!ELEMENT goto EMPTY> <!ATTLIST goto state CDATA #REQUIRED> <!ATTLIST goto param CDATA #IMPLIED> An action which will transition to the state specified in the state attribute If the state attribute is “end” it is handled specially and will exit the video and return to the previous navigation menu in Plex. Useful for error messages when exiting.14 <javascript> Changed in version Plex: 0.false condition 7. logging in. changing the size of the player with javascript. You should only use the combination of manualLock / lockPlugin if you have to perform actions/conditions prior to getting to the video itself.1. Addiionally.true condition <javascript script="myVariable == 99 ? 1 : 0" matches="1"/> <!-. 7.1. For example. Examples assuming myVariable is 10 : <javascript script="myVariable" matches="10"/> <!-. 7. then this message will be displayed in a message box to the user. if you provide some text to the param attribute when transitioning to the “end” state. or setting a cookie and redirecting to another url etc.8.15 <lockPlugin> <!ELEMENT lockPlugin EMPTY> This is only relevant if you have also set the manualLock attribue to true in the <site> (page 100) tag. Release 2.1.

frameLoaded. not) or a condition tag (color. pref. command. Tags (Alphabetical) 97 . See also: • Event Conditions (page 20) • <condition> (page 93) ex. or. Release 2. 7. Negative (relative) coordinates are allowed.1. Unlike the <condition> and <not> tags. condition. <condition name="foo"> <and> <or> <color x="1" y="1" rgb="ffffff"/> <color x="2" y="2" rgb="ffffff"/> </or> <not> <color x="3" y="3" rgb="ffffff"/> </not> <color x="4" y="4" rgb="ffffff"/> </and> </condition> 7.1. javascript. title.1.18 <or> <!ELEMENT or (and|color|command|condition|frameLoaded|javascript|not|or|pref|tit This element is used inside of <condition> (page 93) tags to build out boolean logic.17 <not> <!ELEMENT not (and|color|command|condition|frameLoaded|javascript|not|or|pref|ti This element is used inside of <condition> (page 93) tags to build out boolean logic. url) See also: • Event Conditions (page 20) • <condition> (page 93) ex.1 This condition allows you to move the mouse to a specific x and y coordinate. the <or> tag may have more than one of any operator/conditional. 7.Plex Plug-in Framework Documentation. X/Y coordinates are relative to the size of the player and not the entire web page. The <not> tag must have one and only one of either an operator (and.1.

Release 2.1. ex. It defines a single javascript expression which should evaluate to floating point number between 0.0 and 100.number of milliseconds to wait --> An action which will wait for the specified number of milliseconds.Plex Plug-in Framework Documentation.0"/> 7. ${vidlength} would be replaced by the value of the preference named vidlength <percentComplete equals="(myPlayerObj.1 <condition name="foo"> <and> <or> <color x="1" y="1" rgb="ffffff"/> <color x="2" y="2" rgb="ffffff"/> </or> <not> <color x="3" y="3" rgb="ffffff"/> </not> <color x="4" y="4" rgb="ffffff"/> </and> </condition> 7.0. Site Configuration Reference .20 <percentComplete> <!ELEMENT percentComplete EMPTY> <!ATTLIST percentComplete equals CDATA #REQUIRED> This is only used in Javascript (page 18) seekbars. <percentComplete equals="(myPlayerObj.position() / myPlayerObj.vidLength()) * 10 The equals attribute may also be a preference based replacement variable.21 <played> <!ELEMENT played (color|condition)*> The color(s) representing the played portion of the Seekbar (for simple seekbars) or the color(s) that should match the Seekbar thumb (for thumb seekbars) Only used in Simple (page 17) and Thumb (page 17) seekbars 98 Chapter 7.19 <pause> <!ELEMENT pause EMPTY> <!ATTLIST pause time CDATA "0"> <!-. For example.1.position() / ${vidlength}) * 100. ex.wait one second --> 7.1. <pause time="1000"/> <!-.1.

7.3 <setCookie> (page 99) value attribute can accept javascript replacement 7. <run script="myVariable=10."/> The script attribute may also contain a preference based replacement variable.22 <pre> <!ELEMENT pre EMPTY> <!ATTLIST pre m CDATA #REQUIRED> TODO: what exactly is this and how should it be used? Prerequisites too like does it require manualLock=True etc."/> 7. ex. See Seekbars (page 16) for more information.1.1 7. For example: <run script="myUsername=’${username}’.Plex Plug-in Framework Documentation.1. Release 2. 7. <pref name="username" exists="true"/> 7.1. Tags (Alphabetical) 99 .8.23 <pref> <!ELEMENT pref EMPTY> <!ATTLIST pref name CDATA #REQUIRED> <!ATTLIST pref exists (true|false) "false"> A condition to test for the presence or absense of a preference.1.1. ex.1.24 <run> <!ELEMENT run EMPTY> <!ATTLIST run script CDATA #REQUIRED> An action to run the specified javascript.26 <setCookie> Changed in version Plex: 0.1.25 <seekbar> <!ELEMENT seekbar (start?|end?|played?|dead?|bigStep?|smallStep?|percentComplete <!ATTLIST seekbar type (javascript|simple|thumb) #REQUIRED> The container for seekbars.

ex.1...1.27 <site> <!ELEMENT <!ATTLIST <!ATTLIST <!ATTLIST <!ATTLIST <!ATTLIST <!ATTLIST <!ATTLIST <!ATTLIST <!ATTLIST <!ATTLIST <!ATTLIST site site site site site site site site site site site site (condition|crop|pre|seekbar|setCookie|state)*> agent CDATA #IMPLIED> allowPopups (true|false) "false"> identifier CDATA #IMPLIED> initialState CDATA #REQUIRED> manualLock (true|false) "false"> plugin CDATA #IMPLIED> randomAgent (true|false) "false"> site CDATA #REQUIRED> version CDATA "1..1. --> </site> 7. Release 2.videosite. <site> <setCookie domain=".1. Only used in Simple (page 17) and Thumb (page 17) seekbars See: Seekbars (page 16) 7.Plex Plug-in Framework Documentation.29 <state> <!ELEMENT state (event)*> <!ATTLIST state name CDATA #REQUIRED> 100 Chapter 7.com" path="/" name="tosAccepted" value="true" se <!-. Site Configuration Reference .28 <start> <!ELEMENT start EMPTY> <!ATTLIST start x CDATA "0"> <!ATTLIST start y CDATA "0"> The x/y coordinates of the end of the playback timeline indicator.0"> windowHeight CDATA #IMPLIED> windowWidth CDATA #IMPLIED> 7.1 <!ELEMENT <!ATTLIST <!ATTLIST <!ATTLIST <!ATTLIST <!ATTLIST setCookie setCookie setCookie setCookie setCookie setCookie EMPTY> domain CDATA #IMPLIED> path CDATA #IMPLIED> name CDATA #IMPLIED> secure CDATA #IMPLIED> value CDATA #IMPLIED> Allows you to set a cookie.

in an action a <goto> (page 96) tag is used with a name to transition to another state with the corresponding state attribute set. the following code block would type out the characters that are contained in the value for the username preference : 7. 7." minus="myPlayerObj. Tags (Alphabetical) 101 . See States and Events (page 18) for more information 7.32 <type> <!ELEMENT type EMPTY> <!ATTLIST type text CDATA #IMPLIED> <!ATTLIST type key CDATA #IMPLIED> An action to either type a string or a single key code.1 A state contains one or more <event> (page 95) tags each of which contain a <condition> (page 93) and an <action> (page 91). For example.1. The text attribute may also be a preference based replacement variable.skipBackward(5) Both the minus and plus attributes may also contain a preference based replacement variable.1. One when big stepping forward and one backwards. You may use text or key but not both together.skipForward(5). <smallStep plus="myPlayerObj. It defines two javascript expressions to be executed.1. Typically.Plex Plug-in Framework Documentation.31 <title> <!ELEMENT title EMPTY> <!ATTLIST title matches CDATA #REQUIRED> A condition which evaluates to true when the title of the webpage matches the regular expression in matches.skipForward(${mystepsize}). the following code would replace ${mystepsize} with the value of the preference named mystepsize: <smallStep plus="myPlayerObj. For example. Release 2." minus="myPlayerObj.1.1. ex.ski 7.30 <smallStep> <!ELEMENT smallStep EMPTY> <!ATTLIST smallStep minus CDATA #REQUIRED> <!ATTLIST smallStep plus CDATA #REQUIRED> This is only used in Javascript (page 18) seekbars.

2 XML DTD Download the DTD <!-. Release 2. Site Configuration Reference .CORE STRUCTURE --> <!ELEMENT action (click|goto|lockPlugin|move|pause|run|type|visit)*> <!ELEMENT condition (and|color|command|condition|frameLoaded|javascript|not|or|p <!ATTLIST condition name CDATA #IMPLIED> <!ELEMENT event (condition.0"> windowHeight CDATA #IMPLIED> windowWidth CDATA #IMPLIED> agent CDATA #IMPLIED> <!-.action)> <!ELEMENT state (event)*> <!ATTLIST state name CDATA #REQUIRED> 102 Chapter 7.1.33 <url> <!ELEMENT url EMPTY> <!ATTLIST url matches CDATA #REQUIRED> A condition which evaluates to true when the url of the webpage matches the regular expression in matches.34 <visit> <!ELEMENT visit EMPTY> <!ATTLIST visit url CDATA #REQUIRED> An action which causes the url specified in url to be visited.ROOT <!ELEMENT <!ATTLIST <!ATTLIST <!ATTLIST <!ATTLIST <!ATTLIST <!ATTLIST <!ATTLIST <!ATTLIST <!ATTLIST <!ATTLIST <!ATTLIST --> site site site site site site site site site site site site (condition|crop|pre|seekbar|setCookie|state)*> allowPopups (true|false) "false"> identifier CDATA #IMPLIED> initialState CDATA #REQUIRED> manualLock (true|false) "false"> plugin CDATA #IMPLIED> randomAgent (true|false) "false"> site CDATA #REQUIRED> version CDATA "1.Plex Plug-in Framework Documentation.1. 7. 7.1 <type text="${username}"/> 7.1.

Release 2.1.1 <!-.CONDITIONS --> <!ELEMENT and (and|color|command|condition|frameLoaded|javascript|not|or|pref|ti <!ELEMENT or (and|color|command|condition|frameLoaded|javascript|not|or|pref|tit <!ELEMENT not (and|color|command|condition|frameLoaded|javascript|not|or|pref|ti <!ELEMENT <!ATTLIST <!ATTLIST <!ATTLIST <!ATTLIST color color color color color EMPTY> x CDATA "0"> y CDATA "0"> rgb CDATA #IMPLIED> op (dimmer-than|brighter-than) #IMPLIED> 7.crop <!ELEMENT <!ATTLIST <!ATTLIST <!ATTLIST <!ATTLIST the player (flash or silverlight) to obtain the "playable area" --> crop EMPTY> crop x CDATA #REQUIRED> crop y CDATA #REQUIRED> crop width CDATA #REQUIRED> crop height CDATA #REQUIRED> <!-.2.SEEKBAR / PLAYER SIZE --> <!ELEMENT seekbar (start?|end?|played?|dead?|bigStep?|smallStep?|percentComplete <!ATTLIST seekbar type (javascript|simple|thumb) #REQUIRED> <!ELEMENT start EMPTY> <!ATTLIST start x CDATA "0"> <!ATTLIST start y CDATA "0"> <!ELEMENT <!ATTLIST <!ATTLIST <!ATTLIST end end end end EMPTY> x CDATA "0"> y CDATA "0"> condition CDATA #IMPLIED> <!ELEMENT played (color|condition)*> <!ELEMENT dead EMPTY> <!ATTLIST dead x CDATA "0"> <!ATTLIST dead y CDATA "0"> <!-.Plex Plug-in Framework Documentation. XML DTD 103 .javascript seekbar stuff --> <!ELEMENT bigStep EMPTY> <!ATTLIST bigStep minus CDATA #REQUIRED> <!ATTLIST bigStep plus CDATA #REQUIRED> <!ELEMENT smallStep EMPTY> <!ATTLIST smallStep minus CDATA #REQUIRED> <!ATTLIST smallStep plus CDATA #REQUIRED> <!ELEMENT percentComplete EMPTY> <!ATTLIST percentComplete equals CDATA #REQUIRED> <!-.

1 <!ELEMENT command EMPTY> <!ATTLIST command name CDATA #REQUIRED> <!-. Release 2. Site Configuration Reference .1.pause|play|bigstep+|smallstep+|bigs <!ELEMENT frameLoaded EMPTY> <!ELEMENT javascript EMPTY> <!ATTLIST javascript script CDATA #REQUIRED> <!ATTLIST javascript matches CDATA #REQUIRED> <!ELEMENT pref EMPTY> <!ATTLIST pref name CDATA #REQUIRED> <!ATTLIST pref exists (true|false) "false"> <!ELEMENT title EMPTY> <!ATTLIST title matches CDATA #REQUIRED> <!ELEMENT url EMPTY> <!ATTLIST url matches CDATA #REQUIRED> <!-.Plex Plug-in Framework Documentation.ACTIONS --> <!ELEMENT <!ATTLIST <!ATTLIST <!ATTLIST click click click click EMPTY> x CDATA #REQUIRED> y CDATA #REQUIRED> skipMouseUp (true|false) "false"> <!ELEMENT goto EMPTY> <!ATTLIST goto state CDATA #REQUIRED> <!ATTLIST goto param CDATA #IMPLIED> <!ELEMENT lockPlugin EMPTY> <!ELEMENT move EMPTY> <!ATTLIST move x CDATA #REQUIRED> <!ATTLIST move y CDATA #REQUIRED> <!ELEMENT pause EMPTY> <!ATTLIST pause time CDATA "0"> <!ELEMENT run EMPTY> <!ATTLIST run script CDATA #REQUIRED> <!ELEMENT type EMPTY> <!ATTLIST type text CDATA #IMPLIED> <!ATTLIST type key CDATA #IMPLIED> <!ELEMENT visit EMPTY> <!ATTLIST visit url CDATA #REQUIRED> 104 Chapter 7.

1 <!-.Plex Plug-in Framework Documentation.com 7. Keyboard Keycode Lookup 105 . Release 2.3 Keyboard Keycode Lookup You can find the key code for use with the <type key="??"/> tag.3.MISC --> <!ELEMENT pre EMPTY> <!ATTLIST pre m CDATA #REQUIRED> <!ELEMENT <!ATTLIST <!ATTLIST <!ATTLIST <!ATTLIST <!ATTLIST setCookie setCookie setCookie setCookie setCookie setCookie EMPTY> domain CDATA #IMPLIED> path CDATA #IMPLIED> name CDATA #IMPLIED> secure CDATA #IMPLIED> value CDATA #IMPLIED> 7. Use the Dec column from http://asciitable.1.

1. Release 2.1 106 Chapter 7.Plex Plug-in Framework Documentation. Site Configuration Reference .

CHAPTER EIGHT INDICES AND TABLES • genindex • modindex • search 107 .

1. Release 2.Plex Plug-in Framework Documentation.1 108 Chapter 8. Indices and tables .

88 Container. 51 ClientPlatform. 87 h Hash. 79 Client. 86 SummaryType. 71 XMLRPC. 89 t Thread. 89 Resource. 79 Log. 89 ViewType. 85 HTML. 66 Response. 66 d Data. 89 c Cache. 89 x XML. 69 v VideoCodec. 88 y YAML. 49 Prefs. 79 u Util. 50 109 . 71 j JSON. 68 p Platform. 88 r Request.PYTHON MODULE INDEX a AudioCodec. 49 RSS. 50 Plist. 77 Plugin. 78 Datetime. 84 Protocol. 50 Route. 73 HTTP. 89 ContainerContent. 87 Dict. 76 s String. 74 l Locale. 75 n Network.

Plex Plug-in Framework Documentation.1 110 Python Module Index . Release 2.1.

INDEX

A

Artist (built-in class), 43 artist (Media attribute), 37 absolute_index (Episode attribute), 41 absolute_index (EpisodeObject attribute), 56 artist (TrackObject attribute), 61 ArtistObject (built-in class), 59 accepts_from, 35 AcquireLock() (Framework.docutils.Thread aspect_ratio (MediaObject attribute), 64 audio_channels (MediaObject attribute), 64 method), 67 audio_codec (MediaObject attribute), 64 add() (EpisodeObject method), 57 AudioCodec (module), 89 add() (MediaObject method), 65 AudioCodec.AAC (in module AudioCodec), add() (MovieObject method), 55 89 add() (ObjectContainer method), 53 AudioCodec.MP3 (in module AudioCodec), add() (TrackObject method), 62 89 AddMimeType() (Framework.docutils.Resource method), B 66 Address (Framework.docutils.Network banners (Season attribute), 42 banners (TV_Show attribute), 43 attribute), 68 AddViewGroup() (Framework.docutils.Plugin bitrate (MediaObject attribute), 64 Block() (Framework.docutils.Thread method), method), 49 67 Album (built-in class), 43 album (Media attribute), 37 C album (TrackObject attribute), 61 Cache (module), 79 AlbumObject (built-in class), 59 CacheTime (Framework.docutils.HTTP atart (AlbumObject attribute), 60 tribute), 70 art (Artist attribute), 43 Callback() (built-in function), 48 art (ArtistObject attribute), 59 CFBundleIdentifier, 7 art (DirectoryObject attribute), 62 ClearCache() (Framework.docutils.HTTP art (EpisodeObject attribute), 57 method), 70 art (InputDirectoryObject attribute), 63 ClearCookies() (Framework.docutils.HTTP art (Movie attribute), 41 method), 70 art (MovieObject attribute), 55 Client (module), 51 art (ObjectContainer attribute), 53 ClientPlatform (module), 88 art (PopupDirectoryObject attribute), 63 ClientPlatform.Android (in module Clientart (PrefsObject attribute), 64 Platform), 88 art (SeasonObject attribute), 58 ClientPlatform.iOS (in module ClientPlatart (TrackObject attribute), 61 form), 88 art (TV_Show attribute), 43 ClientPlatform.LGTV (in module ClientPlatart (TVShowObject attribute), 59 form), 88 artist (AlbumObject attribute), 60 111

Plex Plug-in Framework Documentation, Release 2.1.1

ClientPlatform.Linux (in module ClientPlatform), 88 ClientPlatform.MacOSX (in module ClientPlatform), 88 ClientPlatform.Roku (in module ClientPlatform), 88 ClientPlatform.Windows (in module ClientPlatform), 88 collections (Album attribute), 44 collections (Artist attribute), 43 collections (Movie attribute), 40 collections (TV_Show attribute), 42 Connect() (Framework.docutils.Route method), 49 container (MediaObject attribute), 64 Container (module), 89 Container.AVI (in module Container), 89 Container.MKV (in module Container), 89 Container.MOV (in module Container), 89 Container.MP4 (in module Container), 89 ContainerContent (module), 89 ContainerContent.Albums (in module ContainerContent), 89 ContainerContent.Artists (in module ContainerContent), 90 ContainerContent.Episodes (in module ContainerContent), 90 ContainerContent.GenericVideos (in module ContainerContent), 90 ContainerContent.Genres (in module ContainerContent), 89 ContainerContent.Mixed (in module ContainerContent), 89 ContainerContent.Movies (in module ContainerContent), 90 ContainerContent.Playlists (in module ContainerContent), 89 ContainerContent.Seasons (in module ContainerContent), 90 ContainerContent.Secondary (in module ContainerContent), 89 ContainerContent.Shows (in module ContainerContent), 90 ContainerContent.Tracks (in module ContainerContent), 90 content (HTTP.HTTPRequest attribute), 70 content (ObjectContainer attribute), 53 content_rating (Movie attribute), 40 112

content_rating (MovieObject attribute), 55 content_rating (TV_Show attribute), 42 content_rating (TVShowObject attribute), 59 content_rating_age (Movie attribute), 40 content_rating_age (MovieObject attribute), 55 contributes_to, 35 countries (Album attribute), 44 countries (AlbumObject attribute), 60 countries (Movie attribute), 41 countries (MovieObject attribute), 55 countries (TV_Show attribute), 42 countries (TVShowObject attribute), 59 CPU (Framework.docutils.Platform attribute), 50 CRC32() (Framework.docutils.Hash method), 86 Create() (Framework.docutils.Thread method), 66 CreateTimer() (Framework.docutils.Thread method), 67 Critical() (Framework.docutils.Log method), 88 CurrentLocale (Framework.docutils.Locale attribute), 80

D
Data (module), 78 Datetime (module), 87 Debug() (Framework.docutils.Log method), 88 Decode() (Framework.docutils.String method), 86 DefaultLocale (Framework.docutils.Locale attribute), 80 Delta() (Framework.docutils.Datetime method), 87 Dict (module), 79 directors (Episode attribute), 41 directors (EpisodeObject attribute), 56 directors (Movie attribute), 41 directors (MovieObject attribute), 55 DirectoryObject (built-in class), 62 duration (AlbumObject attribute), 60 duration (ArtistObject attribute), 59 duration (DirectoryObject attribute), 62 duration (Episode attribute), 42 duration (EpisodeObject attribute), 57 Index

Plex Plug-in Framework Documentation, Release 2.1.1

duration (Media attribute), 36 duration (MediaObject attribute), 65 duration (Movie attribute), 40 duration (MovieObject attribute), 54 duration (PartObject attribute), 65 duration (PopupDirectoryObject attribute), 63 duration (TrackObject attribute), 61 duration (TV_Show attribute), 42 duration (TVShowObject attribute), 58

file (MediaPart attribute), 38 filename (Media attribute), 36 FromTimestamp() work.docutils.Datetime 87

(Framemethod),

G
genres (Album attribute), 43 genres (AlbumObject attribute), 60 genres (Artist attribute), 43 genres (ArtistObject attribute), 59 genres (Movie attribute), 40 genres (MovieObject attribute), 54 genres (TrackObject attribute), 61 genres (TV_Show attribute), 42 genres (TVShowObject attribute), 58 Geolocation (Framework.docutils.Locale attribute), 79 GetCookiesForURL() (Framework.docutils.HTTP method), 70 GuessMimeType() (Framework.docutils.Resource method), 66 guest_stars (Episode attribute), 41 guest_stars (EpisodeObject attribute), 56

E
Element() (Framework.docutils.HTML method), 73 Element() (Framework.docutils.XML method), 71 ElementFromString() (Framework.docutils.HTML method), 73 ElementFromString() (Framework.docutils.XML method), 72 ElementFromURL() (Framework.docutils.HTML method), 73 ElementFromURL() (Framework.docutils.XML method), 72 Encode() (Framework.docutils.String method), 86 Episode (built-in class), 41 episode (Media attribute), 37 episode_count (SeasonObject attribute), 58 episode_count (TVShowObject attribute), 59 EpisodeObject (built-in class), 56 episodes (Season attribute), 42 Error() (Framework.docutils.Log method), 88 Event() (Framework.docutils.Thread method), 67 Exception() (Framework.docutils.Log method), 88 Exists() (Framework.docutils.Data method), 78 ExternalPath() (Framework.docutils.Resource method), 66

H

handler() (built-in function), 47 Hash (module), 85 HasSilverlight (Framework.docutils.Platform attribute), 50 header (ObjectContainer attribute), 53 Headers (Framework.docutils.HTTP attribute), 70 Headers (Framework.docutils.Request attribute), 50 Headers (Framework.docutils.Response attribute), 51 headers (HTTP.HTTPRequest attribute), 70 Hostname (Framework.docutils.Network attribute), 69 HTML (module), 73 F HTTP (module), 69 fallback_agent, 35 http_cookies (ObjectContainer attribute), 53 FeedFromString() (Framework.docutils.RSS HTTPRequest (class in HTTP), 70 method), 76 FeedFromURL() (Framework.docutils.RSS I method), 76 id (MetadataSearchResult attribute), 38 Index 113

Plex Plug-in Framework Documentation. 44 Network (module). 85 Media (built-in class). 80 MD5() (Framework. 66 ObjectContainer (built-in class). 78 ObjectFromString() (FrameLoadShared() (Framework. 70 (FrameLoadObject() (Framework. 37 index (SeasonObject attribute). 53 languages. 38 mixed_parents (ObjectContainer attribute).YAML method).String method). 61 indirect() (built-in function).Resource work.docutils. 80 work.docutils. 52 load() (HTTP.XML method).docutils. 66 ObjectFromString() (FrameLocale (module). 27 MediaPart (built-in class). 87 Load() (Framework. 58 index (TrackObject attribute). 63 key (MovieObject attribute).docutils. 34 name (Media attribute). 26 MetadataSearchResult (built-in class).docutils. 78 Load() (Framework.Resource O method). 77 Log (module). 36 name (MetadataSearchResult attribute). 57 key (InputDirectoryObject attribute). 53 lang (MetadataSearchResult attribute).Plist 67 method).XML method). 74 method). 53 Movie (built-in class). 61 key (TVShowObject attribute).Plugin attribute).docutils.docutils. 48 Info() (Framework. 86 114 Index . 88 (FrameLongestCommonSubstring() (Frame. 54 J JSON (module). 86 method). 53 MetadataObjectForURL() (built-in function). 58 N name.docutils.docutils.docutils. LocalStringWithFormat() (Frame75 work.Locale ObjectFromString() (Framemethod).Plugin method). 62 key (SeasonObject attribute).Language class method). 54 key (PartObject attribute). 60 key (ArtistObject attribute). 38 message (ObjectContainer attribute). 59 key (DirectoryObject attribute). 36 MediaObject (built-in class).1 Identifier (Framework.Locale method).Datetime work. ObjectFromURL() (Framework.docutils. 72 LocalString() (Framework.NormalizeURL() (built-in function). 74 K key (AlbumObject attribute). 79 work.docutils.Thread method).Data ObjectFromString() work.docutils.Hash method).docutils. 57 key (TrackObject attribute). 64 MediaObjectsForURL() (built-in function). 62 key (EpisodeObject attribute). 72 work. 49 L no_cache (ObjectContainer attribute). 74 Lock() (Framework.docutils.docutils.docutils.docutils.Plist method). 27 Now() (Framework.Data method).ObjectFromURL() work.JSON method).docutils. 38 name (Track attribute). 65 key (PopupDirectoryObject attribute). 63 M Match() (Framework. 38 no_history (ObjectContainer attribute).Log method). 77 method). 88 InputDirectoryObject (built-in class). Release 2.docutils. ObjectFromURL() (Frame80 work.HTTPRequest method).docutils. 49 index (Media attribute). 40 MovieObject (built-in class).1. 68 Nice() (Framework.JSON method). 35 LevenshteinDistance() (Frame.String method).docutils.

7 protocols (MediaObject attribute). Plugin (module). 88 PartObject (built-in class). 36 openSubtitlesHash (MediaPart attribute). 87 Protocol.String method). 60 originally_available_at (Episode attribute). 42 originally_available_at (TVShowObject attribute). 51 Protocol.Platform attribute). 68 PlexURLServices. 88 tribute).1 ObjectFromURL() (Framework. 7 Q PlexVideoCodec. 41 posters (Season attribute). Release 2. 60 producers (Episode attribute).docutils. 38 original_title (Album attribute). 35 producers (Album attribute).docutils.docutils. 86 quotes (MovieObject attribute). 51 PlexAudioCodec. 49 86 Pluralize() (Framework. 41 producers (MovieObject attribute). 7 Plist (module). 64 tribute). 7 method). 88 method). 63 primary_agent (Media attribute). 41 originally_available_at (EpisodeObject attribute).docutils. 64 PlexClientPlatforms.HTTP method). 42 posters (TV_Show attribute).docutils. 55 originally_available_at (Album attribute). 70 Prefixes (Framework. 43 PreCache() (Framework. 88 Platform (module).YAML method). 41 producers (EpisodeObject attribute). 44 original_title (AlbumObject attribute). 40 method).docutils. 50 Protocols (Framework.Shoutcast (in module Protocol).RTMP (in module Protocol). 7 Proxy() (Framework.docutils. 88 Platform (Framework.HTTPMP4Video (in module ProtoParseDate() (Framework. 7 Proxy. 77 Quote() (Framework. 65 Protocol. 7 Proxy. 7 attribute). 40 original_title (MovieObject attribute).1. 55 prompt (InputDirectoryObject attribute).docutils. 56 producers (Movie attribute).Protocol.Client atplatforms (MediaObject attribute). 45 PlexRelatedContentServices. 50 posters (Artist attribute). 58 OS (Framework.Client at.HTTPVideo (in module Protocol).XMLRPC PlexFrameworkVersion.Preview() (built-in function).WebKit (in module Protocol). 89 P Protocol. 36 primary_provider. 75 openSubtitlesHash (Media attribute).String quotes (Movie attribute). 36 primary_metadata (Media attribute). 44 producers (AlbumObject attribute).Network PlexSearchServices. 71 PlexMediaContainer.HTTPLiveStreaming (in module Protocol). 63 Protocol (module). 88 Protocol. 55 originally_available_at (TV_Show attribute). 45 PlexPluginClass. 60 original_title (Movie attribute).Media() (built-in function).docutils. 44 Index 115 . 89 Protocol.Plugin attribute). 7 PublicAddress (Framework. 55 PopupDirectoryObject (built-in class). 49 Prefs (module). 44 originally_available_at (AlbumObject attribute). 56 originally_available_at (Movie attribute). 40 originally_available_at (MovieObject attribute).Datetime col). 62 posters (Album attribute). 84 PrefsObject (built-in class).Plex Plug-in Framework Documentation. 43 posters (Movie attribute).HTTPMP4Streaming (in module Protocol).docutils.docutils.

79 Resource (module). 85 SHA256() (Framework. 66 Response (module). 57 source_title (MovieObject attribute). 32 ReleaseLock() (Framework. 85 SHA224() (Framework.Data method). 58 SSLSocket() (Framework.docutils.Hash method). 65 S Save() (Framework. 41 rating (EpisodeObject attribute).HTTP method). 61 rating (TV_Show attribute). 54 rating_key (SeasonObject attribute). 79 SaveObject() (Framework. 86 SHA512() (Framework.Hash method). 13 Status (Framework. 86 SharedExternalPath() (Framework. 30 Season (built-in class). 50 Route (module).docutils. 57 rating_key (TrackObject attribute).Data method).Hash method). 40 rating (MovieObject attribute).Util method). 78 Save() (in module Dict). 61 source_title (TVShowObject attribute).1. 69 Reset() (in module Dict). 67 Socket() (Framework. 35 Search() (built-in function). 69 source_title (AlbumObject attribute). 36 show (SeasonObject attribute).docutils.Data method). 59 source_title (EpisodeObject attribute).Plex Plug-in Framework Documentation. 87 RandomizeUserAgent() (Framework. 42 rating (TVShowObject attribute). 53 Request (module).docutils. 55 rating (TrackObject attribute).Hash method). 49 route() (built-in function).Network method). 78 score (MetadataSearchResult attribute). 69 Start() (built-in function). 48 RSS (module). 55 source_title (SeasonObject attribute). 86 StringFromElement() (FrameIndex 116 . 57 show (Media attribute). Release 2.docutils.Network method).Response attribute).docutils. 61 rating_key (TVShowObject attribute). 43 rating (ArtistObject attribute).docutils. 56 rating (Movie attribute).HTTP method).docutils.Util method).docutils. 51 String (module). 59 rating (Episode attribute).docutils. 44 rating (AlbumObject attribute).docutils. 58 RelatedContentForMetadata() (built-in function).Resource method). 67 Remove() (Framework.HTTP method). 87 RandomInt() (Framework.Thread method). 56 rating_key (MovieObject attribute). 70 rating (Album attribute).docutils.docutils.Thread method).docutils. 79 replace_parent (ObjectContainer attribute).Util method). 58 Sleep() (Framework.docutils. 13 SHA1() (Framework. 66 show (EpisodeObject attribute).docutils. 60 rating (Artist attribute). 60 source_title (ArtistObject attribute). 87 RandomItemFromList() (Framework. 58 rating_key (EpisodeObject attribute).docutils. 58 source_title (TrackObject attribute).docutils.Hash method). 37 SeasonObject (built-in class). 57 season (Media attribute).Thread method).docutils. 42 season (EpisodeObject attribute).1 R Random() (Framework. 38 search().docutils. 50 Request() (Framework. 70 SetRating() (built-in function).docutils. 68 SetPassword() (Framework. 57 Semaphore() (Framework. 76 RTMPVideoURL() (built-in function). 86 SHA384() (Framework.

62 title (Episode attribute). 61 thumb (TVShowObject attribute). 57 summary (TV_Show attribute). 59 thumbs (Episode attribute).docutils.Plex Plug-in Framework Documentation.String method).HTML method).1 work.XML method). 74 StringFromObject() (Framework.Long (in module SummaryType).XML method). 41 summary (EpisodeObject attribute). 40 summary (MovieObject attribute).Short (in module SummaryType). 55 summary (PopupDirectoryObject attribute). 60 tags (Artist attribute). 58 117 . 63 summary (PrefsObject attribute). 41 themes (TV_Show attribute). 62 title (PrefsObject attribute). 60 studio (Movie attribute).docutils. 59 summary (DirectoryObject attribute). 63 tagline (PrefsObject attribute). 56 title (InputDirectoryObject attribute). 44 title (AlbumObject attribute).1. 40 tagline (MovieObject attribute). 40 studio (MovieObject attribute). 89 SummaryType. 61 tags (TV_Show attribute). 63 Index tagline (Movie attribute). 59 summary (Album attribute). 57 thumb (InputDirectoryObject attribute).Plist method). 61 title (TV_Show attribute). 63 title (Movie attribute). 62 tagline (InputDirectoryObject attribute). 44 studio (AlbumObject attribute). 58 title (TrackObject attribute).String method). 55 title (PopupDirectoryObject attribute). Release 2. 56 summary (InputDirectoryObject attribute). 42 studio (TVShowObject attribute). 59 title (DirectoryObject attribute). 43 title (ArtistObject attribute). 42 summary (SeasonObject attribute). 64 thumb (SeasonObject attribute). 58 thumb (TrackObject attribute). 59 thumb (DirectoryObject attribute).docutils. 40 title (MovieObject attribute). 55 tagline (PopupDirectoryObject attribute). 60 thumb (ArtistObject attribute). 86 studio (Album attribute). 71 StringFromObject() (Framework. 41 TimestampFromDatetime() (Framework. 60 summary (Artist attribute). 63 summary (Season attribute).docutils. 63 thumb (PrefsObject attribute).docutils. 62 summary (Episode attribute). 42 title (TVShowObject attribute). 73 StringFromElement() (Framework. 43 summary (ArtistObject attribute).docutils. 60 title (Artist attribute). 72 StripDiacritics() (Framework. 66 thumb (AlbumObject attribute). 62 thumb (EpisodeObject attribute). 43 themes (Movie attribute). 42 summary (TVShowObject attribute). 44 tags (AlbumObject attribute). 63 thumb (MovieObject attribute). 55 studio (TV_Show attribute). 63 title (SeasonObject attribute). 59 tags (Movie attribute). 89 SummaryType. 42 tags (TVShowObject attribute).NoSummary (in module SummaryType). 43 Thread (module). 58 SummaryType (module). 89 SummaryType. 63 tags (Album attribute). 86 StripTags() (Framework. 55 thumb (PopupDirectoryObject attribute). 63 summary (Movie attribute). 87 title (Album attribute). 43 tags (ArtistObject attribute).docutils. 54 tags (TrackObject attribute). 44 summary (AlbumObject attribute).JSON method). 58 themes (Artist attribute). 89 T tagline (DirectoryObject attribute).docutils.Datetime method). 41 title (EpisodeObject attribute). 77 StringFromObject() (Framework. 40 tags (MovieObject attribute).

1 title1 (ObjectContainer attribute). 58 WebVideoURL() (built-in function). 56 writers (Movie attribute). 64 video_resolution (MediaObject attribute).Plugin attribute).H264 (in module VideoCodec). 59 TrackObject (built-in class). 89 W Wait() (Framework. 53 title2 (ObjectContainer attribute). 89 ViewType. 37 track_count (AlbumObject attribute). 53 Util (module). 65 writers (Episode attribute). 52 ViewGroups (Framework. 36 U year (MetadataSearchResult attribute). 64 video_frame_rate (MediaObject attribute). 71 Y YAML (module). 38 Unblock() (Framework. 75 year (Media attribute). 71 XMLRPC (module). 86 url (EpisodeObject attribute). 53 Traceback() (Framework.List (in module ViewType). 40 writers (MovieObject attribute). 54 url (TrackObject attribute).docutils. 56 VideoCodec (module).Thread year (Movie attribute).Log method). 44 trivia (Movie attribute). 49 Track (built-in class).docutils.docutils. 55 X XML (module). 13 video_codec (MediaObject attribute). 56 url (MovieObject attribute).String method).Thread method).Grid (in module ViewType).Plex Plug-in Framework Documentation. 40 year (MovieObject attribute).docutils.docutils. 60 user_agent (ObjectContainer attribute). 40 trivia (MovieObject attribute). 68 Warn() (Framework. 88 118 Index . 55 method). 41 writers (EpisodeObject attribute). 89 VideoCodec. 68 Unquote() (Framework.docutils. Release 2. 89 view_group (ObjectContainer attribute). 87 UUID() (Framework. 86 V ValidatePrefs() (built-in function).Plugin method). 60 track_count (ArtistObject attribute). 42 TVShowObject (built-in class). 49 ViewType (module). 55 TV_Show (built-in class). 60 tracks (Album attribute).docutils. 89 ViewType. 44 track (Media attribute).String method). 65 WindowsMediaVideoURL() (built-in function). 64 VideoClipObject (built-in class).1.

You're Reading a Free Preview

Download
scribd
/*********** DO NOT ALTER ANYTHING BELOW THIS LINE ! ************/ var s_code=s.t();if(s_code)document.write(s_code)//-->