Jump to content

Cant get "getPluginConfiguration" to work in my plugin


VicMoore

Recommended Posts

VicMoore

Good morning...

I am trying to use:

ApiClient.getPluginConfiguration(pluginId).then(async function (config) { }

where pluginId is the GUID from the plugin,

to save my plugins configuration. I can't get it to work.

I set up my plugin.cs as follows:

    public class Plugin : BasePlugin<PluginConfiguration>, IHasWebPages, IHasThumbImage, IHasTranslations
    {
        public static Plugin Instance { get; set; }

        public Plugin(IApplicationPaths applicationPaths, IXmlSerializer xmlSerializer) : base(applicationPaths,
        xmlSerializer)
        {
            Instance = this;
        }

Next I added PluginConfiguration.cs

namespace VirtualTVExample
{
    public class PluginConfiguration : BasePluginConfiguration
    {

        public PluginConfiguration()
        {

        }
    }
}

Then I tested the javascript code as follows:

            ApiClient.getPluginConfiguration(pluginId).then(async function (config) {
                console.log("===== get plugin configuration, config = ", config);

                config.tunerHostChannels = tunerHostChannels;                      //   <-------<<<<

                ApiClient.updatePluginConfiguration(pluginId, config).then((r) => {
                    console.log("===== save plugin config, r = " + r + ", config = ", config);
                });
            });

 

After executing the code above several times, the  getPluginConfiguration code never returns anything.

What am I doing wrong?

Vic

 

Link to comment
Share on other sites

It sounds as if you're diverting away from the example that I've given you. If you follow what i gave you, then you don't need to use plugin configuration. You can add any settings you wish to the tuner config.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...