Falcon Christmas

Falcon Christmas => Falcon Player (FPP) => Falcon Player Plugins => Topic started by: Bshaver on January 11, 2019, 10:23:36 AM

Title: FPP v2.x plugin integration
Post by: Bshaver on January 11, 2019, 10:23:36 AM
Yes, I saw the shell of it in the plugins.cpp file :)


Can you plug something in there to output to the plugins? Please?  --type: Plugin --data:<whatever the user put in>


Then the callbacks would have to register not only Media, but also ,Plugin

Title: Re: FPP v2.x plugin integration
Post by: CaptainMurdoch on January 11, 2019, 12:14:09 PM
Split off into a new topic to keep the plugin details out of the FPP v2.6 release thread.

Should this be --type Playlist?  I don't see --type Plugin in Plugins.cpp.
Title: Re: FPP v2.x plugin integration
Post by: CaptainMurdoch on January 11, 2019, 02:10:33 PM
One big issue, IMO, is mandating that all plugins are hosted in a repository in the FalconChristmas organization.    Thus, if the author "goes away", we can fix things.  To add a new plugin to the plugin page, we add the repo to FalconChristmas and then grant that original person write access to that one repo.

^^^  and quoting from another thread.

I'm fine with that, but am not sure how all plugin authors would feel about it.

I'm wondering about starting with a fresh slate until plugins have been confirmed as working.  If we come up with a new 'spec', an example plugin, etc. then we could move plugins over to the new spec and add them to the list of known working.  The example could include sample pages for UI, Config, and a plugin 'about' page.  We can add support for specifying the min/max FPP version required, etc..
Title: Re: FPP v2.x plugin integration
Post by: Poporacer on January 11, 2019, 06:58:15 PM
I am trying to get the Event Date and Weather plugins to work and neither one works. I have a Pocket-Beagle with a Scroller from Dan Kulp running a P10 panel. When I try to go to the Event Date setup page, the page does not open. I just get the header and nothing in the body for the setup. I have a PI 3B and the setup page will show up.
Title: Re: FPP v2.x plugin integration
Post by: jnealand on January 11, 2019, 07:13:35 PM
@popracer  I believe that this topic is about plugin development standards and not about a specific plugin.  You should probably start a topic re the specific plugin that you are needing answers for and make sure that those words are in the title of the thread.
Title: Re: FPP v2.x plugin integration
Post by: mac50 on January 12, 2019, 02:35:26 AM
I am trying to get the Event Date and Weather plugins to work and neither one works. I have a Pocket-Beagle with a Scroller from Dan Kulp running a P10 panel. When I try to go to the Event Date setup page, the page does not open. I just get the header and nothing in the body for the setup. I have a PI 3B and the setup page will show up.
Had same problem until I went to Events page and triggered RUN-MATRIX.sh and then full Event Date page loaded. Still have not text to appear on matrix using Event Date or Matrix Tools (but draw works ok).
But like Jim said this should probably on a new thread
Title: Re: FPP v2.x plugin integration
Post by: Bshaver on January 12, 2019, 09:24:17 AM
Split off into a new topic to keep the plugin details out of the FPP v2.6 release thread.

Should this be --type Playlist?  I don't see --type Plugin in Plugins.cpp.


There isn't one. But I understand what you are asking. The type playlist did nothing really for the longest time. type 'media' is what you would subscribe to.
So, if the plugin subscribes to the 'playlist' is that also doing the same thing? What is the benefit. There is type 'event' as well. It is unclear what the plugins should subscribe to. There is the new 'boot' subscription now which is handy and I think I will try to play with that a little especially with one of my plugins that needs setup at boot time.


IMO:
 --type playlist a user to subscribe to a specific playlist. That playlist could be configured in the individual plugin so ONLY events from that Playlist are processed.
--type plugin: a plugin is subscribing to all events directed at itself from the playlist. The playlist Plugin event (need to add the directed to plugin selection, with a default of "ALL") would receive to the plugin "--data <raw data from the playlist textbox>" This could be helpful for users to manually put in items such as "Artist: Name of Artist Title: Song Title" instead of overwriting it in the MP3 header of the MP3 file to be stripped off.  Much like we have the compressed UI information, could there be an ADVANCED UI - that could show metadata off the files we are reading the FSEQ and the MP3/MP4? File Size, Duration, Artist, Title, Codec/Wrapper.





Title: Re: FPP v2.x plugin integration
Post by: Poporacer on January 12, 2019, 09:44:22 AM
Had same problem until I went to Events page and triggered RUN-MATRIX.sh and then full Event Date page loaded.
That didn't work for me :(
Quote
But like Jim said this should probably on a new thread
I will just wait and see what the outcome is
Title: Re: FPP v2.x plugin integration
Post by: Poporacer on January 12, 2019, 10:22:02 AM

If we come up with a new 'spec', an example plugin, etc. then we could move plugins over to the new spec and add them to the list of known working.  The example could include sample pages for UI, Config, and a plugin 'about' page.  We can add support for specifying the min/max FPP version required, etc..
I think that would be a great idea, that way newcomers coming in would have some resources to look at to make things work instead of a list of Plugins and Script Repositories and no instructions on how to use them. I wouldn't mind helping out on this if you need it. I am not up to speed yet on how FPP and the Scripts/PHP all work together but I can learn (I do have some coding experience in C++, Python and a couple others but it has been a while and it wasn't at the level you guys are) But once things are working, I could help in putting together sample pages, and help pages or anything else you might need.
Title: Re: FPP v2.x plugin integration
Post by: CaptainMurdoch on January 12, 2019, 02:32:21 PM
I am going to put some thought into this tonight.

