Jump to content

Tutorial/exemple on plugins/channel creation


Go to solution Solved by Luke,

Recommended Posts

Posted
58 minutes ago, TallBoiDez said:

So, if I change it from "Actor" to "Person" then the code would look like this 

public class PluginRepositoryResult

 

{

 

       public List<Person> actor { get; set; }

 

}

 

 

 

public class Person 

 

{

 

       public string Name { get; set; }

 

}

 

 Correct?

Would it be easier to pull data from a .xml file or should I stick with the SQL database route?

Yes this seems correct. 

I would have to say that pulling data from an XML file would definitely be easier then maintaining a database.

 

Posted
17 minutes ago, chef said:

Yes this seems correct. 

I would have to say that pulling data from an XML file would definitely be easier then maintaining a database.

 

Okay, cause I can export the ms database to an XML file and is it safe to assume that any update to the XML file would reflected when the server pulls data from it and going along with emby naming convention for the image column it's labeled "Primary image" would it be better to change it to "folder" because that's how emby is naming the main image for actors in the metadata/people folder 

Posted (edited)
15 minutes ago, TallBoiDez said:

Okay, cause I can export the ms database to an XML file and is it safe to assume that any update to the XML file would reflected when the server pulls data from it and going along with emby naming convention for the image column it's labeled "Primary image" would it be better to change it to "folder" because that's how emby is naming the main image for actors in the metadata/people folder 

I think it will be up to you what you name things.

The API uses the type of image as Primary, but the physical image is called "folder".

If you decide to export the db you have as xml, you'll still have to serialize it in your plugin.

 

Edited by chef
Posted
16 minutes ago, chef said:

I think it will be up to you what you 2abt to name things.

The API uses the type of image as Primary, but the physical image is called "folder".

If you decide to export the db you have as xml, you'll still have to serialize it in your plugin.

 

Yeah, I'm not really concerned about the serialize thing, but if it easier to work with an XML file rather than a database then I'll go with the XML file route

Posted

I would be using XMLSerialize because it's an XML file 

Posted
23 minutes ago, TallBoiDez said:

I would be using XMLSerialize because it's an XML file 

Yeah, but you'll have to build out your classes to hold the XML data.

Then, make sure if you change your data in the the plugin, that you update the XML file as well.

I think emby has a built in xmlserializer.

Check for something like "IXmlSerializer" interface existing.

You could use that.

There is a couple online resources that might help you too.

Google search XML to C#.

There are a couple tools that allow you to upload your XML file, and a c# class structure is spit out for you.

Might be helpful.

 

Posted
13 minutes ago, chef said:

Yeah, but you'll have to build out your classes to hold the XML data.

Then, make sure if you change your data in the the plugin, that you update the XML file as well.

I think emby has a built in xmlserializer.

Check for something like "IXmlSerializer" interface existing.

You could use that.

There is a couple online resources that might help you too.

Google search XML to C#.

There are a couple tools that allow you to upload your XML file, and a c# class structure is spit out for you.

Might be helpful.

 

Thank you, I'll definitely look that up 

Posted

The xml file would have to be embedded and the project would need to be rebuilt for every change change wouldn't it..  Like where is this meta coming from?  The use case of what you want to do is a bit vague and youre learning which I guess is fine, but like some of this could probably be done way easier with just the base REST APIs and a little scripting and you run it every so often, rather than building some monolithic meta agent that no one else will ever use.  The Emby plugin stuff isn't an easy learn and very convoluted and doesn't always have the best way of doing things.

A normal meta agent would be calling some REST API to pull the data, and then just looping the meta items that it can associate via IMDB/TVDB etc with the information it has.  So part of the checks would be, how does the agent know find referenced items, then create a method that does that, then do the next step, okay now that I can return whatever it needs for step 1, and just use fake data being returned for whatever media item youre trying to match.  Like youre going down some wild paths here doing things in very odd orders when you dont even have the basic principal flow done yet, who cares how you get the data when Im not even sure you know what data you need to find/return.

I would never have one my my JR Engs design/build an Emby plugin as a learning project, they would be like WTF is this.

  • Haha 1
