Quickstart to PS3 Plugin Development in Showtime by Facanferff
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.
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 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):
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:
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).
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:
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.
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
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 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
You may check showtimemediacenter.com/projects/showtime/wiki/SPMC for all details about it.
showtimemediacenter.com/projects/showtime/wiki/PluginDevelopment (maintained by Andreas Oman (andoma), Fábio Ferreira (facanferff) and Leonid Protasov (lprot))
andoma: for creating Showtime
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).
Showtime PS3 Media Player and MultiMAN PKG Updates Arrive
Following up on the previous updates, today PlayStation 3 homebrew developer Andreas Oman updated the Showtime PS3 Media Player testing builds alongside some MultiMAN PS3 PKG updates by deank with details below.
ps3: Fix bug in litecoin miner causing it to be a lot less efficient than it should be
ps3: Relax memory warning thresholds a bit. Now that we use TLSF it's much less of a problem
stos: sync() after critical writes to disk
Fix crash in UPNP code Fixes #1773
js: Add support for plugins to set cookies directly
ps3: Add a miner
Transfer Copyright to Lonelycoder AB
prop: Disable prop subscription stats
prop: Redeuce memory usage by reusing compile time strings during prop symlinking
prop: Correctly handle settings of a PROP_DIR to some other value
glw/view: Improve trace() function a bit
prop/core: We must use prop_ref_dec_locked() when prop_mutex is held Fixes #1797
ps3: Make it possible to edit discovered FAT and HDD sources from settings
ps3: Add NTFS support
httpclient: Fix broken cookie domain validation Fixes #1794
Add so called 'managed services'
Huge rework of prop tree symbolic links
Add missing title and contents for network discovered services
Add str_cleanup() helper
ps3: Add some mutex debug helpers
glw: Fix problem when assigning 'args' attribute with a non-prop p Fixes #1776
From aldostools: Build 4.3.582 has two important changes since 4.3.576:
ps3: Fix bug causing NTFS drives not being able to be remounted
ps3: Show CPU and RSX temperature in sysinfo (Press L3 to view)
For more details: github.com/andoma/showtime/commits/master
From deank: I compiled showtime 4.3.582 for mM... It is available in the WEB column of multiMAN and also from the VIDEO column -> Update. Standalone versions are in the web column.
Update: v4.3.601 Testing Changelog:
subtitles/sub: Watch out for division by zero
glw: Fix minor memleak (one per glw session)
Fix play/pause issues
glw: Rework how we auto-rescale UI
audio: Fix invalid assert()
ftpserver: Add support for "OPTS UTF8 ON/OFF" and report is as a FEATure
Resolve prop for track in playqueue
audio: When flushing pipeline we must also flush resampler
builtin-osk: Add '@' character and close when user press back/exit button
Drop shoutcast support
httpserver: Send encoding as UTF-8 in various places
Fix 'use after free'
miner: Drop debug info
ps3: Fix bug causing NTFS drives not being able to be remounted.
ps3: Show CPU and RSX temperature in sysinfo (Press L3 to view)
glw: Fix some nastyness related to how we resolve properties This fixes a long standing issue with image view in the UI, causing just the spinner to appear and no image to be shown
hls: Fix issues when seeking past end of track when doing continous play
osk: Replace Â¤ with $
Upgrade: Don't fail patch upgrade attempt if we can't open target file to get current hash
Add Slovak translation
Improve event routing
Showtime PS3 Media Center v04.03.698 for MultiMAN is Released
Following up on the previous revision, today PlayStation 3 homebrew developer Andreas Oman updated the Showtime PS3 Media Player testing builds to v04.03.698 followed by Showtime for multiMAN (both CEX and DEX) by deank with the changes outlined below.
Avoid some log messages from sqlite (we deal with them anyway)
Call logfiles "showtime-#.log" instead of "showtime.log.#"
h264: Skip the check converting h264 AVCC to annexb even when NAL unit len = 3.
media: Fix lock-against-self when cycling subtitle/audio tracks …
Make sure fa_parent() works on NTFS drives (ugly hack) …
Update pl_PL, sp_SP, zh_CN language
Make miner also translatable
upnp: Add more URLs in device description
settings/store: Fix lock inversion Fixes #1837
ssdp: Remove unused code
ssdp: If we fail to bind, retry later Fixes #1838
Update translation files: Swedish, dk_DK, zh_CN
Make system name configurable in Settings -> Network
hls: Drop astray FA_DEBUG
asyncio: Handle errors from poll() in a more resilient way poll() on ps3 can return error if there is a problem with one of the fd:s
If settings storage can't use rename to overwrite, just log a debug message
Improve ext subtitle load debug
ASYNCIO: Add names to all file descriptor structs
When ASYNCIO Poll error occurs, output more info in log
subtitles: Fix some memory leaks when loading ext subs
When user can rename discovered services, revert to original name if configured name is empty
Upgrade librtmp - Fixes bug with DecodeTEA on BE systems. Fixes #1774
upnp: One more fix. Fixes #1788
upnp: Use URL to video file as canonical URL
Rework how continous video playback build the video play list. Fixes #1819
audio: Fix assert() in pulseaudio when skipping to next video track
upnp: Fix issue causing names of UPNP services to be messed up
ps3: Nag a bit more about donations if it's never turned on by the user
HLS: More robust handling of corrupted segments
RTMP: Set media source info. Fixes #1822
hls: Avoid calling sub_scanner repeatedly if nothing will be scanned by it
httpclient: Deal with "206 Partial Content" when we didn't ask for it.
Here is the standalone version of Showtime 04.03.698 compiled by me with all the standard changes:
Showtime for multiMAN is available as usual within mM/mmCM in the VIDEO column (press [Triangle] over "Start Showtime" and select "UPDATE").
CEX/DEX standalone versions are also available for direct download (as .pkg) in the WEB column of multiMAN/mmCM.
Getting error 404 when attempting to install plugins in showtime version 4.3.536. Seems like it cannot connect to internet. PS3 has internet connection and I can see browse on it fine. Any suggestions pls...
I have Showtime problem with installing plugins ! Both standalone and multiman version don t work. I have reinstall - update / upgrade rogero 4.50 & multiman - still nothing. Update to Steven CEX-4.53 & newest multiman - still nothing.
No plugin in apps ! I have deleted multiman and showtime and then update system bouth with rogero and Steven - and still nothing.
I have tried and search for alternate plugin repository url. Did not find it ! This are versions of showtime i have tried and no go :