protected override JsonObject SerializeItem(BaseItem item, IServerConfigurationManager options, ILibraryManager libraryManager) { var output = new JsonPerson() { id = item.InternalId, name = item.Name ?? string.Empty, overview = item.Overview ?? string.Empty, birthdate = item.PremiereDate.HasValue ? item.PremiereDate.Value.LocalDateTime : new DateTime?(), birthyear = item.ProductionYear, placeofbirth = item.ProductionLocations.Length > 0 ? item.ProductionLocations[0] : string.Empty, deathdate = item.EndDate.HasValue ? item.EndDate.Value.LocalDateTime : new DateTime?(), imdbid = item.GetProviderId(MetadataProviders.Imdb) ?? string.Empty, lockdata = item.IsLocked, tags = item.Tags, }; if (long.TryParse(item.GetProviderId(MetadataProviders.Tmdb), out var l)) { output.tmdbid = l; } else { output.tmdbid = null; } return(output); }
private void UpdateJsonPersonEmptyGroupId(JsonPerson person) { if (person.GroupId == Guid.Empty) { AddedEntity <Group> addedGroup = _addedGroups.Where(x => x.ClientId == person.GroupClientId).FirstOrDefault(); if (addedGroup != null) { person.GroupId = addedGroup.Entity.Id; } } }
public Person PopulatePerson(Person person, JsonPerson jsonPerson) { person.Name = jsonPerson.Name; person.GroupId = jsonPerson.GroupId; return(person); }