Since I am working on writing a plugin for the viewer control web site, then I can also try to document and make changes on the FPP side as needed along the way.

I am also thinking that I want to convert the pluginData.php file to JSON as well.  Each plugin would be required to have its own JSON file with the plugin details including the FPP version requirements and we could make a script to pull the JSON for the compatible plugins together and  generate the master plugin JSON file in the main FPP git repository.

I also need to look at the old plugin playlist integration and get that upgraded for the new JSON playlist format if necessary and want to document some of this along the way so we can have a “stub” plugin that people can copy and build a new plugin from.
Title: Re: FPP v2.x plugin integration
Post by: jcross on January 14, 2019, 02:28:24 PM
One big issue, IMO, is mandating that all plugins are hosted in a repository in the FalconChristmas organization.    Thus, if the author "goes away", we can fix things.  To add a new plugin to the plugin page, we add the repo to FalconChristmas and then grant that original person write access to that one repo.

^^^  and quoting from another thread.

I'm fine with that, but am not sure how all plugin authors would feel about it.

I'm wondering about starting with a fresh slate until plugins have been confirmed as working.  If we come up with a new 'spec', an example plugin, etc. then we could move plugins over to the new spec and add them to the list of known working.  The example could include sample pages for UI, Config, and a plugin 'about' page.  We can add support for specifying the min/max FPP version required, etc..




This sounds like a fantastic idea.
Title: Re: FPP v2.x plugin integration
Post by: jcross on January 14, 2019, 02:31:21 PM
I am going to put some thought into this tonight.

Since I am working on writing a plugin for the viewer control web site, then I can also try to document and make changes on the FPP side as needed along the way.

I am also thinking that I want to convert the pluginData.php file to JSON as well.  Each plugin would be required to have its own JSON file with the plugin details including the FPP version requirements and we could make a script to pull the JSON for the compatible plugins together and  generate the master plugin JSON file in the main FPP git repository.

I also need to look at the old plugin playlist integration and get that upgraded for the new JSON playlist format if necessary and want to document some of this along the way so we can have a “stub” plugin that people can copy and build a new plugin from.


Just wondering would your script check all branches?  If I have a plugin for fpp 1 and then create a new branch for 2.1 and then a new branch for 2.6 would that cause a problem, or would master branch always be what is checked?
Title: Re: FPP v2.x plugin integration
Post by: CaptainMurdoch on January 14, 2019, 03:41:45 PM
Just wondering would your script check all branches?  If I have a plugin for fpp 1 and then create a new branch for 2.1 and then a new branch for 2.6 would that cause a problem, or would master branch always be what is checked?

I'm thinking that the script would have a list of sources it would use.  The script in the FPP v2.6 directory might have one set of sources while the script in FPP v2.7 might have another, and these sources could be any branch allowing the plugin author to have different branches for different FPP versions..  The script handles the dependency checking once to build the JSON rather than having to check every time a viewer opens the plugin page.
Title: Re: FPP v2.x plugin integration
Post by: Bshaver on January 15, 2019, 05:49:52 AM
If I may add - a run time variable that is the FPP version running. There was some breakage in the parameters passed to some of the daemons that caused inconsistencies in a few of my plugins that relied on other plugins. And versions of those binaries.


Anyway, I like this idea. and will like to start migrating to something like this. Also, the vetting process to get a plugin into the list. Users should be able to add a plugin outside of the list.


I have had a Unraid nas in the past where you could post a URL to the plugin, and it adds it for you. Untars the information, etc. Possibly some deploy mechanism like that?
Title: Re: FPP v2.x plugin integration
Post by: CaptainMurdoch on January 15, 2019, 10:34:20 AM
If I may add - a run time variable that is the FPP version running. There was some breakage in the parameters passed to some of the daemons that caused inconsistencies in a few of my plugins that relied on other plugins. And versions of those binaries.

Anyway, I like this idea. and will like to start migrating to something like this. Also, the vetting process to get a plugin into the list. Users should be able to add a plugin outside of the list.

I was thinking about the version checking and have a patch to have fppversion.sh create a fppversion.php file to mirror the fppversion.c file that we have in the src directory.  These files get rebuilt anytime we compile, so they should always has the latest version info.

I agree on making it easy to install plugins from other sources.  I'm thinking that you would enter the URL of the plugin's git repository and the UI would download the plugin's .json file to get and display the info about the plugin just like it does for the plugins in the main list.  For upgrading and uninstalling, the UI would merge the list of installed plugins with the list of plugins in the main list.  Since I am at the point where I want to start getting some testers on the Viewer Control plugin and web site, I am going to start taking a look at this side of the plugin install.
Title: Re: FPP v2.x plugin integration
Post by: CaptainMurdoch on January 15, 2019, 10:15:42 PM
I'm thinking now that since you have to be online to install a new plugin, that we should just retrieve the info from the internet similar to the script repository.  This will ensure the most up to date plugin info is loaded and will get the FPP developers out of the business of maintaining SHA's in pluginData.inc.php.

