Jump to content

Tutorial/exemple on plugins/channel creation


AMenard
Go to solution Solved by Luke,

Recommended Posts

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.

 

Link to comment
Share on other sites

TallBoiDez
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 

Link to comment
Share on other sites

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
Link to comment
Share on other sites

TallBoiDez
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

Link to comment
Share on other sites

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.

 

Link to comment
Share on other sites

TallBoiDez
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 

Link to comment
Share on other sites

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
Link to comment
Share on other sites

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
Link to comment
Share on other sites

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
Link to comment
Share on other sites

TallBoiDez
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
Link to comment
Share on other sites

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

Link to comment
Share on other sites

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

Link to comment
Share on other sites

TallBoiDez
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
Link to comment
Share on other sites

  • 3 weeks later...
chef
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?

 

 

Link to comment
Share on other sites

TallBoiDez
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

Link to comment
Share on other sites

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

Link to comment
Share on other sites

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

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