Jump to content

Error showing Config-Page


Recommended Posts

Posted

Hello,

I'm started to write a plugin for MB. Unfortunately I hang at the beginning with creating the configuration page. 

My current sources and the server log is attached as a zip. 

Can someone give me a hint please?

Yours Tolotos

 

ConfigpageError.zip

Posted

i'm not able to look at that now but one thing is make sure your html page is an embedded resource

Posted (edited)

I found the hint with the embedded source in an older thread. But this was not the complete solution for my problem. 

Edited by Tolotos
Posted

You need some javascript on your config page. You can check some examples on the github pages...

Posted

I added this:

 

<script type="text/javascript">
 
            var TVHclientConfigurationPageVar = {
                pluginUniqueId: "9574ac12-bf23-49bc-949a-924f23bfa48f"
            };
 
            $('.TVHclientConfigurationPage').on('pageshow', function (event) {
                Dashboard.showLoadingMsg();
                var page = this;
 
                ApiClient.getPluginConfiguration(TVHclientConfigurationPageVar.pluginUniqueId).done(function (config) {
                    $('#txtTVH_ServerName', page).val(config.TVH_ServerName || "");
                    $('#txtHTTP_Port', page).val(config.HTTP_Port || "9981");
                    $('#txtHTSP_Port', page).val(config.HTSP_Port || "9982");
                    $('#txtUserName', page).val(config.Username || "");
                    $('#txtPassword', page).val(config.Password || "");
                    $('#txtConnectionTimeout', page).val(config.ConnectionTimeout || "30");
                    $('#txtResponseTimeout', page).val(config.ResponseTimeout || "15");
                    
                    Dashboard.hideLoadingMsg();
                });
            });
 
            $('.TVHclientConfigurationForm').on('submit', function (e) {
                Dashboard.showLoadingMsg();
                var form = this;
                ApiClient.getPluginConfiguration(TVHclientConfigurationPageVar.pluginUniqueId).done(function (config) {
                    config.TVH_ServerName = $('#txtTVH_ServerName', form).val();
                    config.HTTP_Port = $('#txtHTTP_Port', form).val();
                    config.HTSP_Port = $('#txtHTSP_Port', form).val();
                    config.Username = $('#txtUserName', form).val();
                    config.Password = $('#txtPassword', form).val();
                    config.ConnectionTimeout = $('#txtConnectionTimeout', form).val();
                    config.ResponseTimeout = $('#txtResponseTimeout', form).val();
                    ApiClient.updatePluginConfiguration(TVHclientConfigurationPageVar.pluginUniqueId, config).done(Dashboard.processPluginConfigurationUpdateResult);
                });
                // Disable default form submission
                return false;
            });
           
 
        </script>
 
Without an change of the error. 
 
I think the error is here:
Stream result = GetType().Assembly.GetManifestResourceStream("MediaBrowser.Plugins.TVHclient.configPage.html");
 
The configPage.html is flat to all other *.cs files. 
Is the above resource path correct?
 
Tolotos
Posted

Hi,

I got it. It was an typo in the properties settings of assembly-name and default-namespace.

Tolotos

Posted

Great news. :)

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...