Here's what I am thinking (and what I have mostly coded and tested already)  :)

- FPP repo has a simple fpp/js/pluginList.js file that contains an array of known plugins along with a link to their pluginInfo.json info file.  The pluginInfo format is described at the bottom of this post.  The pluginInfo.json files are stored in the plugin repositories, not in the FPP repository.
- When  you load the plugin installer page, the UI will look at both the list of installed plugins and the list of plugins in the pluginList.js file.  The code will iterate through the installed list first so installed plugins show at the top of the list so they can be easily updated, then it will iterate through the list of plugins in the javascript array.  For each plugin, it will iterate through the list of compatible versions in the pluginInfo.json.  If a compatible version is found or the plugin is already installed (even if incompatible), the plugin will be listed in the top area of the page as a compatible plugin.  If there are no compatible versions of the plugin found, it will be listed at the bottom of the page in an 'incompatible plugins' area.  If the plugin is installed already, but the version installed is not compatible, then the UI will put a warning below the plugin info to indicate that it may be incompatible with the current FPP version.
- The install button is not shown for incompatible plugins.  Installed plugins can be upgraded (using git pull) or uninstalled.
- Each compatibility 'version' of a plugin has a branch and an optional sha1 hash.  The has is used if the author is doing development and only wants a specific version installed, but if empty, the plugin will be installed from the latest code in the branch.

The pluginInfo.json for a plugin looks like this:
Code: [Select]
{
    "repoName": "fpp-plugin-Template",
    "name": "Template Plugin for FPP Plugin developers",
    "author": "John Doe (jdoe)",
    "description": "This template plugin is designed to make it easier for plugin authors to create new FPP Plugins.  You can manually clone the git repository or install the Template Plugin and then go to the plugin's config page and use the form to copy the template into a new plugin directory.",
    "homeURL": "https://github.com/FalconChristmas/fpp-plugin-Template",
    "srcURL": "https://github.com/FalconChristmas/fpp-plugin-Template.git",
    "bugURL": "https://github.com/FalconChristmas/fpp-plugin-Template/issues",
    "versions": [
        {
            "minFPPVersion": 2.0,
            "maxFPPVersion": 0,
            "branch": "master",
            "sha": ""
        }
    ]
}

So, what am I missing? :)
Title: Re: FPP v2.x plugin integration
Post by: Poporacer on January 16, 2019, 07:34:18 AM
I really like the idea of providing a centralized repository! Because you are iterating through the installed Plugins already, why not indicate on the page if there is an update available similar to what FPP does in the About page? Also, will there be a  time when a Plugin Requires a Script or other Plugin to function? If so, add that to the pluginInfo.json and if there are any Plugins installed that do not have the dependencies installed, flag that as well and indicate what Plugin/Scripts are missing with maybe a link to the required files? What about a Help or Installation URL as well for each Plugin?
I would love to help out testing and any other things that you will need to make this happen!
Title: Re: FPP v2.x plugin integration
Post by: CaptainMurdoch on January 16, 2019, 12:10:00 PM
I added a note about dependencies to my list and updated the pluginInfo.json file in the template plugin example.  I do plan on checking to see if there are any updates to the installed plugins and highlighting those.  Perhaps even an 'upgrade all' button.  I think that the home URL can point to wherever the plugin author wants, it could be the github repo or wiki page or somewhere else with other help pages, so I'm not sure about adding more URL's to the list.  I plan on adding support for the plugin to put a menu entry under any of the main menu items, so plugins can have their own entry under the Help menu.  The sample template plugin would have stub menu entries and .php files for each of these.
Title: Re: FPP v2.x plugin integration
Post by: Bshaver on January 17, 2019, 09:30:22 AM
is this in 2.x Master?
Title: Re: FPP v2.x plugin integration
Post by: CaptainMurdoch on January 17, 2019, 09:52:43 AM
is this in 2.x Master?

Not yet, I hope to commit it tonight or tomorrow.  I have a few things I want to do before I push the new code to master:

- update the plugin install PHP code to use the new info rather than pluginData.inc.php.  This will still need a bit of work for dependencies.
- update my two plugins to create their pluginInfo.json file
- update other plugins under FalconChristmas org to create their pluginInfo.json files

If you want to go ahead and start creating pluginInfo.json files for your plugins, then I can add those links as well.  I think we can update links if/when we move plugins to the FalconChristmas org, I'm not as concerned about that right now as I am getting the structure in place.

Below is the format I have now.  I have added a place for plugin, script, and package dependencies.

Code: [Select]
{
    "repoName": "fpp-plugin-Template",
    "name": "Template Plugin for FPP Plugin developers",
    "author": "John Doe (jdoe)",
    "description": "This template plugin is designed to make it easier for plugin authors to create new FPP Plugins.  You can manually clone the git repository or install the Template Plugin and then go to the plugin's config page and use the form to copy the template into a new plugin directory.",
    "homeURL": "https://github.com/FalconChristmas/fpp-plugin-Template",
    "srcURL": "https://github.com/FalconChristmas/fpp-plugin-Template.git",
    "bugURL": "https://github.com/FalconChristmas/fpp-plugin-Template/issues",
    "versions": [
        {
            "minFPPVersion": 2.0,
            "maxFPPVersion": 0,
            "branch": "master",
            "sha": ""
        },
        {
            "minFPPVersion": 0,
            "maxFPPVersion": 1.11,
            "branch": "v1.x",
            "sha": ""
        }
    ],
    "dependencies": {
        "plugins": [
            "fpp-plugin-CoolPlugin1",
            "fpp-plugin-CoolPlugin2"
        ],
        "packages": [
            "system-package-name1",
            "system-package-name2"
        ],
        "scripts": [
            "Control/script-repository-script1",
            "PixelOverlay/script-repository-script2"
        ]
    }
}
Title: Re: FPP v2.x plugin integration
Post by: Bshaver on January 17, 2019, 10:06:40 AM
I will.
I'm not clear on the dependencies. If something is dependent on lets say . the Matrix tools plugin. What do I put in the dependencies section? The entire GIT URL? Or the common name?


