mutu310 70 Posted January 14, 2017 Posted January 14, 2017 Hi, I'm building a plugin that would show a channel but the data wouldn't be retrieved from a web service but rather it would show data that was already processed in the past. Thus, the plugin would need to save multiple ChannelItemInfo (?) items permanently. What would be the best course of action, using the configuration? Also, rather than using a channel, how possible would it be to show the data under 'Suggestions' for movies? The aim of the plugin is to show movie suggestions, after all.
Luke 42077 Posted January 14, 2017 Posted January 14, 2017 You can get the data from wherever you like. You're just going to have to find a place to store it. Which will probably involve using plugin.XXXPath directory (forget the exact names), and just dumping some data to a json file.
mutu310 70 Posted January 14, 2017 Author Posted January 14, 2017 You can get the data from wherever you like. You're just going to have to find a place to store it. Which will probably involve using plugin.XXXPath directory (forget the exact names), and just dumping some data to a json file. @@Luke What if I add a property of type ChannelItemResult under the PluginConfiguration, would that work?
Luke 42077 Posted January 14, 2017 Posted January 14, 2017 the plugin config is using xml serialization. it may have trouble with some complex object structures. but if it works then yes that's fine.
mutu310 70 Posted January 14, 2017 Author Posted January 14, 2017 (edited) the plugin config is using xml serialization. it may have trouble with some complex object structures. but if it works then yes that's fine. @@Luke I just tried it and unfortunately it doesn't There was an error reflecting type 'MediaBrowser.Plugins.BlurN.Configuration.PluginConfiguration'. Edited January 14, 2017 by mutu310
mutu310 70 Posted January 14, 2017 Author Posted January 14, 2017 One small question... I'm trying to add a Logo for the channel. I've done the following: Create a folder called Images and saved a Logo.jpg inside, added to project and set as an embedded resource. Then I created these 2 methods inside my Channel.cs: private Task<DynamicImageResponse> GetImage(ImageType type, string imageFormat) { var path = String.Format("{0}.Images.{1}.{2}", GetType().Namespace, type, imageFormat); return Task.FromResult(new DynamicImageResponse { Format = ImageFormat.Jpg, HasImage = true, Stream = GetType().Assembly.GetManifestResourceStream(path) }); } public Task<DynamicImageResponse> GetChannelImage(ImageType type, CancellationToken cancellationToken) { switch (type) { case ImageType.Logo: return GetImage(type, "jpg"); default: throw new ArgumentException("Unsupported image type: " + type); } } I am getting the following error: 'Type' does not contain a definition for 'Assembly' and no extension method 'Assembly' accepting a first argument of type 'Type' could be found. In fact I can't do a GetType().Assembly Any clue what's missing please?
mutu310 70 Posted January 14, 2017 Author Posted January 14, 2017 (edited) I created a GitHub repository at https://github.com/MarkCiliaVincenti/MediaBrowser.Channels.BlurN. The problem in the previous post still persists. I got it to compile by changing: Stream = GetType().Assembly.GetManifestResourceStream(path) to: Stream = GetType().GetTypeInfo().Assembly.GetManifestResourceStream(path) This way the code compiles, but I still don't get the image thumb for the channel home. Edited January 14, 2017 by mutu310
mutu310 70 Posted January 15, 2017 Author Posted January 15, 2017 This problem is still pending. Could it be due to having this created as a "Class Library (portable)" as the instructions say? I downloaded the Emby.Channels repo and they seem to be normal class libraries.
mutu310 70 Posted January 15, 2017 Author Posted January 15, 2017 I found out that it's actually working with Stream = GetType().GetTypeInfo().Assembly.GetManifestResourceStream(path) I just needed to refresh the channel. Is there a means to force users to refresh it please, for example if one was to update the images?
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