Jump to content

Learning the server code and plugin structure (for complete noobs)


thefirstofthe300

Recommended Posts

thefirstofthe300

I am interested in starting to contribute patches to the server and plugins and maybe have a go at writing some plugins of my own; however, I have no clue where to start.

 

I have very little experience programming and am open to learning C# (I will be taking college classes for C and C++ in the near future so hoping to learn a lot there), but my dev environment will be a Linux-based one.

 

Also, I am a person who has to understand exactly how things interface with each other before I can really start to make sense of things in my head. I have no experience with large code-bases.  

 

My questions are

 

  • How well will Linux work as a dev environment? Do I need use a Windows OS for development?
  • Do I need to use a specific IDE?
  • What would be the best place for me to start to work through the server code so that I can actually understand how the plugins interface with the server?
  • Do you have any good resources for the core C# libraries that will help me work through the classes and libraries that Media Browser makes use of so that I can understand what is happening in each module/library/namespace?

I would be willing to put in the work to get going with this project. I will probably just need a lot of help to start out with, but I don't want to weigh anybody down (especially Luke, I know he is EXTREMELY busy with server coding. In fact, I am amazed at how fast he churns out releases :) ). I just ask that you be patient with me as this is the first project that I will be making any significant contribution too. I also suspect it may be several months before any of my effort amounts to anything as I am in college at the moment.

Link to comment
Share on other sites

I believe all of us are using Visual Studio on Windows right now and I'm not really sure what your options are for .net development on Linux.  A quick search came up with this: http://www.monodevelop.com/ but the reference to it was seven years old.

 

As for your approach, I would suggest trying to create a plug-in first.  Doing that will introduce you to some of how the server works and allow you to create something probably much quicker.  Information on that can be found here but it is geared towards Visual Studio.

Link to comment
Share on other sites

hamstercat

MonoDevelop is what I'm using when I'm trying to find bugs under Linux, and it's working fine with the Media Browser solution, however it's miles away from Visual Studio. If you can dual-boot or virtualize Windows you'll have a much better experience.

 

You can download the free edition of Visual Studio here http://www.visualstudio.com/en-us/news/vs2013-community-vs.aspx.

  • Like 1
Link to comment
Share on other sites

thefirstofthe300

Are there any detailed docs for the available server functions for plugins or do I just need to browse the source code to figure out how it works?

 

Also, do you know of any example channel plugins that I could look over?

Edited by DaBungalow
Link to comment
Share on other sites

hamstercat

The wiki on GitHub (https://github.com/MediaBrowser/MediaBrowser/wiki/How-to-build-a-Server-Plugin) is useful and contains most stuff, but looking at an existing channel was useful to me too when I created my first one. I suggest looking at the Twitch one, it's fairly simple to understand and uses different calls.

 

Also, don't hesitate to ask for help in these forums, myself and others will be glad to help!

Edited by hamstercat
Link to comment
Share on other sites

thefirstofthe300

The wiki on GitHub (https://github.com/M...a-Server-Plugin) is useful and contains most stuff, but looking at an existing channel was useful to me too when I created my first one. I suggest looking at the Twitch one, it's fairly simple to understand and uses different calls.

 

Also, don't hesitate to ask for help in these forums, myself and others will be glad to help!

Thanks so much for the help!

 

I saw the How to build a plugin docs but being a noob, I am having a hard time getting my head wrapped around what the server is doing to make the plugin (in my case, channel) work.

 

Sent from my Nexus 7. Pardon my spelling. :)

Link to comment
Share on other sites

Swynol

i got as far as this :(

 

  1. Create a class called Plugin, and have it inherit from MediaBrowser.Common.Plugins.BasePlugin-T, where T is the name of the PluginConfiguration class you just created. You will need to implement its constructor like so:

public Plugin(IApplicationPaths applicationPaths, IXmlSerializer xmlSerializer) : base(applicationPaths, xmlSerializer)

 

 

The below is what i did but it has errors. what am i doing wrong?

 

Public Class Plugin
    Inherits MediaBrowser.Common.Plugins.BasePlugin(Of-PluginConfiguration)
End Class
 
 
EDIT: never mind my fault. was creating .vb classes and not .cs
Edited by Crazypete00
Link to comment
Share on other sites

hamstercat

Basically the entry point for a channel is the method GetChannelItems of the class implementing IChannel. There is other stuff around that, but using dependency injection Media Browser will load your channel automatically and call that method whenever you click on it.

 

It may take some time if you're not used to C# or Java, but you'll get the hang of it after making your first one.

  • Like 1
Link to comment
Share on other sites

thefirstofthe300

I have never use C# or Java (being a Linux guy, Python and Bash are about all I have scripted in; that and JS) so this is definitely going to be a learning experience.

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...