For Example: the Git Repository for Matrix tools is: https://github.com/cpinkham/fpp-matrixtools
The common name in the Plugin installer is "Matrix Tools"
The folder name on the FPP instance is "fpp-matrixtools"


What if an author changes the folder name under "/home/fpp/media/plugins" then the folder name dependency will not be valid.


Also, the System package name: for example: i need sqlite3. Do I simply put sqlite3 in there as a dependency?


Also, the scripts, is that an installed script from the repository that is a dependency?
If you dont need any dependencies, do you leave the tree in there, but just be blank?

Title: Re: FPP v2.x plugin integration
Post by: CaptainMurdoch on January 17, 2019, 10:52:10 AM
I'm not clear on the dependencies. If something is dependent on lets say . the Matrix tools plugin. What do I put in the dependencies section? The entire GIT URL? Or the common name?

In the dependency section, you would put the following:

- plugin repository name (instead of using a short name, we use the repository name, so 'fpp-matrixtools')
- Linux OS package name (ie, 'vorbis-tools' if you need the vorbis tools package installed)
- FPP Script repository name (ie, 'Control/StartEffectLooping.sh' if you need the StartEffectLooping script)

To make things simpler, we will always clone the git repo into a subdir that is the name of the repo, so instead of the 'short name' in pluginData.inc.php, we have a 'repoName'.  The folder name in /home/fpp/media/plugins will always be the name we use to refer to the plugin internally.  The one case this might be off is if someone makes a new plugin locally and the folder name disagrees with the repoName specified in the folders pluginInfo.json file.  But if that plugin were added to the list and installed later, it would be installed in a folder named using the repoName which is the git repository name.

If you don't need any scripts installed, then you can leave out the scripts section.  If you don't need any dependencies at all, you can leave out the whole dependencies section.  The 'versions' section is required though since it lists the branch to use.  If your package is simple enough to be compatible with all FPP versions, you can use 0 for the min and max versions.  If there is no minimum version, use 0.  If there is no maximum version, use 0.

Instead of pluginData.inc.php, we have fpp/js/pluginList.js which contains a JavaScript array definition which contains the list of available plugins.  The list contains two things.
 First is the repoName which would match the repoName in the plugin's pluginInfo.json file and second is a link to the plugin's pluginInfo.json file.  We wouldn't keep any other info about the plugin in the FPP git anymore, everything would be loaded from the plugin's pluginInfo.json in the plugin's git repository or from a locally installed plugin's pluginInfo.json file under /home/fpp/media/plugins/PLUGINRepoName/pluginInfo.json.  So that implies one more thing.  In the plugin's git repository, the pluginInfo.json file must be in the top level directory so that it is in the proper place once the repo is cloned under /home/fpp/media/plugins.  If the plugin author uses multiple branches then there would actually be multiple copies of pluginInfo.json.  The version inside a branch would really only need to know about that branch, but the main one linked to from FPP's pluginList.js would need to list all versions and branches.

Title: Re: FPP v2.x plugin integration
Post by: CaptainMurdoch on January 18, 2019, 04:20:04 PM
I pushed the new code to the master branch.  Most details are in the commit log https://github.com/FalconChristmas/fpp/commit/4d8dd95 (https://github.com/FalconChristmas/fpp/commit/4d8dd95), but the format of the pluginInfo.json file is in the fpp-plugin-Template repo at https://github.com/FalconChristmas/fpp-plugin-Template (https://github.com/FalconChristmas/fpp-plugin-Template)

To Do items still:

- Update installer to install dependency scripts/plugins/packages
- Add a 'Check for updates' button and enable updating plugins.  Rather than going out and checking 15-20 remote git repositories every time we load the page, I plan on making the 'check for updates' button run 'git fetch' in the local plugin directories to see if there are any updates.  This will use git to cache the updates locally and then the user could opt to upgrade a single plugin or all plugins.

I already added pluginInfo.json files for the fpp-vastfmt and big-green-button plugins which are in the FalconChristmas org.  In order for other plugins to start showing up, they will need pluginInfo.json files added to their repository and then a line added to fpp/js/pluginList.js to point to the pluginInfo.json file.

Let me know what you think or if you see anything that needs to be changed.

It doesn't have to be done now, but eventually I'd like to update the fpp-plugin-Template plugin to add logic to allow cloning the template into a new plugin.  The idea is that a user could make  new git repository, then go into the Template plugin's config page and enter the git repository URL and hit a button to 'clone' the template plugin.  The clone script would "git clone" the user's empty git repository into /home/fpp/media/plugins then copy the required files such as the pluginInfo.json, menu.inc, scripts, etc. from the template into the new plugin directory.  The 'clone' form could prompt for a plugin name, author, description, etc. and put those into the new pluginInfo.json file.
Title: Re: FPP v2.x plugin integration
Post by: CaptainMurdoch on January 18, 2019, 10:29:04 PM
One more change.

