FPP:Plugins

From wiki
Revision as of 21:16, 30 June 2014 by Materdaddy (Talk | contribs)

Jump to: navigation, search

FPP UI

Adding FPP Menu Entries

We allow menu entries into each of the top-level menus. These are drawn in the UI menus if your plugin incorporates a specially named file for each menu entry. To include something in the "Status/Control" menu, you must include a file named "status_menu.inc". The contents of this file should be a list element and link with text. The menu styling will happen automatically as it will be included within the proper menu's unordered list.

Status/Control Content Setup Output Setup Help
status_menu.inc content_menu.inc output_menu.inc help_menu.inc

Example

Prerequisites:

  • You're writing a plugin called "RDS Plugin"
  • Your plugin's repository name is "rds_plugin" (passed to plugin.php's "plugin" parameter)
  • You want a menu entry titled "RDS Setup" under "Output Setup" that will link to your plugin's "rds_setup.php" page for configuration

Your output_menu.inc:

<li><a href="plugin.php?plugin=rds_plugin&page=rds_setup.php">RDS Setup</a></li>

Of course, you must have a file named "rds_setup.php" in your plugin as well, so that when you click the menu entry, your page is drawn.

Adding FPP Plugin Pages

You can write pages that will be drawn using plugin.php. The main page takes care of the main UI details such as the menu entries, session support, header, footer, etc. Your page will only need to include the content within the "bodyWrapper" div of the main FPP UI layout.

To access your page you must use plugin.php and include at least two GET variables.

  • plugin - This is the directory name of your plugin. It will be the same as the name of your git repository.
  • page - The name of the page within your plugin directory to be included.

Example

Here's a quick example of a demo_page.php:

<h1><?php echo "Hello World"; ?></h1>
<p>
This is a demo plugin page.
</p>

FPP Daemon

The daemon supports callbacks during execution. These are useful to get data from the daemon without having to query the FPPD socket or running your own daemon to parse certain details.

Plugin Types

Currently there are only 3 types, but we may support more in the future for things like starting/stopping FPPD, and others. When FPPD starts, it will run a binary called "callbacks" with the "--list" parameter. This should return a comma-delimited list of callback types that your plugin supports. FPPD will keep track of this and call your function when one of the supported types occurs.

Media

This is a callback for when a media playback is started. If there is an audio file associated with the media being played back, TagLib is used to attempt parsing of the embedded metadata tags to be passed to the plugin. The plugin's "callbacks" executable will be called with "--type media" option as well as the relevant data. It is JSON formatted data.

key value description
type media|sequence|pause|video|event} Type of media entry being played back
Sequence <filename> Name of the .fseq being played
Media <filename> Media filename (if present)
title <parsed tag> Media Metadata Title (if present)
artist <parsed tag> Media Metadata Artist (if present)

Example of a media callback execution:

/opt/fpp/plugins/rds_plugin/callbacks --type media --data {"type":"both","Sequence":"rds test.fseq","Media":"test song.mp3","title":"Song Title","artist":"Song Artist"}

Playlist

Next Playlist Entry

Plugin Requirements and Installation