Posted

sometimes you need to let people dig holes to see how deep they can get before realizing the hole is in the wrong place.

  • Like 1
  • Haha 1
Posted (edited)

Yes, bakes is correct.

If you have a metadata provider API that you a requesting data from, then all you'd have to do is replace/add the new data to the library BaseItem through the Emby API.

 

Perhaps a description of your project is in order. Or you could post it on github.

 

 

Edited by chef
Posted (edited)

My suggestion would be start work on the media importer logic of the plugin, just hard code some sample data and get to a point you can import that into Emby using the media import classes and events.

From what I can see the media importer classes are event driven and are called for each item Emby wants info about, start there, get that working and then worry about where your data is coming from.

I am not telling you where to dig your hole but pointing you in the general direction of the field to start digging.

Edited by TeamB
Posted (edited)
54 minutes ago, chef said:

Yes, bakes is correct.

If you have a metadata provider API that you a requesting data from, then all you'd have to do is replace/add the new data to the library BaseItem through the Emby API.

 

Perhaps a description of your project is in order. Or you could post it on github.

 

 

https://github.com/tallboidez/embyplugin.git 

Edited by TallBoiDez
Posted
59 minutes ago, TeamB said:

it your repo public?

Yes

Posted
6 hours ago, TeamB said:

My suggestion would be start work on the media importer logic of the plugin, just hard code some sample data and get to a point you can import that into Emby using the media import classes and events.

From what I can see the media importer classes are event driven and are called for each item Emby wants info about, start there, get that working and then worry about where your data is coming from.

I am not telling you where to dig your hole but pointing you in the general direction of the field to start digging.

So, what your saying is i should focus more on how to import the data and I have that figured out then I can figure where the data is coming from. 

Posted
21 minutes ago, TallBoiDez said:

So, what your saying is i should focus more on how to import the data and I have that figured out then I can figure where the data is coming from. 

Yes

Posted (edited)
2 hours ago, TeamB said:

Yes

Honestly that seems like the best course of action to take since I'm learning all of this as I go 

I added a new interface to my plugin but haven't uploaded it GitHub yet so the current one there is not up to date at the moment 

Edited by TallBoiDez
Posted (edited)

Can show me a plugin that uses a REST API?

Edited by TallBoiDez
  • 3 weeks later...
Posted

@chef I have created a rest API do I add it to plugin in order to use it with emby?

Posted
1 hour ago, TallBoiDez said:

@chef I have created a rest API do I add it to plugin in order to use it with emby?

Hi TallBoiDez, can you be a bit more specific about that?

When you say you created a rest API.  Do you mean you created a service to request data from, separate from emby?

 

 

Posted
22 minutes ago, chef said:

Hi TallBoiDez, can you be a bit more specific about that?

When you say you created a rest API.  Do you mean you created a service to request data from, separate from emby?

 

 

Yes, a web api

Posted
46 minutes ago, TallBoiDez said:

Yes, a web api

Excellent work my friend. That is impressive.

So now you will want to look into implementing  the IHttpClient interface in your plugin to request data from your newly created API.

I'm still in the dark as to what your end goal is.

Is it something you would want to pm me so I have a better idea how to help? 😃

Or you could outline here on the thread and maybe other devs that are watching could also chime in and help as well. 

Posted
On 10/6/2022 at 8:17 PM, chef said:

Excellent work my friend. That is impressive.

So now you will want to look into implementing  the IHttpClient interface in your plugin to request data from your newly created API.

I'm still in the dark as to what your end goal is.

Is it something you would want to pm me so I have a better idea how to help? 😃

Or you could outline here on the thread and maybe other devs that are watching could also chime in and help as well. 

Yes, I can PM you, but i want to see how much i can without asking for help, if you can point me in the direction of a plugin Using the IhttpClient interface after implement members im pretty sure i understand what i need to add.

Posted

@chef is the IHttpClient Interface the correct interface for a metadata plugin. 

Posted

Would it be possible to incorporate my REST APi into my emby plugin or would that cause issues?

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