Jump to content

New Plugin: My Own Api Provider - JSON Metadata


mickle026

Recommended Posts

mickle026

This is just a fully working version of the Person Provider. (I think - LOL :) , at least until I find some bugs!)

Requres latest stable 4.7.9

As Always with my plugins, I accept no resposibility for anything.....  its up to you if you try it.

Basically what it is, it lets you use your own json server to serve metadata for people directly into Emby as a metadata fetcher (with images)

People fetchers dont need turning on in library settings, they are already on by default.  So apart from the server string and mappings, there no more config.

*This plugin does not cover musicartists*

 

341381214_Screenshot2022-11-04at20-55-23Emby.png.67edc65725f3130c3cb25fac498810cb.png

Anyway anyone who wants to have a play can, let me know in the comment whether I should make this cover everything else so you can have your own Metadata servers
So far its only People

The config page lets you MAP your JSON to work with EMBY, so your JSON Element Names can be whatever you like,,you map them here.

The path to the image has 3 settings, it allows for a full url, a partial url and a base url path or a filename and a base url path
 

Edit Images (Magnifying glass search)

1331535044_Screenshot2022-11-04at20-58-59Emby.png.24a0324763f4d723927f12911adbe8cd.png

 

Identify (Looking for a Lee !)

1414534054_Screenshot2022-11-04at21-24-07Emby.thumb.png.fda17c179565bbd86c8ab0b927e1a126.png

136650517_Screenshot2022-11-04at21-24-26Emby.thumb.png.0a23b04e6720f45827944e17009eba0b.png

I have included the config file to my test server so you can at least try it.

My test server is all asian people (some do not have images as you will no doubt find) so if you look for anyone else you wont find them!

you can try the web view here
http://media-and-meta.ddns.net/metaserver/DBQueries/Find&Editperson.php

941069391_Screenshot2022-11-15at00-32-41Emby.thumb.png.7d6b0245cfd1ed1b23217974a2595b43.png

Any way if you try it let me know your findings - thanks

And Thanks to @TallBoiDezfor the inspiration to do this...

 

CreateMovieApi.zip MyPersonApiProvider.zip CreatePersonApi.zip

 

 

 

 

Edited by mickle026
update server version required
  • Like 2
  • Thanks 1
Link to comment
Share on other sites

mickle026

So what I have done is temporarily removed the plugins that were here whilst I fix what I know can be improved

 

 

 

 

 

 

 

 

 

 

Edited by mickle026
Link to comment
Share on other sites

Cheesegeezer

@mickle026

grats on the release chief! Great work, i been observing the dev posts you made and its quite a feat what you have achieved here.

👍👍

  • Thanks 1
Link to comment
Share on other sites

mickle026

I have the intention to cover all providers.

I already have a song cover provider of my own (for music), A lot of my tracks have their own covers different from the album itself, I'll probably make that available too as there are no others that I know of.

  • Like 1
Link to comment
Share on other sites

mickle026

*UPDATED 9th Nov 2022 @ 5.30am GMT

1. Handle DirectoryNames with Invalid Characters (if persons name has a character in it that cannot be used to build the directory name)
These are changed to _ (previously crashed the plugin)  If it still fails on a person it will now continue after logging the failure.
2. Fix Correct Php generation for SearchById and add
3. Change searchNames in php as in fix 1, replace invalid characters with _
4. Changed the php Names To PersonSearch.php etc to allow future export files without clasing. (updated this post examples)

 

It might need some tweeks, but here is an Emby Exporter for your People (Not MusicArtist) to A local Backup Path to create a structured API

Remember this is just a tool, you can create your own if you do not like the way this tool does it.

The Plugin Exports an XML file and the Primary image (Only the primary image at the moment) into a folder named with the Person name, Year of birth and Provider keys

like this:

Capture.JPG.45805869cc8b657ade1b9cda2d1f3b0a.JPG

It also writes 3 PHP files for use on a php enabled webpage

You can then use an api string with Search.php

If no format is supplied, json will be automatically returned

any of the elements can be supplied:

Name
Year
Id

http://<YourServer>/PersonSearch.php?Name=<Name>&Year=<Year>&Id=<Id>&Format=json

examples:
http://<YourServer>/PersonSearch.php?Name=Tom Cruise
http://<YourServer>/PersonSearch.php?Name=Tom
http://<YourServer>/PersonSearch.php?Name=Tom Cruise&Year=1962
http://<YourServer>/PersonSearch.php?Name=Tom Cruise&Year=1962&Id=nm0000129

The Api server will respond with a json result if it exists (XML is converted to json on the fly)

The php is very basic, it gets a file list of this directory , searches the directory names for the Name, Year or Id provided and replies with the Person.xml inside the folder, building a json array if there is more than one result

Currently only php is available, if someone can convert the php to javascript for me that would be awesome!! - as then it would work on the very basic websites.

 

9894623_Screenshot2022-11-08at16-17-32Emby.png.f04b6dd7fd21c03f789e6a48167f6d79.png

One thing to note is that I need to update the API Providers to allow and prioitise ID searches - this is a still to do!

 

Download currently removed whilst I fix another bug! (wont be too long)

 

Edited by mickle026
  • Like 1
Link to comment
Share on other sites

mickle026

