// GET: Root/Details/5 public ActionResult Details(string userName) { PersonResult root = null; using (var client = new HttpClient()) { client.BaseAddress = new Uri("https://bio.torre.co/api/bios/" + userName); //HTTP GET var responseTask = client.GetAsync(userName); responseTask.Wait(); var result = responseTask.Result; if (result.IsSuccessStatusCode) { var readTask = result.Content.ReadAsStringAsync(); readTask.Wait(); root = JsonConvert.DeserializeObject <PersonResult>(readTask.Result); } else //web api sent error response { //log response status here.. root = new PersonResult(); ModelState.AddModelError("CustomError", "Server error. Please contact administrator."); return(View("Index")); } } return(View(root)); }
public async Task <PersonResult> UpdateProfilePic(Guid personId, IFormFile image) { var retVal = new PersonResult(); if (image.Length == 0) { throw new ArgumentException("image"); } var path = await UploadProfilePic(personId, image); var person = await Repository.Queryable().Where(x => x.Id == personId).FirstAsync(); person.ImageUrl = path; var records = await Repository.UpdateAsync(person, true); if (records > 0) { retVal.Succeeded = true; retVal.PersonId = personId; await Task.Run(() => { RaiseEvent(new PersonUpdatedEvent { PersonId = personId }); }); } return(retVal); }
/// <summary> /// Processes the info. /// </summary> /// <param name="person">The person.</param> /// <param name="searchResult">The search result.</param> protected void ProcessInfo(Person person, PersonResult searchResult) { person.Overview = searchResult.biography; DateTime date; if (DateTime.TryParseExact(searchResult.birthday, "yyyy-MM-dd", new CultureInfo("en-US"), DateTimeStyles.None, out date)) { person.PremiereDate = date.ToUniversalTime(); } if (DateTime.TryParseExact(searchResult.deathday, "yyyy-MM-dd", new CultureInfo("en-US"), DateTimeStyles.None, out date)) { person.EndDate = date.ToUniversalTime(); } if (!string.IsNullOrEmpty(searchResult.homepage)) { person.HomePageUrl = searchResult.homepage; } if (!person.LockedFields.Contains(MetadataFields.ProductionLocations)) { if (!string.IsNullOrEmpty(searchResult.place_of_birth)) { person.ProductionLocations = new List <string> { searchResult.place_of_birth }; } } person.SetProviderId(MetadataProviders.Tmdb, searchResult.id.ToString(UsCulture)); }
/// <summary> /// Fetches the info. /// </summary> /// <param name="person">The person.</param> /// <param name="id">The id.</param> /// <param name="cancellationToken">The cancellation token.</param> /// <returns>Task.</returns> private async Task FetchInfo(Person person, string id, CancellationToken cancellationToken) { string url = string.Format(@"http://api.themoviedb.org/3/person/{1}?api_key={0}&append_to_response=credits,images", MovieDbProvider.ApiKey, id); PersonResult searchResult = null; using (var json = await MovieDbProvider.Current.GetMovieDbResponse(new HttpRequestOptions { Url = url, CancellationToken = cancellationToken, AcceptHeader = MovieDbProvider.AcceptHeader }).ConfigureAwait(false)) { searchResult = JsonSerializer.DeserializeFromStream <PersonResult>(json); } cancellationToken.ThrowIfCancellationRequested(); if (searchResult != null) { ProcessInfo(person, searchResult); Logger.Debug("TmdbPersonProvider downloaded and saved information for {0}", person.Name); await FetchImages(person, searchResult.images, cancellationToken).ConfigureAwait(false); } }
/// <summary> /// Fetches the info. /// </summary> /// <param name="person">The person.</param> /// <param name="id">The id.</param> /// <param name="cancellationToken">The cancellation token.</param> /// <returns>Task.</returns> private async Task FetchInfo(Person person, string id, CancellationToken cancellationToken) { string url = string.Format(@"http://api.themoviedb.org/3/person/{1}?api_key={0}", MovieDbProvider.ApiKey, id); PersonResult searchResult = null; try { using (Stream json = await HttpClient.Get(url, MovieDbProvider.Current.MovieDbResourcePool, cancellationToken).ConfigureAwait(false)) { if (json != null) { searchResult = JsonSerializer.DeserializeFromStream <PersonResult>(json); } } } catch (HttpException) { } cancellationToken.ThrowIfCancellationRequested(); if (searchResult != null && searchResult.Biography != null) { ProcessInfo(person, searchResult); //save locally var memoryStream = new MemoryStream(); JsonSerializer.SerializeToStream(searchResult, memoryStream); await ProviderManager.SaveToLibraryFilesystem(person, Path.Combine(person.MetaLocation, MetaFileName), memoryStream, cancellationToken); Logger.Debug("TmdbPersonProvider downloaded and saved information for {0}", person.Name); } }
public async Task <PersonResult> GetAll(int page) { PageParameters parameters = new PageParameters { PageNumber = page == 0 ? 1 : page }; var persons = await _uow.Persons.GetAll() .Include(x => x.Gender) .Include(x => x.Address) .Include(x => x.Attachment) .Include(x => x.Phones) .Skip((parameters.PageNumber - 1) * parameters.PageSize) .Take(parameters.PageSize).ToListAsync(); double pageCount = _uow.Persons.GetAll().Count() / (double)parameters.PageSize; var model = new PersonResult { Persons = _mapper.Map <List <PersonDTO> >(persons), CurrentPage = parameters.PageNumber, PageCount = (int)Math.Ceiling(pageCount) }; return(model); }
/// <summary> /// Get all locations for split /// </summary> /// <param name="personResult"></param> /// <param name="id"></param> /// <returns>Task with list of locations</returns> protected async Task <List <Location> > GetSplitLocationsForComparison(PersonResult personResult, int?id) { SplitTime splitTime = personResult.Result.SplitTimes.Where(st => st.SplitID == id).SingleOrDefault(); if (splitTime == null) { return(null); } Path path = await GetSinglePathAsync(p => p.ID == personResult.PathID); if (path == null) { return(null); } List <Location> SplitSegment = pathAnalysis.InterpolationByDistance(GetSplitPath(path, splitTime), 5); if (SplitSegment == null) { return(null); } return(SplitSegment); }
public async Task <PersonResult> UpdatePersonDetails(Guid id, PersonDetailsInput input) { _logger.LogInformation(GetLogMessage("Person ID:{0}"), id); var retVal = new PersonResult() { PersonId = id }; var entity = await Repository.FirstOrDefaultAsync(x => x.Id == id); entity.InjectFrom(input); var records = await Repository.UpdateAsync(entity, true); _logger.LogDebug(GetLogMessage("{0} records updated")); if (records > 0) { await Task.Run(() => { RaiseEvent(new PersonUpdatedEvent { PersonId = id }); }); } return(retVal); }
public EFModels.MaternityBenefitsPersonResult ConvertToDb(PersonResult model) { return(new EFModels.MaternityBenefitsPersonResult() { PersonId = model.Person.Id, //MaternityBenefitsPerson = MaternityBenefitsPersonEFStore.ConvertToDb((MaternityBenefitsPerson)model.Person), BaseAmount = model.BaseAmount, VariantAmount = model.VariantAmount }); }
public static JObject ToDto(this PersonResult person) { var result = new JObject { { "firstname", person.Firstname }, { "lastname", person.Lastname }, { "birthdate", person.Birthdate } }; return(result); }
/// <summary> /// Processes the info. /// </summary> /// <param name="person">The person.</param> /// <param name="searchResult">The search result.</param> protected void ProcessInfo(Person person, PersonResult searchResult) { person.Overview = searchResult.Biography; DateTime date; if (DateTime.TryParseExact(searchResult.Birthday, "yyyy-MM-dd", new CultureInfo("en-US"), DateTimeStyles.None, out date)) { person.PremiereDate = date; } person.SetProviderId(MetadataProviders.Tmdb, searchResult.Id.ToString()); }
public async Task <PersonResult> GetPersonAsync(Guid id, CancellationToken cancellationToken = default) { //Person person = await Context.People.FindAsync(id, cancellationToken); Person person = await Context.People.SingleOrDefaultAsync(c => c.PersonId == id, cancellationToken); if (person == null) { throw new SqlNullValueException($"The person {id} does not exists or is not processed yet .."); } PersonResult personResult = RsultConverter.Map <PersonResult>(person); return(personResult); }
// converts the received person/company object into a string public String convertObjectToString(Result obj, String separator) { String result = ""; switch (obj is PersonResult) { case true: PersonResult person = obj as PersonResult; result += "person" + separator + // result type person.firstName + separator + person.lastName + separator + "" + separator + // company name person.phone1 + separator + person.phone2 + separator + person.phone3 + separator + person.streetAddressName + separator + person.streetAddressNumber + separator + person.streetAddressZipcode + separator + person.streetAddressCity + separator + person.boxAddress + separator + person.postAddress + separator + person.coordinateEast + separator + person.coordinateNorth + separator + person.birthday; break; case false: CompanyResult company = obj as CompanyResult; result += "company" + separator + // result type "" + separator + // first name "" + separator + // last name company.companyName + separator + company.phone1 + separator + company.phone2 + separator + company.phone3 + separator + company.streetAddressName + separator + company.streetAddressNumber + separator + company.streetAddressZipcode + separator + company.streetAddressCity + separator + company.boxAddress + separator + company.postAddress + separator + company.coordinateEast + separator + company.coordinateNorth + separator + ""; // birthday break; } return(ISO8859_1_Filter(extraSpaceRemover(result))); }
/// <summary> /// validate person object and add it to database /// </summary> /// <param name="person"></param> /// <returns>return PersonResult(Errors object and Result json object if no validating object passed)</returns> public PersonResult Add(PersonRequest person) { var result = new PersonResult(); var error = ValidatePerson(person); if (!error.HasErrors) { result.Result = JsonConvert.SerializeObject(_personsRepository.Add(person)); } else { result.Errors = error; } return(result); }
public async Task <List <PersonResult> > SearchByName(string searchString) { var personResults = new List <PersonResult>(); foreach (Person p in await _personRepository.SearchByName(searchString)) { var personResult = new PersonResult { Name = p.FirstName + " " + p.LastName, Age = GetAge(p.DateOfBirth), PictureFileName = p.PictureFileName, Address = string.Format("{0} {1} {2}, {3} {4}", p.AddressLine1, p.AddressLine2, p.City, p.State, p.Zip), Interests = p.Interests }; personResults.Add(personResult); } return(personResults); }
public async static Task <PersonResult> CreatePersonAsync(string personGroupId, string displayName) { HttpClient client = new HttpClient(); client.DefaultRequestHeaders.Add("Ocp-Apim-Subscription-Key", Common.CoreConstants.FaceApiSubscriptionKey); string personId = displayName.Replace(" ", "").ToLower(); PersonInfo personInfo = new PersonInfo() { name = displayName, userData = "", }; var payload = new HttpStringContent(JsonConvert.SerializeObject(personInfo)); payload.Headers.ContentType = new HttpMediaTypeHeaderValue("application/json"); var response = await client.PostAsync(new Uri($"{CogsExplorer.Common.CoreConstants.CognitiveServicesBaseUrl}/face/v1.0/persongroups/{personGroupId}/persons"), payload); PersonResult personResult = null; try { var results = await response.Content.ReadAsStringAsync(); var personCreationResult = JsonConvert.DeserializeObject <PersonCreationResult>(results); personResult = new PersonResult() { personId = personCreationResult.personId, name = displayName, userData = "", }; } catch (Exception ex) { } return(personResult); }
public List <PersonResult> Join(SimulationCaseResult baseResult, SimulationCaseResult variantResult) { var result = new List <PersonResult>(); foreach (var entry in baseResult.ResultSet) { var person = entry.Value.Person; var baseAmount = entry.Value.Amount; var variantAmount = variantResult.ResultSet[entry.Key].Amount; var nextResult = new PersonResult() { Person = person, BaseAmount = baseAmount, VariantAmount = variantAmount, }; result.Add(nextResult); } return(result); }
public async static Task <PersonResult> GetPersonFaceAsync(string personGroupId, string personId, string faceId) { HttpClient client = new HttpClient(); client.DefaultRequestHeaders.Add("Ocp-Apim-Subscription-Key", Common.CoreConstants.FaceApiSubscriptionKey); var response = await client.GetAsync(new Uri($"{CogsExplorer.Common.CoreConstants.CognitiveServicesBaseUrl}/face/v1.0/persongroups/{personGroupId}/persons/{personId}/persistedFaces/{faceId}")); PersonResult personResult = null; try { var results = await response.Content.ReadAsStringAsync(); personResult = JsonConvert.DeserializeObject <PersonResult>(results); } catch (Exception ex) { } return(personResult); }
private async Task GPSManipulationAsync(Models.GPS.Path path, PersonResult personResult) { var interpolated = pathAnalysis.InterpolationByTime(path.Locations, 1); var splits = await _context.SplitTimes.Where(st => st.Result == personResult.Result) .Include(st => st.Split) .ThenInclude(s => s.SecondControl) .ToListAsync(); double ofsset = pathAnalysis.GetOffsetFromSplits(splits, interpolated); var completeLocations = pathAnalysis.SetOffset(interpolated, ofsset); path.Locations = null; path.PersonResult = personResult; _context.Add(path); _context.SaveChanges(); foreach (var cl in completeLocations) { cl.PathID = path.ID; } _context.BulkInsert(completeLocations); }
public async Task <PersonResult> CreatePerson( PersonInput input, Guid?recruiterId, Guid?marketerId, Guid?affiliateOrganizationId, string password = "******" ) { _logger.LogInformation(GetLogMessage("Recruiter:{0};Marketer:{1};AffiliateOrg:{2}"), recruiterId, marketerId, affiliateOrganizationId); var user = await _userAccountManager .FindByEmailAsync(input.EmailAddress); var retVal = new PersonResult(); if (user == null) { OrganizationRecruiter re = null; OrganizationMarketer ma = null; if (affiliateOrganizationId.HasValue) { if (marketerId.HasValue) { ma = await _orgMarketerRepository.Queryable() .Where(x => x.OrganizationId == affiliateOrganizationId.Value && x.MarketerId == marketerId.Value) .FirstOrDefaultAsync(); } else { ma = await _orgMarketerRepository.Queryable() .Include(x => x.OrganizationDefaults) .Where(x => x.OrganizationId == affiliateOrganizationId.Value && x.OrganizationDefaults.Any()) .FirstOrDefaultAsync(); } if (recruiterId.HasValue) { re = await _orgRecruiterRepository.Queryable() .Where(x => x.OrganizationId == affiliateOrganizationId.Value && x.RecruiterId == recruiterId.Value) .FirstOrDefaultAsync(); } else { re = await _orgRecruiterRepository.Queryable() .Include(x => x.RecruitingOrganizationDefaults) .Where(x => x.OrganizationId == affiliateOrganizationId.Value && x.RecruitingOrganizationDefaults.Any()) .FirstOrDefaultAsync(); } } if (ma == null) { ma = await _orgMarketerRepository.Queryable().Where(x => x.IsSystemDefault).FirstAsync(); } if (re == null) { re = await _orgRecruiterRepository.Queryable().Where(x => x.IsSystemDefault).FirstAsync(); } user = new ApplicationUser { UserName = input.EmailAddress, Email = input.EmailAddress, EmailConfirmed = false, Created = DateTimeOffset.UtcNow, PhoneNumber = input.PhoneNumber }; var result = await _userAccountManager.CreateAsync(user, password); if (!result.Succeeded) { retVal.ErrorMessage = result.ToString(); return(retVal); } var person = new Person { ImageUrl = "https://www.dropbox.com/s/icxbbieztc2rrwd/default-avatar.png?raw=1", Id = user.Id, FirstName = input.FirstName, LastName = input.LastName, Iso2 = input.Iso2, ProvinceState = input.ProvinceState, ReferralCode = ma.ReferralCode, AccountManager = new AccountManager() { Id = user.Id, Created = DateTimeOffset.UtcNow, Updated = DateTimeOffset.UtcNow, ObjectState = ObjectState.Added }, ProjectManager = new ProjectManager() { Id = user.Id, Created = DateTimeOffset.UtcNow, Updated = DateTimeOffset.UtcNow, ObjectState = ObjectState.Added }, Marketer = new Marketer() { Id = user.Id, Created = DateTimeOffset.UtcNow, Updated = DateTimeOffset.UtcNow, ObjectState = ObjectState.Added }, Recruiter = new Recruiter() { Id = user.Id, Created = DateTimeOffset.UtcNow, Updated = DateTimeOffset.UtcNow, ObjectState = ObjectState.Added }, Contractor = new Contractor() { RecruiterOrganizationId = re.OrganizationId, RecruiterId = re.RecruiterId, IsAvailable = false, ObjectState = ObjectState.Added, Created = DateTimeOffset.UtcNow, Updated = DateTimeOffset.UtcNow, }, Customer = new Customer() { MarketerId = ma.MarketerId, MarketerOrganizationId = ma.OrganizationId, ObjectState = ObjectState.Added, Created = DateTimeOffset.UtcNow, Updated = DateTimeOffset.UtcNow, }, ObjectState = ObjectState.Added, Created = DateTimeOffset.UtcNow, Updated = DateTimeOffset.UtcNow }; var theResult = Repository.InsertOrUpdateGraph(person, true); _logger.LogDebug(GetLogMessage("{0} results updated"), theResult); if (theResult > 0) { retVal.Succeeded = true; retVal.PersonId = person.Id; await Task.Run(() => { RaiseEvent(new PersonCreatedEvent { PersonId = person.Id }); }); } } else { _logger.LogInformation(GetLogMessage("Email address:{0};"), input.EmailAddress); retVal.ErrorMessage = "Email address already exists"; } return(retVal); }
// Written, 27.11.2019 static async Task Main(string[] args) { // Written, 27.11.2019 Console.WriteLine("The Library v1.1 Search People Test\nEnter Phrase and press Enter to search for people"); string searchPhrase = Console.ReadLine(); bool searchOK = true; PeopleSearchResult[] peopleSearchResults = null; Console.WriteLine("\n\nPeople Search Function\n-------------------------------------------"); try { peopleSearchResults = await PeopleSearchResult.searchAsync(searchPhrase, 1); for (int i = 0; i < peopleSearchResults.GetLength(0); i++) { Console.WriteLine("{0}.) {1}", i + 1, peopleSearchResults[i].id); } Console.WriteLine("Total Results: " + peopleSearchResults.GetLength(0)); } catch { searchOK = false; } if (searchOK) { if (peopleSearchResults.GetLength(0) > 0) { Console.WriteLine("Enter people number to retrieve details."); if (Int32.TryParse(Console.ReadLine(), out int searchNum)) { try { PersonResult result = null; if (searchNum <= peopleSearchResults.GetLength(0)) { result = await PersonResult.retrieveDetailsAsync(peopleSearchResults[searchNum - 1].id); result.known_for = peopleSearchResults[searchNum - 1].known_for; } else { throw new NullReferenceException("result is null"); } Console.WriteLine("Selected PersonID: {0}\nName: {1}\nAdult Content: {2}\nProfile Image Path: {3}", result.id, result.name, result.adult ? "Yes" : "No", result.profile_path); if (result.known_for != null) { if (result.known_for.GetLength(0) > 0) { Console.WriteLine("Known for ({0}):", result.known_for.GetLength(0)); for (int i = 0; i < result.known_for.GetLength(0); i++) { MediaSearchResult mediaSearchResult = null; switch (result.known_for[i].mediaType) { case MediaTypeEnum.movie: mediaSearchResult = await MovieResult.retrieveDetailsAsync(result.known_for[i].id); break; case MediaTypeEnum.tv: mediaSearchResult = await TvSeriesResult.retrieveDetailsAsync(result.known_for[i].id); break; } Console.WriteLine("\t{2}.) [{1}] ID: {0}", result.known_for[i].id, result.known_for[i].mediaTypeString, i + 1); if (mediaSearchResult != null) { Console.WriteLine("\t{0} ({1})", mediaSearchResult.name, mediaSearchResult.release_date); } } } } } catch (NullReferenceException ex) { Console.WriteLine("Error: NullReferenceException. Probably number out of range. STACKTRACE: {0}", ex.StackTrace); } } else { Console.WriteLine("\nError: number expected"); } } else { Console.WriteLine("\nNo results found"); } } Console.WriteLine("\n\nPress R to restart or press any key to exit"); if (Console.ReadKey().Key == ConsoleKey.R) { Console.Clear(); await Main(null); } }
public PersonResult getPersonInfo(String response) { PersonResult person = new PersonResult(); HtmlAgilityPack.HtmlDocument doc = new HtmlAgilityPack.HtmlDocument(); doc.LoadHtml(response); person.firstName = doc.DocumentNode.SelectSingleNode("//span[@class='given-name']").InnerHtml; person.lastName = doc.DocumentNode.SelectSingleNode("//span[@class='family-name']").InnerHtml; if (doc.DocumentNode.SelectSingleNode("//span[@class='street-address']") != null) { person.streetAddressName = doc.DocumentNode.SelectSingleNode("//span[@class='street-address']").InnerText; } if (doc.DocumentNode.SelectSingleNode("//span[@class='postal-code']") != null) { person.streetAddressZipcode = doc.DocumentNode.SelectSingleNode("//span[@class='postal-code']").InnerHtml; } if (doc.DocumentNode.SelectSingleNode("//span[@class='locality']") != null) { person.streetAddressCity = doc.DocumentNode.SelectSingleNode("//span[@class='locality']").InnerHtml; } if (doc.DocumentNode.SelectSingleNode("//span[@class='latitude']") != null) { person.coordinateEast = doc.DocumentNode.SelectSingleNode("//span[@class='latitude']").InnerHtml; } if (doc.DocumentNode.SelectSingleNode("//span[@class='longitude']") != null) { person.coordinateNorth = doc.DocumentNode.SelectSingleNode("//span[@class='longitude']").InnerHtml; } HtmlNodeCollection mobilePhoneContainer = doc.DocumentNode.SelectNodes("//span[@class='tel type-phone_normal_mobile']"); if (mobilePhoneContainer != null) { foreach (HtmlAgilityPack.HtmlNode node in mobilePhoneContainer) { var childCollection = node.Descendants(); if (childCollection != null && childCollection.ToList().Count > 0) { foreach (var child in childCollection) { if (child.Name.Equals("a") && child.Attributes["class"] != null && child.Attributes["class"].Value == "value") { person.phone1 = child.InnerHtml; } } } } } HtmlNodeCollection landlinePhoneContainer = doc.DocumentNode.SelectNodes("//span[@class='tel type-phone_normal_land_line']"); if (landlinePhoneContainer != null) { foreach (HtmlAgilityPack.HtmlNode node in landlinePhoneContainer) { var childCollection = node.Descendants(); if (childCollection != null && childCollection.ToList().Count > 0) { foreach (var child in childCollection) { if (child.Name.Equals("a") && child.Attributes["class"] != null && child.Attributes["class"].Value == "value") { person.phone2 = child.InnerHtml; } } } } } return(person); }
// Written, 02.12.2019 static async Task Main(string[] args) { // Written, 02.12.2019 Console.WriteLine("The Library v1.1 Trending Test\nEnter either, 'all', 'movie', 'tv' or 'person' to get trending items"); string mediaTypeInput = Console.ReadLine(); bool vaildTrendingMediaType = true; TrendingAllowedMediaTypesEnum trendMediaType = TrendingAllowedMediaTypesEnum.all; switch (mediaTypeInput) { case "all": trendMediaType = TrendingAllowedMediaTypesEnum.all; break; case "movie": trendMediaType = TrendingAllowedMediaTypesEnum.movie; break; case "tv": trendMediaType = TrendingAllowedMediaTypesEnum.tv; break; case "person": trendMediaType = TrendingAllowedMediaTypesEnum.person; break; default: vaildTrendingMediaType = false; break; } if (vaildTrendingMediaType) { Console.WriteLine("Enter either, 'day' or 'week' to get daily or weekly trending items."); string timeWindowInput = Console.ReadLine(); bool vaildTimeWindowInput = true; TrendingTimeWindowEnum trendingTimeWindow = TrendingTimeWindowEnum.day; switch (timeWindowInput) { case "day": trendingTimeWindow = TrendingTimeWindowEnum.day; break; case "week": trendingTimeWindow = TrendingTimeWindowEnum.week; break; default: vaildTimeWindowInput = false; break; } if (vaildTimeWindowInput) { Trending trending = await Trending.retrieveTrendingAsync(trendMediaType, trendingTimeWindow); for (int i = 0; i < trending.trendingResults.GetLength(0); i++) { IdResultObject idResult = trending.trendingResults[i]; Console.Write("{0}.) [{1}]", i + 1, idResult.GetType().Name); if (idResult is MediaSearchResult) { MediaSearchResult media = idResult as MediaSearchResult; Console.Write(" | {0} ({1})", media.name, media.release_date); } else { if (idResult is PeopleSearchResult) { PersonResult person = await PersonResult.retrieveDetailsAsync(idResult.id); Console.Write(" | {0} ({1})", person.name, person.birthday); } } Console.WriteLine(); } } else { Console.WriteLine("Error: Invaild time window input, '{0}'. Expecting either: 'day' or 'week'.", timeWindowInput); } } else { Console.WriteLine("Error: Invaild trend media type, '{0}'. Expecting one of: 'all', 'movie', 'tv' or 'person'.", mediaTypeInput); } Console.WriteLine("\n\nPress R to restart or press any key to exit"); if (Console.ReadKey().Key == ConsoleKey.R) { Console.Clear(); await Main(null); } }
private string GetSheetName(GroupResult gr, PersonResult pr) { string baseName = gr.TblGroup.GroupName + " " + pr.TblPerson.PersonName; string name = baseName; if (_sheetNameDict.ContainsKey(baseName)) { _sheetNameDict[baseName]++; name = baseName + _sheetNameDict[baseName]; } else { _sheetNameDict[baseName] = 0; } return name; }
/// <summary> /// Processes the info. /// </summary> /// <param name="person">The person.</param> /// <param name="searchResult">The search result.</param> protected void ProcessInfo(Person person, PersonResult searchResult) { person.Overview = searchResult.biography; DateTime date; if (DateTime.TryParseExact(searchResult.birthday, "yyyy-MM-dd", new CultureInfo("en-US"), DateTimeStyles.None, out date)) { person.PremiereDate = date.ToUniversalTime(); } if (DateTime.TryParseExact(searchResult.deathday, "yyyy-MM-dd", new CultureInfo("en-US"), DateTimeStyles.None, out date)) { person.EndDate = date.ToUniversalTime(); } if (!string.IsNullOrEmpty(searchResult.homepage)) { person.HomePageUrl = searchResult.homepage; } if (!person.LockedFields.Contains(MetadataFields.ProductionLocations)) { if (!string.IsNullOrEmpty(searchResult.place_of_birth)) { person.ProductionLocations = new List<string> { searchResult.place_of_birth }; } } person.SetProviderId(MetadataProviders.Tmdb, searchResult.id.ToString(UsCulture)); }