I'm thinking now that it would be best if the dependencies were under the versions list.  Since some versions might not have the same dependencies as others.

here's the current copy in fpp-plugin-Template:

Code: [Select]
{
    "repoName": "fpp-plugin-Template",
    "name": "Template Plugin for FPP Plugin developers",
    "author": "John Doe (jdoe)",
    "description": "This template plugin is designed to make it easier for plugin authors to create new FPP Plugins.  You can manually clone the git repository or install the Template Plugin and then go to the plugin's config page and use the form to copy the template into a new plugin directory.",
    "homeURL": "https://github.com/FalconChristmas/fpp-plugin-Template",
    "srcURL": "https://github.com/FalconChristmas/fpp-plugin-Template.git",
    "bugURL": "https://github.com/FalconChristmas/fpp-plugin-Template/issues",
    "versions": [
        {
            "minFPPVersion": 2.0,
            "maxFPPVersion": 0,
            "branch": "master",
            "allowUpdates": 1,
            "sha": "",
            "dependencies": {
                "plugins": [
                    "fpp-plugin-CoolPlugin1",
                    "fpp-plugin-CoolPlugin2"
                ],
                "packages": [
                    "system-package-name1",
                    "system-package-name2"
                ],
                "scripts": [
                    "Control/script-repository-script1",
                    "PixelOverlay/script-repository-script2"
                ]
            }
        }
    ]
}
Title: Re: FPP v2.x plugin integration
Post by: jcross on January 19, 2019, 01:28:25 AM
One more change.

I'm thinking now that it would be best if the dependencies were under the versions list.  Since some versions might not have the same dependencies as others.

here's the current copy in fpp-plugin-Template:

Code: [Select]
{
    "repoName": "fpp-plugin-Template",
    "name": "Template Plugin for FPP Plugin developers",
    "author": "John Doe (jdoe)",
    "description": "This template plugin is designed to make it easier for plugin authors to create new FPP Plugins.  You can manually clone the git repository or install the Template Plugin and then go to the plugin's config page and use the form to copy the template into a new plugin directory.",
    "homeURL": "https://github.com/FalconChristmas/fpp-plugin-Template",
    "srcURL": "https://github.com/FalconChristmas/fpp-plugin-Template.git",
    "bugURL": "https://github.com/FalconChristmas/fpp-plugin-Template/issues",
    "versions": [
        {
            "minFPPVersion": 2.0,
            "maxFPPVersion": 0,
            "branch": "master",
            "allowUpdates": 1,
            "sha": "",
            "dependencies": {
                "plugins": [
                    "fpp-plugin-CoolPlugin1",
                    "fpp-plugin-CoolPlugin2"
                ],
                "packages": [
                    "system-package-name1",
                    "system-package-name2"
                ],
                "scripts": [
                    "Control/script-repository-script1",
                    "PixelOverlay/script-repository-script2"
                ]
            }
        }
    ]
}


I was thinking about a few items but you captured most of them in recent updates and others (like the ability for different repos for different hardware (pi/bbb,etc)) likely wouldn't be a good idea as differences likely should be handled in the plugin code.


I have added the pluginInfo.json file to the fpp-after-hours plugin repo.


I'm interested in seeing how the package dependencies part works out.
When a plugin is uninstalled will fpp eventually remove dependencies that are no longer required by any plugins?


Great work on this! I'm really happy to see this work going into plugin management.


Update: Just updated my dev box and the Plugin menu item is no longer clickable :)
Title: Re: FPP v2.x plugin integration
Post by: Bshaver on January 19, 2019, 09:45:06 AM
Chris:


This line: [/size]In order for other plugins to start showing up, they will need pluginInfo.json files added to their repository and then a line added to fpp/js/pluginList.js to point to the pluginInfo.json file.


This is expecting that we have to have an admin check in the line to the plugin repository. The idea to have the GIT URL from a repository that the user wants to add put it in there, and click "ADD" or something like that would do this action for them.  Is that in the works still. This would not require any user to wait for one of the admins that know how to check in the plugin code to get new features...

Title: Re: FPP v2.x plugin integration
Post by: Bshaver on January 19, 2019, 09:47:16 AM
Sorry the font size... the line in your post that says the url to the pluign has to be added to the .js file.  sorry i could not post.
Title: Re: FPP v2.x plugin integration
Post by: CaptainMurdoch on January 19, 2019, 10:16:11 AM
I have added the pluginInfo.json file to the fpp-after-hours plugin repo.

I'm interested in seeing how the package dependencies part works out.
When a plugin is uninstalled will fpp eventually remove dependencies that are no longer required by any plugins?

Update: Just updated my dev box and the Plugin menu item is no longer clickable :)

I haven't thought about cleaning up package dependencies.  I don't know that that is a huge deal unless a package says it wants to install libreoffice or something huge, and even then it's not that important given the size of the microSD.