OK so now improved an mostly tested up to the point of primary images. (I havent tested backdrops and logos)

Please note that there is still an issue with identify removing images, or not fetching them. (if it has a json reply with no image in it)

*Fixed an error in SearchById.php
*Completely changed the server config  string  and added server string mapping, see the plugin and images in this post

So for the Api server it must have these elements in the query string: Name={Name}&Year={Year}&Id={Id}

http://media-and-meta.ddns.net/metaserver/TIBML/PersonSearch.php?Name={Name}&Year={Year}&Id={Id}

^^ this is my test server - I moved it from the original post ^^

So now auto lookup by emby uses Ids if they are available, you can now search for any id in the MyPersonApi field of the Emby identify feature

If the api can search it by id it will return the json

For Example the CreatePersonApi tool below creates seperate folders for each person like this:
Park So-dam(1991)[Tmdb-1442583][Imdb-nm6524394][Tvdb-515330]

So in identify CreatePersonApi  Id: I have made it a general search as in Name with the supplied php

You can search any of that text, Park So-dam,1442583,nm6524394 etc

The CreatePersonApi now writes the <PrimaryImage> Tag with <PrimaryImage>/PersonsName+Ids/Image.jpg</PrimaryImage>

So to Use the Provider you should map the path+ the primary image string with the drop down selection

My Config is included to my server so you can see how it works

Once you are happy with it up and running turn logging off as it slows it down.

My Api server is not at all quick so if you use it expect its to slow down loading pages.

You can increase your api server simply by adding files and folders to it, but please remember that the create api tool will overwrite so backup somewhere else and then move what you want to your api site.

It can also be turned on/off in the config page near the save settings button

 

 

The api string should now also be able to be in this format too (I havent tested this)

http://[host address]/people/{Name}

http://[host address]/people/{Name}+{Year}+{Id}

http://[host address]/people/{Name}&{Year}&{Id}

and leave all the server string mappings blank

 

 

Im thinking of adding a timeout to the server query, what do you think?

 

 

 

 

Edited by mickle026
Link to comment
Share on other sites

mickle026

It turns out I had introduced 2 seperate bugs,

I found and fixed one of them easily because it was in the new code, the other I dont even know how I introduced it and was much harder to find.

Anyway its done!  Completely fixed, please update to this one, and sorry for the inconvenience 😉

One thing to note is date of birth / death in your json has to be in dd/mm/yyyy format with those slashes.  I can add support for other type if requested.
Other is there is now a testpage, for testing the server but that is NOT functional yet.  I was doing that whilst getting Peeved by having a hard time finding the bugs! So its a still to do.

I reposted the dll in the 1st post and updated the screenshot

I have a week off work coming up soon, so I hope to finish it properly then get on to the other media types.

Edited by mickle026
  • Like 1
Link to comment
Share on other sites

mickle026

CreatePersonApi is now fully functional, it now outputs Banners,Backdrops etc and adds them to the source xml that creates the lookup json.

MyPersonApi is now fully functional.  It will now import Backdrops (only 1 is fetched automatically, that must be an internal emby thing) but the rest can be fetched from the Edit Images option.  The server testing page is also now working.
1578315345_Screenshot2022-11-18at03-48-51Emby.thumb.png.ed41a593030ddff8824fd9047bc06799.png

504263839_Screenshot2022-11-18at03-48-32Emby.png.a9fd7ce183770efad6a2d3c0586da07d.png

I have also started on CreateMovieApi, I have included it here as it seems fully functional (although its for testing).  This will create a backup of your Emby movie library complete with the php files for the Api, I will now start on the MyMovieApi for fetching back into Emby.

 

  • Like 1
Link to comment
Share on other sites

mickle026

MyPersonApi, updated.

A Few fixes.

Handle Array'ed Json in Images , now wont crash, but if an array of json is returned on single person (ie in my own api server jo Lin, ad Jo Linwood can be returned fo just Jo Lin).  I still have to impliment the result of an array, so that the correct result is used.  For now its just error handled.

Handle Identify Metadata better, there was a crash when Overview or Primary Image in the Json was empty or was not present.  Now it is handled.  The crash caused the plugin to exit, and therefore metadata was not updated.

Edited by mickle026
Link to comment
Share on other sites

mickle026

MyPersonApi, updated. (this is now all working) - hopefully no more bugs!
Nearly Everything is imported!  Overviews, Date of birth , Place of Birth, Date of Death , Images etc (only 1 backdrop, Emby limitation) However using Edit Images you can import more!  (at the moment the last thing to fix is import provider ids)
GetImages array json now handled
To search just MyPersonApi with Identify (and ignore default TMDB), leave the Name field blank and enter either the name or id (not both) in MyPersonApi id: field.  This might produce an error in the logs for tmdb, as nothin is passed to it (but you can safely ignore that)

CreatePersonApi Updated
UTF8 now supported when exporting
Updated PHP
Included a HowTo.txt when the plugin is run and php is selected as output, it includes How To install & Create a truenas server
Exports to folders with provider keys, an xml file in the folder with the images.
Added a date

 

Update 2 dec 2022

Added Provider Id support to import.

Edited by mickle026
  • Like 1
Link to comment
Share on other sites

  • 9 months later...
mickle026

Yeah, I dont have an eta at the moment, but I ought to get it finished 🤔

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