Sponsored Links

Sponsored Links

Quickstart to PS3 Plugin Development in Showtime by Facanferff


Sponsored Links
35w ago - Following up on the previous update, today PlayStation 3 developer facanferff has made available a Quickstart to PS3 Plugin Development in Showtime with details below.

To quote: Since a long time ago, some users have requested me to write a tutorial so they could create their own Showtime plugins. This is an initial attempt to it, I hope you like. If I make some mistake, I'm sorry, I'm not a teacher.

Overview

Before we get our hands dirty, it’s important to explain some little things that might help you later in making your own plugins. Plugins for Showtime (also known as Apps) are exclusively written, at the moment, in Javascript. To bring plugins to life, Showtime uses a Javascript engine called Spidermonkey (as of now, Showtime uses Spidermonkey 1.8.0-rc1). To learn more about this engine, you may go to developer.mozilla.org/en-US/docs/Mozilla/Projects/SpiderMonkey.

If you ever did web development, you may wonder if the Javascript API that work in normal web browser might work here, well, the answer is no. Due to this, you will not find things like DOM or AJAX in your toolbox, but you may and should use the basic Javascript.

In this quickstart, I will assume the reader has good understanding of Javascript. If you don’t know it, you may check the several resources available online/offline. From these, I recommend check this: codecademy.com

The Showtime plugins’ job is to respond to browse and search requests and populate the internal data model with the actual information to be shown to the user via Showtime’s user interface(s).

Since there are different types of plugins, I will focus in this tutorial in only a type, plugins that browse content in the web and show it to user (e.g. Youtube plugin).

Structure of a plugin

Every plugin lives in a directory of their own. From the several files this directory may have, you need to have at least one file in the root of the plugin, plugin.json, which contains information about the plugin and the author. You may use sub-directories and custom names for other files in order to organize it better.

plugin.json

plugin.json is a JSON (json.org) encoded text file containing information about the plugin and its author. Example of a plugin.json file (from the Channel9 plugin):

Now it’s time to learn more about each field and which ones are required for every plugin:

Getting Started

To run a plugin in a development environment, you may call from a terminal:

The flag –p means that you want to load a plugin in development environment.

If you ran this already, you might get the following error: This will output something like: plugins [ERROR]: Unable to load development plugin: testplugin Unable to load testplugin/plugin.json -- File not found. This means or we don’t have a testplugin directory or we don’t have a plugin.json inside it. To create the directory do:

Now, to edit the plugin.json, open the file testplugin/plugin.json in any text editor that you like.
In there, let’s make our initial plugin.json:

With this, we specified that the plugin testplugin uses Javascript engine, has an ID ‘testplugin’ and the script is ‘testplugin.js’.

Whenever you want to reload the plugin you can use Shift+F5 in Showtime. This is helpful when you make changes to a plugin already in development environment inside Showtime, without the need of restarting Showtime. Even if the plugin gave an error, you may use this to try to reload it. When you reload it, all hooks and resources associated to the plugin are removed. This phenomenon happens also when a user removes a plugin from Showtime.

In case you are already in a page that belongs to the plugin itself, Showtime will reload the plugin and reload the page itself.

Now open your testplugin/testplugin.js in a text editor. Since we want to have a plugin that lives forever (so it can be called anytime) we need to have a scope where all local variables will live and also need to remember ‘this’ which is, when the script is invoked, a plugin object created by Showtime itself (showtimemediacenter.com/projects/showtime/wiki/JSAPI_plugin).

So, let’s edit this file:

Reload the plugin now with Shift+F5, if you look in the terminal windows from which you opened Showtime, you will find a line saying ‘Hello, Showtime XXX’ where XXX is your current Showtime version that was obtained via showtime.currentVersionString .

Routing an URI to the plugin

Since our plugin will respond to browse requests we need to have an URI associated to it. An URI is something like a URL you use to browse the Internet, but in this case it is used to browse in Showtime. Every plugin reservers URI space starting with the plugin’s ID specified in plugin.json. These URI routes registered by plugins have higher priority than URI routes that Showtime itself handles, so you can create an URI route like it is in a web browser (e.g. youtube.com)

With this new knowledge let’s make it in use (edit it to match this code):

