Jump to content

Notification plugin is not recognized by Emby server


Haxy

Recommended Posts

Hi all,

 

I am creating a new notification plugin using sms service, my base for this plugin is Pushbullet notification plugin.

 

After upload dll with my plugin can't see it in my Emby server notification menu option, also can see plugin thumb in installed plugins view.

 

First question: Are there any restricion for plugin thumb? Size, format etc? Currently can't make it work, some code:

I am using this image for thumb: https://imgur.com/BLRBqqY

public Stream GetThumbImage()
        {
            var type = GetType();
            return type.Assembly.GetManifestResourceStream(type.Namespace + ".thumb.png");
        }

        public ImageFormat ThumbImageFormat
        {
            get
            {
                return ImageFormat.Png;
            }
<Project Sdk="Microsoft.NET.Sdk">

  <PropertyGroup>
    <TargetFrameworks>netstandard2.0;</TargetFrameworks>
    <AssemblyVersion>0.0.1.0</AssemblyVersion>
    <FileVersion>0.0.1.0</FileVersion>
  </PropertyGroup>

 <ItemGroup>
   <None Remove="thumb.png" />
 </ItemGroup>

 <ItemGroup>
   <EmbeddedResource Include="thumb.png" />
 </ItemGroup>

  <ItemGroup>
    <PackageReference Include="mediabrowser.server.core" Version="4.3.0.12" />
  </ItemGroup>

</Project>

Second question: How to make my plugin enabled for notification? So far I don't use any configuration html file so I hardcoded all values:

public class PluginConfiguration : BasePluginConfiguration
    {
        public SmsOptions[] Options { get; set; }

        public PluginConfiguration()
        {
            Options = new SmsOptions[] { };
        }
    }

    public class SmsOptions
    {
        public bool Enabled { get; }
        public string PhoneNumber { get; }
        public string ApiKey { get; }
        public string MediaBrowserUserId { get; }

        public SmsOptions()
        {
            Enabled = true;
            PhoneNumber = "*************";
            ApiKey = "****************";
            MediaBrowserUserId = "d77dc6f472964727831b8e81c15025da";    //My user Id in Emby server
        }
    }

I think the problem is in this line but dont know why (can't attach debugger because I use docker container on another machine):

        private static SmsOptions GetOptions(User user)
        {
            return Plugin.Instance.Configuration.Options
                .FirstOrDefault(i => string.Equals(i.MediaBrowserUserId, user.Id.ToString("N"), StringComparison.OrdinalIgnoreCase));
        }

Thanks

Link to comment
Share on other sites

Make sure you're using a nuget version that is equal or less than the version of the server you are testing with.

Link to comment
Share on other sites

Someone will have to dig through your code to find out what is wrong. Perhaps @@chef can help with that. Please do us a favor though and copy exactly from existing plugins.

Link to comment
Share on other sites

god damn it I figured it out.

 

Why the newest version of nuget package server.core is not marked as beta!?

Current stable version emby server is 4.2.1.0 so please mark proper version of nuget server.core as stable (last: 4.2.40)

Link to comment
Share on other sites

It was inadvertently pushed as non-beta. You can always double check this by comparing the version numbers as I mentioned above.

Link to comment
Share on other sites

httpRequest.SetPostData metod accept only Dictionary<string, string>

 

how to send json like this?:

{
    "messages": [
        {
            "channel": "sms",
            "to": "+111111111",
            "content": "Test SMS Message Text"
        }
    ]
}

Tried serialaize json after escaping using IJsonSerializer but it can;t handle it:

var json = "{\"messages\": [{\"channel\": \"sms\",\"to\": \"+11111111\",\"content\": \"Test SMS Message Text\"}]}";
var parameters = _json.DeserializeFromString<Dictionary<string, string>>(json);
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...