Jump to content

Updating People Images c#


mickle026

Recommended Posts

mickle026

Im trying to update people images, so that i dont have a blank placeholder.  (copying from one server to another)

 

I have the correct Guid and copied the files to /metadata/library/2digitGuid/FullGuid/folder.jpg

 

So the person image is in the correct place, if i click the blank place holder it updates, but i want to update in c#

 

 

I have tried

var yActor = libraryManager.GetItemById(Person);

var ImageInfo = yActor.GetImageInfo(ImageType.Primary, 0);  // Get an Info Object ??
ImageInfo.Path = CopyToFile; // update the path  ?? with my path to the metadata library guid path\folder.jpg
yActor.SetImage(ImageInfo,0); // Replace the object ??
yActor.RequiresRefresh(); // refresh it ??

Person is the id of the person,

 

This will update only the ones I have clicked, all the others do not update

 

One I clicked

2020-05-14 00:35:34.651 Info RestorePeopleService: -------------------------------------------
2020-05-14 00:35:34.651 Info RestorePeopleService: Name : Vincent D'Onofrio
2020-05-14 00:35:34.651 Info RestorePeopleService: Index : 11858
2020-05-14 00:35:34.651 Info RestorePeopleService: Primary image Path : C:\Users\user\AppData\Roaming\Emby-Server\programdata\metadata\library\bc\bc2db8afba2b40d2a31fd2d73afce888\folder.jpg
2020-05-14 00:35:34.651 Info RestorePeopleService: ID: bc2db8af-ba2b-40d2-a31f-d2d73afce888
2020-05-14 00:35:34.651 Info RestorePeopleService: We Have an Image for this person
2020-05-14 00:35:34.651 Info RestorePeopleService: ServerPath \\NAS\POSTERSERVER\People\Vincent D'Onofrio\Vincent D'Onofrio.jpg
2020-05-14 00:35:34.651 Info RestorePeopleService: CopyTo C:\Users\user\AppData\Roaming\Emby-Server\programdata\metadata\library\bc\bc2db8afba2b40d2a31fd2d73afce888\folder.jpg
2020-05-14 00:35:34.651 Info RestorePeopleService: Trying to set the Image C:\Users\user\AppData\Roaming\Emby-Server\programdata\metadata\library\bc\bc2db8afba2b40d2a31fd2d73afce888\folder.jpg
2020-05-14 00:35:34.651 Info RestorePeopleService: Set the Image Succedded  !
2020-05-14 00:35:34.651 Info RestorePeopleService: File Exists in Emby Library!
2020-05-14 00:35:34.682 Info RestorePeopleService: -------------------------------------------

One I didnt click

2020-05-14 00:35:34.689 Info RestorePeopleService: -------------------------------------------
2020-05-14 00:35:34.689 Info RestorePeopleService: Name : Evan Rachel Wood
2020-05-14 00:35:34.689 Info RestorePeopleService: Index : 14233
2020-05-14 00:35:34.689 Info RestorePeopleService: Primary image Path : 
2020-05-14 00:35:34.689 Info RestorePeopleService: ID: 8db6ed42-c9af-4ab1-905a-d62cba860136
2020-05-14 00:35:34.689 Info RestorePeopleService: We Have an Image for this person
2020-05-14 00:35:34.689 Info RestorePeopleService: ServerPath \\NAS\POSTERSERVER\People\Evan Rachel Wood\Evan Rachel Wood.jpg
2020-05-14 00:35:34.689 Info RestorePeopleService: CopyTo C:\Users\user\AppData\Roaming\Emby-Server\programdata\metadata\library\8d\8db6ed42c9af4ab1905ad62cba860136\folder.jpg
2020-05-14 00:35:34.689 Info RestorePeopleService: Trying to set the Image C:\Users\user\AppData\Roaming\Emby-Server\programdata\metadata\library\8d\8db6ed42c9af4ab1905ad62cba860136\folder.jpg
2020-05-14 00:35:34.689 Info RestorePeopleService: Set the Image Failed
2020-05-14 00:35:34.690 Info RestorePeopleService: File Exists in Emby Library!
2020-05-14 00:35:34.695 Info RestorePeopleService: -------------------------------------------

Any Help would be appreciated :)
 

Edited by mickle026
Link to comment
Share on other sites

pünktchen
yActor.SetImage(ImageInfo,0);
_libraryManager.UpdateImages(yActor);

May i ask you what you're trying to achieve? Because the People Backup plugin can already restore from a named folder structure.

Link to comment
Share on other sites

mickle026

Thanks I'll try that.

 

Im still learning c#, quite quickly I think.  I want to understand how to do all of it - update library elements.

 

The Endgame is not to replace anybody elses plugin, but to be able to replace images of all types and all libraries from other areas of the www or any location.  How this will hapen has not been decided yet, I need to know how to do it first.  Walk before I can run.

 

I already have the image search within Emby working in a fashion ( no preview thumbs though :( )m but clicking the image opens it or downloads it correctly.

It also works from meta Image fetchers within the library scan.

 

& Part of my idea is a web dashboard for people searching and updating.  (from server admin currently as theres no non-admin dashboard view avaliabilty to use plugins)

 

5ebd819ec7200_Untitled.jpg

Edited by mickle026
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...