Now, reload the plugin and if you type “testplugin:hello” in the search input field on Showtime’s home page, you will notice Showtime will open a new page with only a loading symbol, but in the terminal it will show the message provided to showtime.print.

A look in a real plugin

For this tutorial, I decided to use a real plugin made by me, which is called Videocopilot. The plugin source is located at github.com/facanferff/showtime-plugins/tree/master/videocopilot and its a plugin for Web site videocopilot.net.

I will not discuss the plugin.json of the plugin ([Register or Login to view links]) in this tutorial.
The lines of code or numbers of line are relative to version 0.9 (the most updated version at this moment).

Lets see then the plugin script (github.com/facanferff/showtime-plugins/blob/master/videocopilot/videocopilot.js).

To make Showtime provide a link in home page to the plugin’s start page we need to create a service:

Lets check each argument given to plugin.createService:

  • 1st: “Video Copilot” is the display name of the service
  • 2nd: PREFIX (which is a global variable specified as “videocopilot” + “:start” is the initial route of the service (the URI where is located the home page of the plugin)
  • 3rd: “video” tells Showtime this plugin provides video resources
  • 4th: true means the service should be enabled immediately, making it visible to user and
  • 5th: plugin.path (gives you the full path to the plugin’s root directory) + “logo.png” is the path to an image that identifies the plugin.

Since we registered the home page’s URI route, we need to specify what does that URI route:

Here, plugin.addURI registers a new URI route, in this case called “videocopilot:start” and startPage is the function to be called when this route is open by user request. The function provided to addURI should accept at least one argument, where the 1st one is a page object created by Showtime and used to manipulate the page.

function startPage:

Here, page.appendItem will append a new item to the current page. Lets see the arguments:

  • 1st: PREFIX + ':browse:' + escape('http://www.videocopilot.net/tutorials/') + ':undefined' , is the URI route that should be called when the user clicks this item
  • 2nd: type of item, from the several ones, the most used are: directory, used to specify this item will open a new page to browse contents; and video that specified this item will open a video resource
  • 3rd: metadata for the item, you may provide any information about this item as you want. The most used are: title, title of the item; icon, image to be shown associated to the item; description, a description of the item

Means this page is a directory to browse content.

Tells Showtime that the contents of this page are “items”, in most cases, you want to use this one, we will use it for this tutorial.

Tells Showtime that we don’t want anymore the loading symbol to be shown to user.

Function getVideoList:

Here, showtime.httpGet is a function you may call to do a GET request to a page (e.g. to obtains its source code) and .toString() is to convert its response to a Javascript String to manipulate.

plugin.addURI(PREFIX + ":video:simple: (.*)", function(page, link):

This is a Javascript object where we specify only the title of a video (displayed in video playback) and sources is an array where each object contains at least the url (e.g. the video’s url).

Here, page.source is the way to tell Showtime what we want to reproduce. Since we want to play a video we need to put always “videoparams:” before the parameters of video as specified before encoded in a JSON string.

This finally tells Showtime we have a video, so Showtime can handle everything to prepare video playback.

This function is used to add continuously items to a page. In the current version of the tutorial, I will not explain this, so whenever you want to show more items (e.g. of a second page) use page.appendItem and pass what you need.

This function adds a searcher to Showtime that can be used when a user searches for something (not a URI route) in search input field in Showtime’s home page. This function accepts 3 arguments:

  • 1st: title of the searcher, shown to user when searching something
  • 2nd: image of the search, also shown to user
  • 3rd: function that receives a page and query arguments (page is the same as specified before in the tutorial and query is a string containing what to search). This function is runs always whenever a user searches for something.

Note: In the function passed to plugin.addSearcher you need to specify somewhere the number of found entries via page.entries, otherwise Showtime will not show your searcher to user for that query.

I recommend you study carefully the code at: github.com/facanferff/showtime-plugins/blob/master/videocopilot/videocopilot.js

Publishing plugins

You may check showtimemediacenter.com/projects/showtime/wiki/SPMC for all details about it.

Bibliography

showtimemediacenter.com/projects/showtime/wiki/PluginDevelopment (maintained by Andreas Oman (andoma), Fábio Ferreira (facanferff) and Leonid Protasov (lprot))

Thanks

andoma: for creating Showtime

Final notes

I hope, you learned a little about plugin development in Showtime with this small tutorial. This tutorial is far away from being finished, I just wanted to give you an initial overview to the process of creating plugins for Showtime.

With a look in a real plugin, I believe you have now the fundamental tools to study better existing plugins and create new plugins. Whenever I can, I will try to update this tutorial to make it more complete and easier to understand.

For a reference of the functions Showtime provides I recommend you check showtimemediacenter.com/projects/showtime/wiki/JSAPIREF

And to conclude I leave here a screenshot of plugin TMDb so you can see the potential you can get from a plugin (below).

I hope you liked, facanferff.






Stay tuned for more PS3 Hacks and PS3 CFW news, follow us on Twitter and be sure to drop by the PS3 Hacks and PS3 Custom Firmware Forums for the latest PlayStation 3 scene updates and homebrew releases!

Comments 547 Comments - Go to Forum Thread »

• Please Register at PS3News.com or Login to make comments on Site News articles. Thanks!

PS3 News's Avatar
#512 - PS3 News - 86w ago
Following up on the previous release, today PlayStation 3 homebrew developer Andreas Oman has updated the Showtime PS3 Media Player Testing Build to version 4.1.273 with the changes outlined below.

Download: [Register or Login to view links] / [Register or Login to view links] / [Register or Login to view links] / [Register or Login to view links]

For those who missed them, a Showtime PS3 Media Player Skin Oceanus and Showtime PS3 Plugin TMDB and Oceanus Skin Plugin are also available.

4.1.270

Make sure Showtime does not downgrade a plugin to a lesser version

4.1.269

Add support for replacing various parts of the UI using plugins. More information about this will surface once plugins support it

4.1.267

For beta-testers of plugins there is now a setting under "General" where a user can specify a, list of space separated, passwords
that will enable beta testing of plugins. Passwords are administrated by the plugin developer

4.1.259

Add support for adjusting volume during video playback using up/down keys

Fixes #1241
Fixes #1123
Fixes #751
Fixes #560

4.1.249

Don't wrap from end to beginning of list during continuous video playback

Fixes #1250

4.1.245

Correctly recognize '.m2ts' as a file type ending to ignore

Fixes #1391

4.1.244

Reworked audio pipeline. This should fix various issues. In particular various clicks and pops now and then on PS3 should be gone.

Fixes #1408
Fixes #1308
Fixes #1005
Fixes #964

4.1.225

Upgrade to libav9_beta2. This is a huge upgrade that might cause problems with some files. Please report bugs if anything seems to have broken

4.1.221

Fix broken RTMP(E) playback on PS3

4.1.210

Fix a problem that caused playback time to stay at 0:00 for some audio files

4.1.182

Fix problem that caused resume position not to be reset when movie ended

4.1.166

Fix search lookup loops when changing TMDB configuration

Fixes #1293
Fixes #1292

4.1.129

Add support for Shoutcast playback. Plugins are required to be able to browse Shoutcast services

4.1.99

Add support for setting custom movie titles directly from the item popup menu

Fixes #1213

4.1.98

Add an action in settings->general to clear the entire metadb item table. Safeguarded with a popup as it is a non-revocable action.

Fixes #1218

4.1.95

ps3: When seeking using L2/R2, rescale seek delta based on duration of feature. In principle this make it so that the user can always seek from begining to end in ~2 seconds regardless of how long the currently playing media is.

4.1.92

Add Exit and Standby as items in the page popup menu

Fixes #1042
Fixes #1184

4.1.84

Only reset screensaver timer if movie is actually playing

Fixes #1022
Fixes #1115

4.1.76

Add support for plugins that can replace certain parts of the UI

4.1.68

Add support for categorization of plugins. When browsing available plugins they will appear under a category instead of a single long list

4.1.50

TMDB: Let user choose which language to use for TMDB. Also lets user choose if to display the original title or translated title

4.1.26

Don't set resume time for videos if current position < one minute. This makes sure the user does not accidentally lose the resume
position if restarting the video from beginning by mistake

4.1.25

Let 'mark as seen' create entry in item table if it does not exist

Fixes #1175

4.1.20

Improve Showtime's response time to play/pause events

Fixes #1180

More PlayStation 3 News...

scott7seven's Avatar
#511 - scott7seven - 87w ago
should you install both the mm pkg and the stand alone, or can you, and why.. and do you have to dl the ocean them separate?

wizzkidd's Avatar
#510 - wizzkidd - 87w ago
Following up on the previous release, today PlayStation 3 homebrew developer facanferff has made available a Showtime PS3 Plugin TMDB (The Movie DataBase) followed by TMDb v1.1 alongside an Oceanus Skin Plugin for Showtime v04.01+ (CEX) with details below.

Download: [Register or Login to view links] / [Register or Login to view links]

From his blog, to quote: Showtime Plugin TMDB released!

That's right! We're again at that time a new release comes to Showtime and this time is the newest plugin for TMDB, featuring a different experience from anything you could find before in Showtime.

TMDB Updates:

1. Home Screen
2. Movie View
3. Person View
4. See more
5. Authentication, easy to follow instructions on screen
6. User Profile
7. Loading screen, should reduce potencial crashes

I hope you enjoy this release, so now the instruction to get it: First of all, it requires Showtime 4.1 at least.

Method 1 (both standalone and multiMan embedded Showtime):

Download: [Register or Login to view links]

Put zip archive at dev_hdd0/HTSS00003/USRDIR/settings/installedplugins or if you use Showtime through multiMAN

Put the zip archive in: dev_hdd0/game/BLES080608/USRDIR/sys/st4_settings/installedplugins/

Method 2 (only for standalone Showtime, thanks wizzkidd):

Download: [Register or Login to view links] or [Register or Login to view links]

Install the pkg normally.

Method 3 multiMAN edition PKG:

Download: [Register or Login to view links]

Special thanks:

  • andoma: for creating Showtime
  • Tyrant: for beta testing the plugin
  • wizzkidd: for the pkg installs

FAQ:

1. I found some issues, had crashes or have suggestions, where can I inform the developer about them?

At lonelycoder.com/redmine/projects/showtime.

Official source: facanferff.net
irc.efnet.net #showtime

Update: TMDb v1.1 Changelog:

  • Add: Support for specifying 3 search sources (in Movie View, only supports PLX playlists at the moment)
  • Add: Browse movie in Youtube (in Movie View, requires Youtube plugin to be installed)
  • Add: Play Now button (in Movie View, if clicked it will play the video specified in the URI)
  • Add: Show all lists that contain a movie (in Movie View)
  • Add: Make plugin design independent of Oceanus plugin (user without Oceanus plugin couldn't load See more lists)
  • Add: Search for a list
  • Add: Show if a movie was marked as favorite (in Movie View)
  • Add: Show if a movie was marked as watchlist (in Movie View)
  • Add: Choose background for current movie (in Movie View)
  • Add: Choose poster for current movie (in Movie View)
  • Add: Browse most popular people
  • Add: Allow user add movie to watchlist
  • Add: Browse a list by id
  • Add: Hide Favorite/Watchlist button if movie was already marked
  • Add: Kids In Mind's Parents Guide (in Movie View)
  • Fix: Search would not work if user specified 2 or more words separated by spaces
  • Fix: User would not be logged in after some uses
  • Fix: If a movie/person had no poster the screen would be somewhat corrupted
  • Fix: In Genres page, movie titles would not show
  • Fix: In some cases, when a subrequest (i.e. favorites in user view) failed, the page would not show up
  • Enhancement: Better Search movie by title algorithm (only observable externally, i.e.: TMDb View in Navi-X) (See Note 1)
  • Enhancement: Improve slightly Genres page design
  • Enhancement: Improve Movie View loading time

More PlayStation 3 News...

ConsoleDev's Avatar
#509 - ConsoleDev - 88w ago
StanSmith if you are interested i have a copy of ShowTime 4.1.244 (is not the same version that you need but i think that have the feature that you want) and i have uploaded here: [Register or Login to view links]

Let me know if it is OK for you

StanSmith's Avatar
#508 - StanSmith - 88w ago
Thanks but there are heaps more TEST versions since that one with some nice features.

Looks like it will finally be getting volume settings, something its been needing since the start.

Sponsored Links

Sponsored Links
Sponsored Links

Sponsored Links







Affiliates - Contact Us - PS3 Downloads - Privacy Statement - Site Rules - Top - © 2014 PlayStation 3 News