Haxy 9 Posted November 15, 2019 Share Posted November 15, 2019 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 More sharing options...
Haxy 9 Posted November 15, 2019 Author Share Posted November 15, 2019 @@Luke Pls help so I can deliver new plugin for community Link to comment Share on other sites More sharing options...
Luke 37063 Posted November 15, 2019 Share Posted November 15, 2019 Did you check the server log, and also compare to other notification plugins? Link to comment Share on other sites More sharing options...
Haxy 9 Posted November 15, 2019 Author Share Posted November 15, 2019 Only one line in log: 2019-11-15 18:21:41.795 Info App: Loading Haxy.Plugins.SmsNotifications, Version=0.0.1.0, Culture=neutral, PublicKeyToken=null from /config/plugins/Haxy.Plugins.SmsNotifications.dll I compared source code with other plugins and my base is Pushbullet plugin source code: https://github.com/MediaBrowser/Pushbullet Link to comment Share on other sites More sharing options...
Luke 37063 Posted November 15, 2019 Share Posted November 15, 2019 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 More sharing options...
chef 3745 Posted November 15, 2019 Share Posted November 15, 2019 I have noticed that if I use Server.Core 4.2.0.20 I can build plugins without issue. Link to comment Share on other sites More sharing options...
Haxy 9 Posted November 15, 2019 Author Share Posted November 15, 2019 I pasted my csproj so you can see i am using the newest version of nuget package, My server is in the newest version as well Link to comment Share on other sites More sharing options...
Luke 37063 Posted November 15, 2019 Share Posted November 15, 2019 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 More sharing options...
Haxy 9 Posted November 15, 2019 Author Share Posted November 15, 2019 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 More sharing options...
Luke 37063 Posted November 15, 2019 Share Posted November 15, 2019 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 More sharing options...
Haxy 9 Posted November 16, 2019 Author Share Posted November 16, 2019 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 More sharing options...
Luke 37063 Posted November 16, 2019 Share Posted November 16, 2019 There's other properties you can use to set the body contents so you'll have to do that. Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now