bakes82 90 Posted September 16, 2023 Share Posted September 16, 2023 In the sample sdk projects the GenericEditDemo has a reference to a nuget thats not published so it wont compile, also the "templates" and docs dont talk about generating any UI stuff which I assume this generic edit demo is trying to simplify? @softworkz Link to comment Share on other sites More sharing options...
softworkz 3338 Posted September 16, 2023 Share Posted September 16, 2023 14 hours ago, bakes82 said: In the sample sdk projects the GenericEditDemo has a reference to a nuget thats not published so it wont compile, also the "templates" and docs dont talk about generating any UI stuff which I assume this generic edit demo is trying to simplify? @softworkz @bakes82- This project had accidentally slipped into the release SDK. GenericEdit is only supported in the beta server and with the beta SDK: https://betadev.emby.media/ Sorry for the confusion! Link to comment Share on other sites More sharing options...
bakes82 90 Posted September 16, 2023 Author Share Posted September 16, 2023 @softworkzSo where can I get the nuget so the code will compile lol .... Doesnt seem to be a pre-release. Link to comment Share on other sites More sharing options...
bakes82 90 Posted September 16, 2023 Author Share Posted September 16, 2023 The beta SDK references an unpublished nuget: Link to comment Share on other sites More sharing options...
bakes82 90 Posted September 16, 2023 Author Share Posted September 16, 2023 @softworkzI got it compile with the .38. Is there a way to select multi folders/file? I didnt want to make a custom select, when it seems like it would just be easier to extend the Folder/File pickers? Link to comment Share on other sites More sharing options...
softworkz 3338 Posted September 16, 2023 Share Posted September 16, 2023 (edited) 6 minutes ago, bakes82 said: Is there a way to select multi folders/file? Not from the picker. But you could create a list/repeated sub-view to which you can always add one more empty element which would allow to add another file (by opening the picker again). Edited September 16, 2023 by softworkz Link to comment Share on other sites More sharing options...
bakes82 90 Posted September 16, 2023 Author Share Posted September 16, 2023 Hows that work for "dynamic" selections, IE if you dont want to set a hard limit? Link to comment Share on other sites More sharing options...
softworkz 3338 Posted September 16, 2023 Share Posted September 16, 2023 The Demo Plugin has something which is pretty close to what you want: Link to comment Share on other sites More sharing options...
bakes82 90 Posted September 16, 2023 Author Share Posted September 16, 2023 Did I miss that some place lol? Link to comment Share on other sites More sharing options...
softworkz 3338 Posted September 16, 2023 Share Posted September 16, 2023 The path would be something like this: From the "Child Option" class, remove the title and the "Import Mode" selection Apply the Emby SDK Reference: AutoPostBackAttribute to the file path property, so you get a server roundtrip on each change At the server, change the items of the collection, so you provide always one additional (empty) item ("Child Option") Link to comment Share on other sites More sharing options...
softworkz 3338 Posted September 16, 2023 Share Posted September 16, 2023 Link to comment Share on other sites More sharing options...
bakes82 90 Posted September 16, 2023 Author Share Posted September 16, 2023 Kk, Ill give it a whirl Link to comment Share on other sites More sharing options...
softworkz 3338 Posted September 16, 2023 Share Posted September 16, 2023 Let me know how you get on and when you got any questions! Link to comment Share on other sites More sharing options...
softworkz 3338 Posted September 17, 2023 Share Posted September 17, 2023 I just noticed that there's a bug at the client side for which it doesn't dynamically change the item count. But here's an example for how it's supposed to work. Based in the example project,.... Change ChildOptionExample to this: namespace EmbyPluginUiDemo.Model { using System.Collections; using System.Collections.Generic; using System.ComponentModel; using Emby.Web.GenericEdit; using MediaBrowser.Model.Attributes; using IEditableObject = MediaBrowser.Model.GenericEdit.IEditableObject; public class ChildOptionExample : EditableOptionsBase { public override string EditorTitle => ""; [DisplayName("")] [EditFilePicker] [AutoPostBack("PostBack", nameof(File))] public string File { get; set; } } public class ChildOptionExampleCollection : List<ChildOptionExample>, IEditableObjectCollection, IEnumerable<ChildOptionExample>, IEnumerable { public ChildOptionExampleCollection() { } public ChildOptionExampleCollection(IEnumerable<ChildOptionExample> collection) : base(collection) { } public ChildOptionExampleCollection(int capacity) : base(capacity) { } IEnumerator<IEditableObject> IEnumerable<IEditableObject>.GetEnumerator() => (IEnumerator<IEditableObject>) this.GetEnumerator(); IEnumerator<ChildOptionExample> IEnumerable<ChildOptionExample>.GetEnumerator() => (IEnumerator<ChildOptionExample>) this.GetEnumerator(); IEnumerator IEnumerable.GetEnumerator() => (IEnumerator) this.GetEnumerator(); } } Change NestingPageView to this: namespace EmbyPluginUiDemo.UI.Nesting { using System.Threading.Tasks; using Emby.Media.Common.Extensions; using EmbyPluginUiDemo.Model; using EmbyPluginUiDemo.UIBaseClasses.Views; using MediaBrowser.Model.Plugins; using MediaBrowser.Model.Plugins.UI.Views; internal class NestingPageView : PluginPageView { public NestingPageView(PluginInfo pluginInfo) : base(pluginInfo.Id) { this.ContentData = new NestingUI(); } public NestingUI NestingUI => this.ContentData as NestingUI; public override bool IsCommandAllowed(string commandKey) { if (commandKey == "PostBack") { return true; } return base.IsCommandAllowed(commandKey); } public override Task<IPluginUIView> RunCommand(string itemId, string commandId, string data) { if (commandId == "PostBack") { this.NestingUI.Collection.RemoveAll(e => ((ChildOptionExample)e).File.IsNullOrEmpty()); this.NestingUI.Collection.Add(new ChildOptionExample()); return Task.FromResult((IPluginUIView)this); } return base.RunCommand(itemId, commandId, data); } } } And in NestingUI, change the Collection property to this: [DisplayName("Dynamic Collection of Child Options")] public ChildOptionExampleCollection Collection { get; set; } = new ChildOptionExampleCollection { new ChildOptionExample(), }; I'll try to get the client issue fixed asap. Link to comment Share on other sites More sharing options...
bakes82 90 Posted September 17, 2023 Author Share Posted September 17, 2023 The visibility toggle on Enum DisplayName titles seems broken [DisplayName("The list id from MDBList website")] [Description("This is found by hovering over the \"Create your Movie Filter\" button and looking at the ?list= parameter in the URL.")] [Required] [VisibleCondition(nameof(Enabled), SimpleCondition.IsTrue)] public int ListId { get; set; } [DisplayName("Type of items in the list")] [Required] [VisibleCondition(nameof(Enabled), SimpleCondition.IsTrue)] public ChannelListMediaType ListMediaType { get; set; } [DisplayName("Rating of channel")] [Required] [VisibleCondition(nameof(Enabled), SimpleCondition.IsTrue)] public ChannelParentalRating ChannelRating { get; set; } = ChannelParentalRating.Adult; Link to comment Share on other sites More sharing options...
softworkz 3338 Posted September 17, 2023 Share Posted September 17, 2023 2 hours ago, softworkz said: I'll try to get the client issue fixed asap. It's fixed now and the next SDK will have the demo plugin updated with a new tab which is showing this as a sample: GenericEditDynamicCollections.mp4 Link to comment Share on other sites More sharing options...
softworkz 3338 Posted September 17, 2023 Share Posted September 17, 2023 21 minutes ago, bakes82 said: The visibility toggle on Enum DisplayName titles seems broken Ah, right, the structure of the select element has changed. It will be fixed in the next update. Thanks Link to comment Share on other sites More sharing options...
softworkz 3338 Posted September 17, 2023 Share Posted September 17, 2023 The nuget version issue for the SDK plugins should be fixed as well now - for the next SDK update. Link to comment Share on other sites More sharing options...
bakes82 90 Posted September 17, 2023 Author Share Posted September 17, 2023 @softworkzWhat json serializer is used so I do the attribute for the mappings: [JsonProperty("imdb_id")] public string ImdbId { get; set; } Link to comment Share on other sites More sharing options...
softworkz 3338 Posted September 17, 2023 Share Posted September 17, 2023 15 minutes ago, bakes82 said: @softworkzWhat json serializer is used so I do the attribute for the mappings: ServiceStack.Text - Like everywhere in Emby. Link to comment Share on other sites More sharing options...
bakes82 90 Posted September 17, 2023 Author Share Posted September 17, 2023 @softworkzIm not sure if this is related to the nuget version, but the plugin values dont seem to persist on UI, unless you restart the server. IE I check a box, press save, the UI says saved, refresh the screen, box is unchcked, restart server, value on ui is now checked. I tested this on the plugin demo and my plug. Maybe its just late for me but something seems up Link to comment Share on other sites More sharing options...
softworkz 3338 Posted September 17, 2023 Share Posted September 17, 2023 (edited) 7 hours ago, bakes82 said: @softworkzIm not sure if this is related to the nuget version, but the plugin values dont seem to persist on UI, unless you restart the server. IE I check a box, press save, the UI says saved, refresh the screen, box is unchcked, restart server, value on ui is now checked. I tested this on the plugin demo and my plug. Maybe its just late for me but something seems up Which page of the demo plugin did you try with? It works for me on the first tab at least: When I change the checkboxes and refresh the page without saving, I get the check states from before. When I change the checkboxes and save, then refresh the page, I get saved check states. When I restart the server, the values are back to defaults (because the demo plugin does not persist those values). Do you mean a different view? Edited September 17, 2023 by softworkz Link to comment Share on other sites More sharing options...
bakes82 90 Posted September 17, 2023 Author Share Posted September 17, 2023 (edited) Well Im starting with a "basic" UI for now, I didnt think I need like a "page" and its like the values are saving, its just not reloading them? Maybe I missed an override someplace to load it? @softworkz public class PluginOptions : EditableOptionsBase { public override string EditorTitle => "MDBLists Channel MDBListsPlugin Options"; [DisplayName("MDBList Api Key")] [Description("Api key from MDBList website")] [Required] public string ApiKey { get; set; } [DisplayName("Channel 1")] public MdbListChannel Channel1 { get; set; } = new MdbListChannel(); } public class MdbListChannel: EditableOptionsBase { public override string EditorTitle => "Channel Configuration"; [DisplayName("Enable channel")] public bool Enabled { get; set; } = false; [DisplayName("Display name of the channel")] [Required] [VisibleCondition(nameof(Enabled), SimpleCondition.IsTrue)] public string ChannelName { get; set; } [DisplayName("The list id from MDBList website")] [Description("This is found by hovering over the \"Create your Movie Filter\" button and looking at the ?list= parameter in the URL, or by looking for listId in the page source.")] [Required] [VisibleCondition(nameof(Enabled), SimpleCondition.IsTrue)] public int ListId { get; set; } [DisplayName("Type of items in the list")] [VisibleCondition(nameof(Enabled), SimpleCondition.IsTrue)] public ChannelListMediaType ListMediaType { get; set; } = ChannelListMediaType.Movie; [DisplayName("Rating of channel")] [VisibleCondition(nameof(Enabled), SimpleCondition.IsTrue)] public ChannelParentalRating ChannelRating { get; set; } = ChannelParentalRating.Adult; } Edited September 17, 2023 by bakes82 Link to comment Share on other sites More sharing options...
softworkz 3338 Posted September 17, 2023 Share Posted September 17, 2023 Are you using BasePluginSimpleUI ? Link to comment Share on other sites More sharing options...
bakes82 90 Posted September 17, 2023 Author Share Posted September 17, 2023 @softworkzYes public class MDBListsPlugin : BasePluginSimpleUI<PluginOptions>, IHasThumbImage { /// <summary>The MDBListsPlugin ID.</summary> private readonly Guid _id = new Guid("E7CCDD69-8EC3-41EE-93C5-48CD12441933"); private readonly ILogger _logger; /// <summary>Initializes a new instance of the <see cref="MDBListsPlugin" /> class.</summary> /// <param name="applicationHost">The application host.</param> /// <param name="logManager">The log manager.</param> public MDBListsPlugin(IApplicationHost applicationHost, ILogManager logManager) : base(applicationHost) { _logger = logManager.GetLogger(Name); _logger.Info("My _mdbListsPlugin ({0}) is getting loaded", Name); } /// <summary>Gets the description.</summary> /// <value>The description.</value> public override string Description => "Generate channels from MDBLists"; /// <summary>Gets the unique id.</summary> /// <value>The unique id.</value> public override Guid Id => _id; /// <summary>Gets the name of the _mdbListsPlugin</summary> /// <value>The name.</value> public override sealed string Name => "MDBLists Channels"; /// <summary>Gets the thumb image format.</summary> /// <value>The thumb image format.</value> public ImageFormat ThumbImageFormat => ImageFormat.Png; /// <summary>Gets the plugin options.</summary> /// <returns>The plugin options.</returns> public PluginOptions GetPluginOptions() { return GetOptions(); } /// <summary>Gets the thumb image.</summary> /// <returns>An image stream.</returns> public Stream GetThumbImage() { var type = GetType(); return type.Assembly.GetManifestResourceStream(type.Namespace + ".ThumbImage.png"); } } 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