I added your plugin to js/pluginList.js, but this reminded me of another ToDo.  I need to update the version compare logic to understand that 2.1150 is greater than 2.3.  I ran into this while testing something with a plugin the other day and forgot to write it down.  I'll try to get that fixed tonight.  For now, that means that your plugin shows up in the incompatible section. :(

For the menu, there is no 'plugin' menu item anymore.  The existing item was renamed to 'Plugin Manager' and there is the a 'Plugins' divider in the menu between the regular FPP menu entries at the top of the menu and the plugin menu entries at the bottom of the menu.  I just pushed a change to make this divider stand out a little more.  If you guys think we don't need it, I can remove it totally, but I was thinking that it might make it clearer which were plugins and which weren't.
Title: Re: FPP v2.x plugin integration
Post by: CaptainMurdoch on January 19, 2019, 10:23:24 AM
This line: In order for other plugins to start showing up, they will need pluginInfo.json files added to their repository and then a line added to fpp/js/pluginList.js to point to the pluginInfo.json file.

This is expecting that we have to have an admin check in the line to the plugin repository. The idea to have the GIT URL from a repository that the user wants to add put it in there, and click "ADD" or something like that would do this action for them.  Is that in the works still. This would not require any user to wait for one of the admins that know how to check in the plugin code to get new features...

Yes, basically we need to know where to search for plugins at, so there still has to be something in the FPP repository unless we move the list of plugins into a shared repository that plugin authors can each edit.  If we do that, we could retrieve the list from the shared repository.   The big difference between now and previous is that the plugin author can do pretty much anything to an existing plugin, the only thing they can't do is add a new plugin to the list that everyone sees.  I'm totally fine with moving this file to a different git repository and then granting access to that repository to make it easier for you to add new plugins to the list.  Do you think we should do that?

Once a plugin is in the list, updates don't require any changes on the FPP git side.  The plugin's pluginInfo.json file has the info about upgrades and other versions of the plugin and that pluginInfo.json file is in the plugin's repository, not the FPP repository.  This puts the plugin author in control of versions, description, changing URL's, changing the SHA for the default install version, etc., none of those require a change in the FPP repo.

The new plugin manager/installer page has a section right at the top to allow a user to install a plugin which is not in the official list in the FPP repository.  Attached is a screenshot.
Title: Re: FPP v2.x plugin integration
Post by: Bshaver on January 19, 2019, 10:38:45 AM
Ok - Thanks. That achieves what I was looking for. Thank you. This would allow an author to TEST the install capabilities of a plugin as well without the publishing to the main Plugin list. 


Agreed with a note somewhere that "If you do not see the plugin that you are looking for, you can install it manually "HERE...".


I dont want to break something by editing a file and checking it in and breaking something. I did that once... :( . But the ability to have something listed, or moderated using an ISSUES list on GitHub, where the url to the pluginInfo.json file can be posted there and those that are experienced, can add it to the REPO file.  the plugin install is Use at your own risk if it is not in the Main Repo list.


I have a good framework to continue. and I like the ability to clone the framework for new people.

Title: Re: FPP v2.x plugin integration
Post by: CaptainMurdoch on January 19, 2019, 11:27:08 AM
I dont want to break something by editing a file and checking it in and breaking something. I did that once... :( . But the ability to have something listed, or moderated using an ISSUES list on GitHub, where the url to the pluginInfo.json file can be posted there and those that are experienced, can add it to the REPO file.  the plugin install is Use at your own risk if it is not in the Main Repo list.

I made a note to move the pluginList.js to another repository we can share out to more people.  That will also give us a separate github issues tracker for adding in requests for updating the list.

I also added some more items to my ToDo for this this morning.  I am going to move the install/uninstall/info logic to endpoints in the new REST API.  To install a plugin, you pass the plugin's pluginInfo.json,  to delete, you issue a DELETE call to /api/plugin/:PLUGINREPONAME, etc..  I haven't hooked up the "updates are pending" and "upgrade plugin X" code yet, so I may as well do it through the API instead of fppjson.php.

I changed the text at the top of the page to:  "If you do not see the plugin you are looking for, you can manually add a plugin to the list by providing the URL for the plugin's pluginInfo.json file below and clicking the 'Retrieve Plugin Info' button:"
Title: Re: FPP v2.x plugin integration
Post by: jcross on January 19, 2019, 02:19:16 PM
What about building a simple ui editor on this site that allows developers to add/modify the json in the repo without having to manually edit the file... Or just host that json here instead of github?  The script could also validate endpoints and such before making the changes.

And I see my duh moment with the plugin manager option on the menu.
Title: Re: FPP v2.x plugin integration
Post by: CaptainMurdoch on January 19, 2019, 04:08:53 PM
What about building a simple ui editor on this site that allows developers to add/modify the json in the repo without having to manually edit the file... Or just host that json here instead of github?  The script could also validate endpoints and such before making the changes.

I think you guys are overcomplicating it a little.  :) The pluginList.js file is just a simple javascript array.  If a plugin author can't edit the array to add a new line, then I'm not sure how much I trust the plugin they are creating. :)

Here's the current file:

