mickle026 401 Posted March 5, 2022 Share Posted March 5, 2022 (edited) Please help me. I think I have added a person almost properly with this code calling code var t = AddPerson(cancellationToken); bool AddPerson(CancellationToken cancelToken) { string MyLog = GetMetadataLog(); LogToMyFile(MyLog, DateTime.Now.ToString("dd.MMM.yyy - HH'.'mm'.'ss") + $" Entered AddPerson"); Person person = new Person { OfficialRating = "10", Name = "Whoever", Overview = "Some Info", OriginalTitle = "Whoever", SortName = "Whoever", ExternalId = "test", Id = Guid.NewGuid() }; LogToMyFile(MyLog, DateTime.Now.ToString("dd.MMM.yyy - HH'.'mm'.'ss") + $" Created Person"); BaseItem.ItemRepository.SaveItem(person, cancelToken); person.UpdateToRepository(MediaBrowser.Controller.Library.ItemUpdateType.None); LogToMyFile(MyLog, DateTime.Now.ToString("dd.MMM.yyy - HH'.'mm'.'ss") + $" Person added to db "); person.SetProviderId(MetadataProviders.Imdb, "nm9999999"); return true; } because when i look up internally with this code try { var xPerson = libraryManager.GetInternalItemIds(new InternalItemsQuery { IncludeItemTypes = new[] { "Person" }, Name = "Whoever" }); foreach (var item in xPerson) { var PersonID = libraryManager.GetItemById(item); LogToMyFile(MyLog, DateTime.Now.ToString("dd.MMM.yyy - HH'.'mm'.'ss") + $" {PersonID.Name}"); LogToMyFile(MyLog, DateTime.Now.ToString("dd.MMM.yyy - HH'.'mm'.'ss") + $" {PersonID.Id}"); LogToMyFile(MyLog, DateTime.Now.ToString("dd.MMM.yyy - HH'.'mm'.'ss") + $" {PersonID.Overview}"); LogToMyFile(MyLog, DateTime.Now.ToString("dd.MMM.yyy - HH'.'mm'.'ss") + $" {PersonID.GetProviderId(MetadataProviders.Imdb)}"); } } catch { LogToMyFile(MyLog, DateTime.Now.ToString("dd.MMM.yyy - HH'.'mm'.'ss") + $" AddPerson failed"); } My logging shows that the person can be looked up internally (I added the person 4 times) 05.Mar.2022 - 03.35.26 Entered AddPerson 05.Mar.2022 - 03.35.26 Created Person 05.Mar.2022 - 03.35.26 Person added to db 05.Mar.2022 - 03.35.26 Whoever 05.Mar.2022 - 03.35.26 00000000-0000-0000-0000-000000000000 05.Mar.2022 - 03.35.26 Some Info 05.Mar.2022 - 03.35.26 05.Mar.2022 - 03.35.26 Whoever 05.Mar.2022 - 03.35.26 6ed420dd-1107-4eb2-8a48-4a1f4e800b13 05.Mar.2022 - 03.35.26 Some Info 05.Mar.2022 - 03.35.26 05.Mar.2022 - 03.35.26 Whoever 05.Mar.2022 - 03.35.26 b8937a4b-6f52-4065-8547-435a67a09c52 05.Mar.2022 - 03.35.26 Some Info 05.Mar.2022 - 03.35.26 05.Mar.2022 - 03.35.26 Whoever 05.Mar.2022 - 03.35.26 1f2c27bb-20cc-4b70-a4d4-3fbd9b82b330 05.Mar.2022 - 03.35.26 Some Info 05.Mar.2022 - 03.35.26 05.Mar.2022 - 03.35.26 Whoever 05.Mar.2022 - 03.35.26 e1dbd2cf-788a-4442-9573-714bd7db3a0c 05.Mar.2022 - 03.35.26 Some Info 05.Mar.2022 - 03.35.26 However when I type "Whoever" (the name i used to test with) into Emby search box the Person does not show in the Gui search. Also I fail to set the Provider ID - its blank in the logging. What am i missing to get the person searchable in the gui? and what am i doing wrong setting the provider id ? Thanks Edited March 5, 2022 by mickle026 Link to comment Share on other sites More sharing options...
Luke 37092 Posted March 5, 2022 Share Posted March 5, 2022 So you can't do that. You can't just have people dangling in the database without being attached to any media. So rather than try to create the person, what you need to do is add them to a media item, then the person will get created, and then they'll show up in search. Link to comment Share on other sites More sharing options...
mickle026 401 Posted March 5, 2022 Author Share Posted March 5, 2022 Is there an example anywhere in C# that I can check out for creating and adding them to the mediaitem? Link to comment Share on other sites More sharing options...
Luke 37092 Posted March 14, 2022 Share Posted March 14, 2022 Try ILibraryManager.GetPeople for an item, update that list to add a new person, and then ILibraryManager.UpdatePeople to save it back. 1 Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now