public static string GetOriginalNameIfNotSame(this FilmDetails src) { var localName = src.GetLocalName(); var originalName = src.GetOriginalName(); if (!string.IsNullOrWhiteSpace(originalName) && !string.Equals(localName, originalName)) { return(originalName); } return(string.Empty); }
private static void FillCommonFilmInfo(FilmDetails src, BaseItem dst) { dst.SetProviderId(Utils.ProviderId, Convert.ToString(src.Data.FilmId)); dst.Name = src.GetLocalName(); dst.OriginalTitle = src.GetOriginalNameIfNotSame(); dst.PremiereDate = src.Data.GetPremiereDate(); dst.Overview = src.Data.Description; if (src.Data.Countries != null) { dst.ProductionLocations = src.Data.Countries.Select(c => c.Country).ToArray(); } if (src.Data.Genres != null) { foreach (var genre in src.Data.Genres.Select(c => c.Genre)) { dst.AddGenre(genre); } } if (src.Data.RatingAgeLimits.HasValue) { dst.OfficialRating = $"{src.Data.RatingAgeLimits}+"; } else { dst.OfficialRating = src.Data.RatingMpaa; } if (src.Rating != null) { dst.CommunityRating = src.Rating.Rating > 0 ? src.Rating.Rating : src.Rating.RatingImdb; dst.CriticRating = src.Rating.GetCriticRatingAsTenPointBased(); } if (src.ExternalId != null) { if (!string.IsNullOrWhiteSpace(src.ExternalId.ImdbId)) { dst.SetProviderId(MetadataProvider.Imdb, src.ExternalId.ImdbId); } } }
public static RemoteSearchResult ToRemoteSearchResult(this FilmDetails src) { if (src?.Data is null) { return(null); } var res = new RemoteSearchResult() { Name = src.GetLocalName(), ImageUrl = src.Data.PosterUrl, PremiereDate = src.Data.GetPremiereDate(), Overview = src.Data.Description, SearchProviderName = Utils.ProviderName }; res.SetProviderId(Utils.ProviderId, Convert.ToString(src.Data.FilmId)); return(res); }