Code: [Select]
var pluginList = [
    [ 'fpp-BigButtons', 'https://raw.githubusercontent.com/FalconChristmas/fpp-BigButtons/master/pluginInfo.json' ],
    [ 'fpp-vastfmt', 'https://raw.githubusercontent.com/FalconChristmas/fpp-vastfmt/master/pluginInfo.json' ],
    [ 'big-green-button', 'https://raw.githubusercontent.com/FalconChristmas/big-green-button/master/pluginInfo.json' ],
    [ 'fpp-matrixtools', 'https://raw.githubusercontent.com/cpinkham/fpp-matrixtools/master/pluginInfo.json' ],
    [ 'fpp-after-hours', 'https://raw.githubusercontent.com/jcrossbdn/fpp-after-hours/master/pluginInfo.json' ],
    [ 'fpp-plugin-Template', 'https://raw.githubusercontent.com/FalconChristmas/fpp-plugin-Template/master/pluginInfo.json' ]
];

Once you have tested your plugin installby manually specifying the location of the pluginInfo.json file at the top of the plugin manager page, then you just need to edit the pluginList.js file to add a line and reload the plugin manager.  If the page doesn't work, then you may have a typo in the pluginList.js file.  If the page does work and shows your new plugin, then all is good.

One other thing about the plugin list.  The plugin manager page loads the pluginInfo.json files by firing off ajax calls.  So the order in the pluginList.js file doesn't necessarily govern the order on the page, whichever pluginInfo.json file loads first gets listed first in the array.  I thought about preallocating entries in the table, but I don't know which section to put the plugin in until the pluginInfo.json file is returned, so things would get a bit complicated.  I put the installed plugins at the top because those are likely of most interest with installable ones next and then incompatible plugins.
Title: Re: FPP v2.x plugin integration
Post by: jcross on January 19, 2019, 04:18:42 PM
Quote
I think you guys are overcomplicating it a little.  :) The pluginList.js file is just a simple javascript array.  If a plugin author can't edit the array to add a new line, then I'm not sure how much I trust the plugin they are creating. :)


lol, yup.  In my day job I write software for end users so always try to make it dummy proof.  Since this will be developers making the edits there "shouldn't" be issues as long as the test plan you mentioned is followed.
Title: Re: FPP v2.x plugin integration
Post by: CaptainMurdoch on January 19, 2019, 05:27:26 PM
Let me know if I am missing something, I am trying to make it easier on both plugin authors and plugin users.

I started work on adding the REST endpoints today so I should have the update code hooked up tonight or tomorrow hopefully.
Title: Re: FPP v2.x plugin integration
Post by: Bshaver on January 19, 2019, 05:33:40 PM
I'm going to switch one of my VMs to the Dev branch to see this in action  and do some work on some of my plugins to re-install them.
Title: Re: FPP v2.x plugin integration
Post by: CaptainMurdoch on January 20, 2019, 12:47:14 PM
OK, I moved the pluginList to its own separate git repository.  This also has the advantage that users don't have to pull in the latest FPP updates to get the updated plugin list.  In the process, I converted it to a JSON file instead of JavaScript.  The only real difference as far as plugin authors are concerned is that the file uses double quotes instead of single quotes around the strings.  The file is in a new 'fpp-pluginList' git repository which can be shared for admin.

Here's the current pluginList.json file in the repository:

https://github.com/FalconChristmas/fpp-pluginList/blob/master/pluginList.json (https://github.com/FalconChristmas/fpp-pluginList/blob/master/pluginList.json)

I also converted the plugin manager page to load the installed plugin list and installed pluginInfo.json files via the new API calls and added the calls to the API help page.  I'm going to try to get the other functions (install/uninstall/upgrade) hooked up tonight and fix the version comparison issue.
Title: Re: FPP v2.x plugin integration
Post by: CaptainMurdoch on January 20, 2019, 05:21:08 PM
OK, one more change.

Put the min/max version numbers in pluginInfo.json in quotes.  This helps fix the issue of comparing 1.1 vs 1.10.  If we use just a float in JSON, those both will get converted to 1.1 in JavaScript.  If we embed them in quotes, then we can compare them.  I created a Javascript helper function CompareFPPVersions() to compare two version strings so that the code understands that v1.9 is less than v1.10.  If the min/max version number is actually a number in the json, the script converts it to a string, but it is best to enter these as a string to begin with so we don't have issues with trailing zeroes being dropped.

Also, if you have a plugin that is compatible with v1.x, you can put the min version as 1.0 and the max as 1.9999.  In the master branch, the version shows up as 2.1xxx where xxx is the commit number after the last tag, so using 2.9999 would catch all v2.x releases along with the master branch.
Title: Re: FPP v2.x plugin integration
Post by: CaptainMurdoch on January 22, 2019, 06:07:36 PM
OK, I pushed some more code to this tonight.  Updating a plugin via the UI now works as long as the plugin allows.

I think I'm pretty much done with most of these changes for now.  I can install the Viewer Control plugin by manually providing the pluginInfo.json URL at the top of the Plugin Manager so will probably shift some focus back to that and start getting some input on the plugin and web site from some alpha/beta testers.

Let me know if you see any issues or are ready to get write access to the pluginList.json file in the other repository. :)
Title: Re: FPP v2.x plugin integration
Post by: jcross on January 22, 2019, 09:37:39 PM
OK, I pushed some more code to this tonight.  Updating a plugin via the UI now works as long as the plugin allows.

I think I'm pretty much done with most of these changes for now.  I can install the Viewer Control plugin by manually providing the pluginInfo.json URL at the top of the Plugin Manager so will probably shift some focus back to that and start getting some input on the plugin and web site from some alpha/beta testers.

