Chubby Arse 23 Posted November 2, 2014 Share Posted November 2, 2014 Hi all, I'm currently a Media Portal user that generally uses MP to record films and programs from Freeview and uses MB3 for remote playback (on devices other than the main media PC). I would appreciate the communities view on the acceptance and audience for implementing MP integration into the main MB3 interface. Semantically speaking a "Media Browser" wouldn't necessary have a place recording TV etc... so I wouldn't want to spend a great deal of time developing unless there would be a reasonable amount of interest. It struck me that integrating schedules and viewing of recorded TV shouldn't be a great deal of a problem and would give me a unified interface that I could use from anywhere. The components required would be (abstractly speaking - I've not yet dug into the APIs). - A set of interfaces for talking to any TV engine - IScheduleManager - IRecordedTvManager - IConfigurationProvider - .... - Implementations for MP1 / MP2 for the interfaces above (MP exposes an API I believe). - A MB3 REST interface to adapt and expose the data received from the TV interfaces - Finally, UI components to allow content to be viewed and schedules to be browsed. If the community think this kind of functionality would be embraced, then I will spend sometime looking into the viability (examining use cases and API interfaces for MP at least). There would be scope to : - Automatically archive movies (with metadata) and tv shows once recorded - Provide an "EPG Movie Guide" that displays in a cover flow the movies upcoming on the EPG (like WMC) - Create implementations for CouchPotato / MythTv etc... I welcome any comments / suggestions. THanks for reading. 3 Link to comment Share on other sites More sharing options...
Luke 37192 Posted November 2, 2014 Share Posted November 2, 2014 Welcome! I will be happy to give you all the help that you need on this. If you're not aware we do already support live tv although you can certainly help us improve it. Can you take a look at this interface? https://github.com/MediaBrowser/MediaBrowser/blob/master/MediaBrowser.Controller/LiveTv/ILiveTvService.cs This is the interface that live tv providers are expected to implement. We currently have three implementations - Argus, Next Pvr and Server Wmc. We have seen quite a few requests for a Media Portal based back-end though. So can you start by taking a look at that and letting me know what enhancements might be needed in order to fulfill your requirements? Thanks! 2 Link to comment Share on other sites More sharing options...
Chubby Arse 23 Posted November 4, 2014 Author Share Posted November 4, 2014 Thanks for the reply Luke. I've got my DEV environment set up, so I'm going to implement the bare minimum as a POC and once that looks good, I'll expand outwards from there. Cheers Link to comment Share on other sites More sharing options...
Luke 37192 Posted November 4, 2014 Share Posted November 4, 2014 Great, let me know if you need anything. You should take a look at the notes here on how to get setup for plugin development: https://github.com/MediaBrowser/MediaBrowser.Plugins You don't need the server source code just to do plugins but you can run it from source if you like. Link to comment Share on other sites More sharing options...
Chubby Arse 23 Posted November 4, 2014 Author Share Posted November 4, 2014 Cheers Luke, the prior art of the NextPVR looks like it will be a big help - I'm new to async / await so this will be good learning too. I followed the instructions here (but for VS2013 instead) and all I needed to do was remove and re-add the nuget packages and I was all sorted with a build-able project. Nice work. I'd like to use the System.Net.Http namespace to consume json services exposed by MediaPortal and it would also be useful to use Automapper to map data between the entities - what's the policy on external references and consuming / deploying them? Thanks Link to comment Share on other sites More sharing options...
ebr 14949 Posted November 4, 2014 Share Posted November 4, 2014 You'll want to avoid any additional references and dependencies but we should already have what you need. You just need to inject the dependencies to our interfaces in your ServerEntryPoint constructor. See here: Dependency injection You can get a handle to our Json serializer and also any network resources you should need. Specifically: IJsonSerializer and IhttpClient are what you would need. Link to comment Share on other sites More sharing options...
Luke 37192 Posted November 5, 2014 Share Posted November 5, 2014 in the server dashboard -> Live TV, do you see the plugin there? Link to comment Share on other sites More sharing options...
Chubby Arse 23 Posted November 5, 2014 Author Share Posted November 5, 2014 Apologies, I wasn't very clear. The plugin appears in the plugins screen and I am able to configure it, however it does not appear in the Live TV section. I added NextPVR (to check that something would work) and that appeared fine. I've since removed that and retried but still no luck. Link to comment Share on other sites More sharing options...
Luke 37192 Posted November 5, 2014 Share Posted November 5, 2014 So the live tv section does not appear at all, or it appears but is empty? i can test out your code later tonight. Link to comment Share on other sites More sharing options...
Chubby Arse 23 Posted November 5, 2014 Author Share Posted November 5, 2014 (edited) OK - I've created my plugin and so far I have the configuration page working and persisting settings. However, I've returned empty objects in my implementation of ILiveTvService - however it doesn't look like it's being picked up / recognised as a TV Service and being displayed in the LiveTv configuration screen. I've created a repository here with the code: https://github.com/ChubbyArse/MediaPortalTVPlugin I've also attached the most recent log file (there a few connect service issues in there - but I can't see anything related to the plugin - only it's loading and configuration page entries). Some questions: Am I able to register my own interfaces and implementations with the DI container? So I can construct a new instance of a type and include my own interfaces in the constructor. I'm planning on wrapping the Logger to provide some extra data - so I could add IPluginLogger to the constructor and register something like RegisterType<IPlugingLogger, PluginLogger> (unity-like example). I'm writing a proxy class to wrap talking to the MP services, if the first point above isn't a go-er then would the suggested practice be to:Create the MpProxy class with a constructor (IHttpClient client, IJsonSerializer serialiser) In the ILiveTvService implementation, I would have (IHttpClient client, IJsonSerializer serialiser) on the constructor and the service would inject those - and then use those to construct a MpProxy classe and hold at the class level. Testing - I'd like to setup local tests - can you create instances of the internal HttpClient / JsonSerialiser for injection into integration tests (I wouldn't envisage adding these to the github respository - purely for local testing) Thanks for bearing with me. server-63550731363.txt Edited November 4, 2014 by ChubbyArse Link to comment Share on other sites More sharing options...
Sven 136 Posted November 5, 2014 Share Posted November 5, 2014 You'll want to avoid any additional references and dependencies but we should already have what you need. You just need to inject the dependencies to our interfaces in your ServerEntryPoint constructor. See here: Dependency injection You can get a handle to our Json serializer and also any network resources you should need. Specifically: IJsonSerializer and IhttpClient are what you would need. For the moment it's not supported to have external dependencies in your project... OK - I've created my plugin and so far I have the configuration page working and persisting settings. However, I've returned empty objects in my implementation of ILiveTvService - however it doesn't look like it's being picked up / recognised as a TV Service and being displayed in the LiveTv configuration screen. I've created a repository here with the code: https://github.com/ChubbyArse/MediaPortalTVPlugin I've also attached the most recent log file (there a few connect service issues in there - but I can't see anything related to the plugin - only it's loading and configuration page entries). Some questions: Am I able to register my own interfaces and implementations with the DI container? So I can construct a new instance of a type and include my own interfaces in the constructor. I'm planning on wrapping the Logger to provide some extra data - so I could add IPluginLogger to the constructor and register something like RegisterType<IPlugingLogger, PluginLogger> (unity-like example). I'm writing a proxy class to wrap talking to the MP services, if the first point above isn't a go-er then would the suggested practice be to:Create the MpProxy class with a constructor (IHttpClient client, IJsonSerializer serialiser) In the ILiveTvService implementation, I would have (IHttpClient client, IJsonSerializer serialiser) on the constructor and the service would inject those - and then use those to construct a MpProxy classe and hold at the class level. Testing - I'd like to setup local tests - can you create instances of the internal HttpClient / JsonSerialiser for injection into integration tests (I wouldn't envisage adding these to the github respository - purely for local testing) Thanks for bearing with me. Did you put the plugin in the plugin folder? When it's not in that folder he can't find the plugin.... Link to comment Share on other sites More sharing options...
Luke 37192 Posted November 5, 2014 Share Posted November 5, 2014 Ah, I see the problem. During this release cycle we made a breaking change to ILiveTvService. You'll need to set your update level on the server to dev, which you can do in the dashboard -> advanced. It's odd because normally in this situation the instantiation failure shows up in the log. I'll have to look into that. As for the DI questions, we don't currently have a way for a plugin to build a localized DI container, or for constructor injection during unit tests. But if you want to help us out in those areas that would be fantastic - just as long as plugins don't end up requiring a hard reference to the DI framework. Also just fyi - you won't need the BasePluginFolder subclass for this. I assume you probably just tried it during your testing when things weren't working. Link to comment Share on other sites More sharing options...
Chubby Arse 23 Posted November 5, 2014 Author Share Posted November 5, 2014 Ah - Just to be clear: There's a difference between the ILIveTVService in the nuget and the consuming code in the current server release? I'll switch to DEV updates on the server tonight and give it another try, I'll also strip out the BasePluginFolder subclasses too, to keep my code down to what I need. Link to comment Share on other sites More sharing options...
Chubby Arse 23 Posted November 5, 2014 Author Share Posted November 5, 2014 OK - nearly there. Got a download validation failure when upgrading to Version 3.0.5422.20698 Attached logs. server-63550803767.txt Link to comment Share on other sites More sharing options...
ebr 14949 Posted November 6, 2014 Share Posted November 6, 2014 Our whole server went down about the time you were doing that so that may have been the issue. Link to comment Share on other sites More sharing options...
Chubby Arse 23 Posted November 6, 2014 Author Share Posted November 6, 2014 Where are the dev builds stored? Sadly, I'm still getting on a update from the configuration UI: "2014-11-05 19:18:09.4140 Error - App: Error Download validation failed for MBServer. Probably corrupted during transfer." Logs attached. Thanks - promise to leave you alone once I'm up to speed. server-63550811838.txt Link to comment Share on other sites More sharing options...
Lee 204 Posted November 6, 2014 Share Posted November 6, 2014 1 Link to comment Share on other sites More sharing options...
ebr 14949 Posted November 6, 2014 Share Posted November 6, 2014 Our server problems may have corrupted something. As soon as Luke is able, he can push a new version. edit: Never mind. Try again now... Link to comment Share on other sites More sharing options...
Chubby Arse 23 Posted November 6, 2014 Author Share Posted November 6, 2014 Installed...... and BOOM! My plugin appears on the Live TV page. Now down to the nitty gritty..... Thanks 3 Link to comment Share on other sites More sharing options...
Chubby Arse 23 Posted December 2, 2014 Author Share Posted December 2, 2014 OK - I thought I would update this, as I've been keeping Luke appraised of the progress but not really saying much here. So far to date, I've been able to fulfill all of the requirements of an MB3 LiveTV Plugin, with the exception of streaming Live TV from channels. Streaming from MP recordings (into the browser client and the Android client) is supported and all the schedule based functionality is also supported, including channel logos and recording screen grabs. I hope to finish off in the next week and make a beta available as long as Luke et al are happy for me to. 3 Link to comment Share on other sites More sharing options...
babgvant 143 Posted December 2, 2014 Share Posted December 2, 2014 Thanks. I'd love to participate when it's ready. Link to comment Share on other sites More sharing options...
Lee 204 Posted December 3, 2014 Share Posted December 3, 2014 Sounds great, is this working within mbtheater then? Cheers lee Link to comment Share on other sites More sharing options...
Chubby Arse 23 Posted December 5, 2014 Author Share Posted December 5, 2014 I've prepared an alpha release: http://mediabrowser.tv/community/index.php?/topic/14927-live-tv-plugin-for-media-portal-v1/ 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