Let me know if you see any issues or are ready to get write access to the pluginList.json file in the other repository. :)




Just checking out your changes.  I saw the After Hours plugin showing up as available (it was already installed on that pi) but when I clicked install I got the message "ERROR: The (fpp-after-hours) plugin is already installed".  So I manually removed it and installed it again using the UI.  It installed and showed up on the list properly.  I then made a copy, uninstalled it from the UI and moved the copy back into the plugins directory and it showed up so it must have been in a strange state on my end (this was the dev pi) since I cannot reproduce it again.


-The system package dependencies did not install (don't know if they are supposed to or if this is just for information in the pluginInfo.json file??)
-adding a custom url and clicking Retrieve Plugin Info keeps duplicating entries in the list, however, the duplicates are removed on page refresh so no real issue there.


Great work!
Oh and I may as well make the request to get access to the pluginList.json in that new repo:)
Title: FPP v2.x plugin integration
Post by: CaptainMurdoch on January 22, 2019, 09:48:52 PM
I can add something to the UI to make it so that it won’t list an item twice if it is already found.

The dependency code isn’t hooked up yet, I will probably work on that next unless other issues are found.

I think the error you received the first time may be something only looking for a directory and not the pluginInfo.json file.  I will double check that.
Title: Re: FPP v2.x plugin integration
Post by: ghormann on January 23, 2019, 05:52:59 PM
Going forward, where (besides the code) is going to be the best spot to document how authors should develop plugins?



Title: Re: FPP v2.x plugin integration
Post by: CaptainMurdoch on January 23, 2019, 08:02:45 PM
Going forward, where (besides the code) is going to be the best spot to document how authors should develop plugins?

I’m thinking of having a lot of this in the template plugin.  This way if you want to create a new plugin, you just install the template plugin, use its “clone” button to make a new plugin from the template, and then go in and edit existing PHP files, stub functions, and scripts.  We can have some form of docs as well.  This can go in an appendix to the FPP manual or in a separate doc.
Title: Re: FPP v2.x plugin integration
Post by: CaptainMurdoch on January 23, 2019, 08:05:27 PM
I can add something to the UI to make it so that it won’t list an item twice if it is already found.

I added some code to remove any existing item in the list if you try to re-add the same item.  This fixes the issue and also lets you load a remote pluginInfo.json for a locally installed plugin or reload the pluginInfo.json multiple times during development.
Title: Re: FPP v2.x plugin integration
Post by: Poporacer on January 24, 2019, 08:25:47 AM
Because we are working on an updated FPP manual, I plan on putting the information about plugins/development in a separate chapter.
Title: Re: FPP v2.x plugin integration
Post by: ghormann on January 24, 2019, 07:47:08 PM
I’m thinking of having a lot of this in the template plugin.  This way if you want to create a new plugin, you just install the template plugin, use its “clone” button to make a new plugin from the template, and then go in and edit existing PHP files, stub functions, and scripts.  We can have some form of docs as well.  This can go in an appendix to the FPP manual or in a separate doc.


The template is a good idea.   Is the FPP Manual still being maintained?
Title: Re: FPP v2.x plugin integration
Post by: CaptainMurdoch on January 24, 2019, 07:48:33 PM
Is the FPP Manual still being maintained?

The manual hasn't been updated in a while, but Poporacer is stepping up to help us try to get it updated for FPP v2.x and back into shape, including adding information about creating plugins.
Title: Re: FPP v2.x plugin integration
Post by: jcross on January 27, 2019, 10:51:00 AM
Just looking at the template on git.  There is a help.php file but I thought the help file needed to be in help/<plugin_name>.php

Title: Re: FPP v2.x plugin integration
Post by: CaptainMurdoch on January 27, 2019, 11:48:01 AM
Just looking at the template on git.  There is a help.php file but I thought the help file needed to be in help/<plugin_name>.php

The help directory is where help files for the context sensitive help reside.  That doesn't mean all help files have to be in that directory, but it would probably be best.  Clicking the "Press F1 for Help" or pressing F1 loads those help/* pages into a popup. 

The menu.inc file in the template plugin references the plugin's help.php page and also shows you aren't limited to a single menu entry per plugin.  I just pushed an update to the template plugin to add context sensitive help pages for the content.php, output.php, and status.php pages and also move the generic help.php example into that subdir as well and update the menu.inc file.

Thanks for catching this.  I don't think I help pages for my plugins or at least it's been so long I don't remember making them. :)
Title: Re: FPP v2.x plugin integration
Post by: jcross on January 27, 2019, 11:51:02 AM
Just looking at the template on git.  There is a help.php file but I thought the help file needed to be in help/<plugin_name>.php

The help directory is where help files for the context sensitive help reside.  That doesn't mean all help files have to be in that directory, but it would probably be best.  Clicking the "Press F1 for Help" or pressing F1 loads those help/* pages into a popup. 

The menu.inc file in the template plugin references the plugin's help.php page and also shows you aren't limited to a single menu entry per plugin.  I just pushed an update to the template plugin to add context sensitive help pages for the content.php, output.php, and status.php pages and also move the generic help.php example into that subdir as well and update the menu.inc file.

Thanks for catching this.  I don't think I help pages for my plugins or at least it's been so long I don't remember making them. :)


okay thanks, I'll add this note to the toolbox :)