private static void AddGenres(BaseItem item, LastfmTags tags) { foreach (var tag in tags.tag) { item.AddGenre(tag.name); } }
public void addGenresToMovie(BaseItem movie) { var genres = genreExtractorService.extractGenres(movie.Name); foreach (var genre in genres) { if (!movie.Genres.Contains(genre)) { movie.AddGenre(genre); } } movie.Name = genreExtractorService.removeGenresFromMovie(movie.Name); }
private void ParseAdditionalMetadata(BaseItem item, RootObject result) { // Grab series genres because imdb data is better than tvdb. Leave movies alone // But only do it if english is the preferred language because this data will not be localized if (ShouldFetchGenres(item) && !string.IsNullOrWhiteSpace(result.Genre) && !string.Equals(result.Genre, "n/a", StringComparison.OrdinalIgnoreCase)) { item.Genres.Clear(); foreach (var genre in result.Genre .Split(new[] { ',' }, StringSplitOptions.RemoveEmptyEntries) .Select(i => i.Trim()) .Where(i => !string.IsNullOrWhiteSpace(i))) { item.AddGenre(genre); } } var hasMetascore = item as IHasMetascore; if (hasMetascore != null) { float metascore; if (!string.IsNullOrEmpty(result.Metascore) && float.TryParse(result.Metascore, NumberStyles.Any, _usCulture, out metascore) && metascore >= 0) { hasMetascore.Metascore = metascore; } } var hasAwards = item as IHasAwards; if (hasAwards != null && !string.IsNullOrEmpty(result.Awards) && !string.Equals(result.Awards, "n/a", StringComparison.OrdinalIgnoreCase)) { hasAwards.AwardSummary = WebUtility.HtmlDecode(result.Awards); } var hasShortOverview = item as IHasShortOverview; if (hasShortOverview != null) { // Imdb plots are usually pretty short hasShortOverview.ShortOverview = result.Plot; } }
private static void FillCommonFilmInfo(Film src, BaseItem dst) { dst.SetProviderId(Constants.ProviderId, Convert.ToString(src.KinopoiskId)); dst.Name = src.GetLocalName(); dst.OriginalTitle = src.GetOriginalNameIfNotSame(); dst.PremiereDate = src.GetPremiereDate(); if (!string.IsNullOrWhiteSpace(src.Slogan)) { dst.Tagline = src.Slogan; } dst.Overview = src.Description; if (src.Countries != null) { dst.ProductionLocations = src.Countries.Select(c => c.Country1).ToArray(); } if (src.Genres != null) { foreach (var genre in src.Genres.Select(c => c.Genre1)) { dst.AddGenre(genre); } } if (!string.IsNullOrEmpty(src.RatingAgeLimits)) { dst.OfficialRating = $"{src.RatingAgeLimits}+"; } else { dst.OfficialRating = src.RatingMpaa; } dst.CommunityRating = (float)src.RatingKinopoisk; if (dst.CommunityRating < 0.1) { dst.CommunityRating = (float)src.RatingImdb; } if (dst.CommunityRating < 0.1) { dst.CommunityRating = null; } dst.CriticRating = src.GetCriticRatingAsTenPointBased(); if (!string.IsNullOrWhiteSpace(src.ImdbId)) { dst.SetProviderId(MetadataProvider.Imdb, src.ImdbId); } }
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); } } }
private void ParseAdditionalMetadata(BaseItem item, RootObject result) { // Grab series genres because imdb data is better than tvdb. Leave movies alone // But only do it if english is the preferred language because this data will not be localized if (!item.LockedFields.Contains(MetadataFields.Genres) && ShouldFetchGenres(item) && !string.IsNullOrWhiteSpace(result.Genre) && !string.Equals(result.Genre, "n/a", StringComparison.OrdinalIgnoreCase)) { item.Genres.Clear(); foreach (var genre in result.Genre .Split(new[] { ',' }, StringSplitOptions.RemoveEmptyEntries) .Select(i => i.Trim()) .Where(i => !string.IsNullOrWhiteSpace(i))) { item.AddGenre(genre); } } }
/// <summary> /// Processes the main info. /// </summary> /// <param name="movie">The movie.</param> /// <param name="movieData">The movie data.</param> protected virtual void ProcessMainInfo(BaseItem movie, CompleteMovieData movieData) { if (movie != null && movieData != null) { if (!movie.LockedFields.Contains(MetadataFields.Name)) { movie.Name = movieData.title ?? movieData.original_title ?? movie.Name; } if (!movie.LockedFields.Contains(MetadataFields.Overview)) { movie.Overview = WebUtility.HtmlDecode(movieData.overview); } movie.Overview = movie.Overview != null ? movie.Overview.Replace("\n\n", "\n") : null; movie.HomePageUrl = movieData.homepage; movie.Budget = movieData.budget; movie.Revenue = movieData.revenue; if (!string.IsNullOrEmpty(movieData.tagline)) { movie.Taglines.Clear(); movie.AddTagline(movieData.tagline); } movie.SetProviderId(MetadataProviders.Imdb, movieData.imdb_id); if (movieData.belongs_to_collection != null) { movie.SetProviderId(MetadataProviders.TmdbCollection, movieData.belongs_to_collection.id.ToString(CultureInfo.InvariantCulture)); } float rating; string voteAvg = movieData.vote_average.ToString(CultureInfo.InvariantCulture); //tmdb appears to have unified their numbers to always report "7.3" regardless of country // so I removed the culture-specific processing here because it was not working for other countries -ebr if (float.TryParse(voteAvg, NumberStyles.AllowDecimalPoint, CultureInfo.InvariantCulture, out rating)) movie.CommunityRating = rating; movie.VoteCount = movieData.vote_count; //release date and certification are retrieved based on configured country and we fall back on US if not there and to minimun release date if still no match if (movieData.releases != null && movieData.releases.countries != null) { var ourRelease = movieData.releases.countries.FirstOrDefault(c => c.iso_3166_1.Equals(ConfigurationManager.Configuration.MetadataCountryCode, StringComparison.OrdinalIgnoreCase)) ?? new Country(); var usRelease = movieData.releases.countries.FirstOrDefault(c => c.iso_3166_1.Equals("US", StringComparison.OrdinalIgnoreCase)) ?? new Country(); var minimunRelease = movieData.releases.countries.OrderBy(c => c.release_date).FirstOrDefault() ?? new Country(); var ratingPrefix = ConfigurationManager.Configuration.MetadataCountryCode.Equals("us", StringComparison.OrdinalIgnoreCase) ? "" : ConfigurationManager.Configuration.MetadataCountryCode + "-"; movie.OfficialRating = !string.IsNullOrEmpty(ourRelease.certification) ? ratingPrefix + ourRelease.certification : !string.IsNullOrEmpty(usRelease.certification) ? usRelease.certification : !string.IsNullOrEmpty(minimunRelease.certification) ? minimunRelease.iso_3166_1 + "-" + minimunRelease.certification : null; if (ourRelease.release_date != default(DateTime)) { if (ourRelease.release_date.Year != 1) { movie.PremiereDate = ourRelease.release_date.ToUniversalTime(); movie.ProductionYear = ourRelease.release_date.Year; } } else if (usRelease.release_date != default(DateTime)) { if (usRelease.release_date.Year != 1) { movie.PremiereDate = usRelease.release_date.ToUniversalTime(); movie.ProductionYear = usRelease.release_date.Year; } } else if (minimunRelease.release_date != default(DateTime)) { if (minimunRelease.release_date.Year != 1) { movie.PremiereDate = minimunRelease.release_date.ToUniversalTime(); movie.ProductionYear = minimunRelease.release_date.Year; } } } else { if (movieData.release_date.Year != 1) { //no specific country release info at all movie.PremiereDate = movieData.release_date.ToUniversalTime(); movie.ProductionYear = movieData.release_date.Year; } } //if that didn't find a rating and we are a boxset, use the one from our first child if (movie.OfficialRating == null && movie is BoxSet) { var boxset = movie as BoxSet; Logger.Info("MovieDbProvider - Using rating of first child of boxset..."); var firstChild = boxset.Children.Concat(boxset.GetLinkedChildren()).FirstOrDefault(); boxset.OfficialRating = firstChild != null ? firstChild.OfficialRating : null; } if (movieData.runtime > 0) movie.OriginalRunTimeTicks = TimeSpan.FromMinutes(movieData.runtime).Ticks; //studios if (movieData.production_companies != null && !movie.LockedFields.Contains(MetadataFields.Studios)) { movie.Studios.Clear(); foreach (var studio in movieData.production_companies.Select(c => c.name)) { movie.AddStudio(studio); } } //genres if (movieData.genres != null && !movie.LockedFields.Contains(MetadataFields.Genres)) { movie.Genres.Clear(); foreach (var genre in movieData.genres.Select(g => g.name)) { movie.AddGenre(genre); } } if (!movie.LockedFields.Contains(MetadataFields.Cast)) { movie.People.Clear(); //Actors, Directors, Writers - all in People //actors come from cast if (movieData.casts != null && movieData.casts.cast != null) { foreach (var actor in movieData.casts.cast.OrderBy(a => a.order)) movie.AddPerson(new PersonInfo { Name = actor.name.Trim(), Role = actor.character, Type = PersonType.Actor }); } //and the rest from crew if (movieData.casts != null && movieData.casts.crew != null) { foreach (var person in movieData.casts.crew) movie.AddPerson(new PersonInfo { Name = person.name.Trim(), Role = person.job, Type = person.department }); } } if (movieData.keywords != null && movieData.keywords.keywords != null && !movie.LockedFields.Contains(MetadataFields.Tags)) { movie.Tags = movieData.keywords.keywords.Select(i => i.name).ToList(); } if (movieData.trailers != null && movieData.trailers.youtube != null && movieData.trailers.youtube.Count > 0) { movie.RemoteTrailers = movieData.trailers.youtube.Select(i => new MediaUrl { Url = string.Format("http://www.youtube.com/watch?v={0}", i.source), IsDirectLink = false, Name = i.name, VideoSize = string.Equals("hd", i.size, StringComparison.OrdinalIgnoreCase) ? VideoSize.HighDefinition : VideoSize.StandardDefinition }).ToList(); } } }
/// <summary> /// Processes the main info. /// </summary> /// <param name="movie">The movie.</param> /// <param name="movieData">The movie data.</param> protected virtual void ProcessMainInfo(BaseItem movie, CompleteMovieData movieData) { if (movie != null && movieData != null) { if (!movie.LockedFields.Contains(MetadataFields.Name)) { movie.Name = movieData.title ?? movieData.original_title ?? movieData.name ?? movie.Name; } if (!movie.LockedFields.Contains(MetadataFields.Overview)) { movie.Overview = WebUtility.HtmlDecode(movieData.overview); movie.Overview = movie.Overview != null?movie.Overview.Replace("\n\n", "\n") : null; } movie.HomePageUrl = movieData.homepage; movie.Budget = movieData.budget; movie.Revenue = movieData.revenue; if (!string.IsNullOrEmpty(movieData.tagline)) { movie.Taglines.Clear(); movie.AddTagline(movieData.tagline); } movie.SetProviderId(MetadataProviders.Imdb, movieData.imdb_id); if (movieData.belongs_to_collection != null) { movie.SetProviderId(MetadataProviders.TmdbCollection, movieData.belongs_to_collection.id.ToString(CultureInfo.InvariantCulture)); } else { movie.SetProviderId(MetadataProviders.TmdbCollection, null); // clear out any old entry } float rating; string voteAvg = movieData.vote_average.ToString(CultureInfo.InvariantCulture); //tmdb appears to have unified their numbers to always report "7.3" regardless of country // so I removed the culture-specific processing here because it was not working for other countries -ebr if (float.TryParse(voteAvg, NumberStyles.AllowDecimalPoint, CultureInfo.InvariantCulture, out rating)) { movie.CommunityRating = rating; } movie.VoteCount = movieData.vote_count; //release date and certification are retrieved based on configured country and we fall back on US if not there and to minimun release date if still no match if (movieData.releases != null && movieData.releases.countries != null) { var ourRelease = movieData.releases.countries.FirstOrDefault(c => c.iso_3166_1.Equals(ConfigurationManager.Configuration.MetadataCountryCode, StringComparison.OrdinalIgnoreCase)) ?? new Country(); var usRelease = movieData.releases.countries.FirstOrDefault(c => c.iso_3166_1.Equals("US", StringComparison.OrdinalIgnoreCase)) ?? new Country(); var minimunRelease = movieData.releases.countries.OrderBy(c => c.release_date).FirstOrDefault() ?? new Country(); var ratingPrefix = ConfigurationManager.Configuration.MetadataCountryCode.Equals("us", StringComparison.OrdinalIgnoreCase) ? "" : ConfigurationManager.Configuration.MetadataCountryCode + "-"; movie.OfficialRating = !string.IsNullOrEmpty(ourRelease.certification) ? ratingPrefix + ourRelease.certification : !string.IsNullOrEmpty(usRelease.certification) ? usRelease.certification : !string.IsNullOrEmpty(minimunRelease.certification) ? minimunRelease.iso_3166_1 + "-" + minimunRelease.certification : null; if (ourRelease.release_date != default(DateTime)) { if (ourRelease.release_date.Year != 1) { movie.PremiereDate = ourRelease.release_date.ToUniversalTime(); movie.ProductionYear = ourRelease.release_date.Year; } } else if (usRelease.release_date != default(DateTime)) { if (usRelease.release_date.Year != 1) { movie.PremiereDate = usRelease.release_date.ToUniversalTime(); movie.ProductionYear = usRelease.release_date.Year; } } else if (minimunRelease.release_date != default(DateTime)) { if (minimunRelease.release_date.Year != 1) { movie.PremiereDate = minimunRelease.release_date.ToUniversalTime(); movie.ProductionYear = minimunRelease.release_date.Year; } } } else { if (movieData.release_date.Year != 1) { //no specific country release info at all movie.PremiereDate = movieData.release_date.ToUniversalTime(); movie.ProductionYear = movieData.release_date.Year; } } //if that didn't find a rating and we are a boxset, use the one from our first child if (movie.OfficialRating == null && movie is BoxSet) { var boxset = movie as BoxSet; Logger.Info("MovieDbProvider - Using rating of first child of boxset..."); var firstChild = boxset.Children.Concat(boxset.GetLinkedChildren()).FirstOrDefault(); boxset.OfficialRating = firstChild != null ? firstChild.OfficialRating : null; } if (movieData.runtime > 0) { movie.OriginalRunTimeTicks = TimeSpan.FromMinutes(movieData.runtime).Ticks; } //studios if (movieData.production_companies != null && !movie.LockedFields.Contains(MetadataFields.Studios)) { movie.Studios.Clear(); foreach (var studio in movieData.production_companies.Select(c => c.name)) { movie.AddStudio(studio); } } //genres if (movieData.genres != null && !movie.LockedFields.Contains(MetadataFields.Genres)) { movie.Genres.Clear(); foreach (var genre in movieData.genres.Select(g => g.name)) { movie.AddGenre(genre); } } if (!movie.LockedFields.Contains(MetadataFields.Cast)) { movie.People.Clear(); //Actors, Directors, Writers - all in People //actors come from cast if (movieData.casts != null && movieData.casts.cast != null) { foreach (var actor in movieData.casts.cast.OrderBy(a => a.order)) { movie.AddPerson(new PersonInfo { Name = actor.name.Trim(), Role = actor.character, Type = PersonType.Actor }); } } //and the rest from crew if (movieData.casts != null && movieData.casts.crew != null) { foreach (var person in movieData.casts.crew) { movie.AddPerson(new PersonInfo { Name = person.name.Trim(), Role = person.job, Type = person.department }); } } } if (movieData.keywords != null && movieData.keywords.keywords != null && !movie.LockedFields.Contains(MetadataFields.Tags)) { movie.Tags = movieData.keywords.keywords.Select(i => i.name).ToList(); } if (movieData.trailers != null && movieData.trailers.youtube != null && movieData.trailers.youtube.Count > 0) { movie.RemoteTrailers = movieData.trailers.youtube.Select(i => new MediaUrl { Url = string.Format("http://www.youtube.com/watch?v={0}", i.source), IsDirectLink = false, Name = i.name, VideoSize = string.Equals("hd", i.size, StringComparison.OrdinalIgnoreCase) ? VideoSize.HighDefinition : VideoSize.StandardDefinition }).ToList(); } } }
/// <summary> /// Processes the main info. /// </summary> /// <param name="movie">The movie.</param> /// <param name="movieData">The movie data.</param> private void ProcessMainInfo(BaseItem movie, CompleteMovieData movieData) { if (!movie.LockedFields.Contains(MetadataFields.Name)) { movie.Name = movieData.title ?? movieData.original_title ?? movieData.name ?? movie.Name; } if (!movie.LockedFields.Contains(MetadataFields.Overview)) { // Bug in Mono: WebUtility.HtmlDecode should return null if the string is null but in Mono it generate an System.ArgumentNullException. movie.Overview = movieData.overview != null ? WebUtility.HtmlDecode(movieData.overview) : null; movie.Overview = movie.Overview != null ? movie.Overview.Replace("\n\n", "\n") : null; } movie.HomePageUrl = movieData.homepage; var hasBudget = movie as IHasBudget; if (hasBudget != null) { hasBudget.Budget = movieData.budget; hasBudget.Revenue = movieData.revenue; } if (!string.IsNullOrEmpty(movieData.tagline)) { var hasTagline = movie as IHasTaglines; if (hasTagline != null) { hasTagline.Taglines.Clear(); hasTagline.AddTagline(movieData.tagline); } } movie.SetProviderId(MetadataProviders.Tmdb, movieData.id.ToString(_usCulture)); movie.SetProviderId(MetadataProviders.Imdb, movieData.imdb_id); if (movieData.belongs_to_collection != null) { movie.SetProviderId(MetadataProviders.TmdbCollection, movieData.belongs_to_collection.id.ToString(CultureInfo.InvariantCulture)); var movieItem = movie as Movie; if (movieItem != null) { movieItem.TmdbCollectionName = movieData.belongs_to_collection.name; } } else { movie.SetProviderId(MetadataProviders.TmdbCollection, null); // clear out any old entry } float rating; string voteAvg = movieData.vote_average.ToString(CultureInfo.InvariantCulture); // tmdb appears to have unified their numbers to always report "7.3" regardless of country // so I removed the culture-specific processing here because it was not working for other countries -ebr // Movies get this from imdb if (!(movie is Movie) && float.TryParse(voteAvg, NumberStyles.AllowDecimalPoint, CultureInfo.InvariantCulture, out rating)) { movie.CommunityRating = rating; } // Movies get this from imdb if (!(movie is Movie)) { movie.VoteCount = movieData.vote_count; } var preferredCountryCode = movie.GetPreferredMetadataCountryCode(); //release date and certification are retrieved based on configured country and we fall back on US if not there and to minimun release date if still no match if (movieData.releases != null && movieData.releases.countries != null) { var ourRelease = movieData.releases.countries.FirstOrDefault(c => c.iso_3166_1.Equals(preferredCountryCode, StringComparison.OrdinalIgnoreCase)) ?? new Country(); var usRelease = movieData.releases.countries.FirstOrDefault(c => c.iso_3166_1.Equals("US", StringComparison.OrdinalIgnoreCase)) ?? new Country(); var minimunRelease = movieData.releases.countries.OrderBy(c => c.release_date).FirstOrDefault() ?? new Country(); if (!movie.LockedFields.Contains(MetadataFields.OfficialRating)) { var ratingPrefix = string.Equals(preferredCountryCode, "us", StringComparison.OrdinalIgnoreCase) ? "" : preferredCountryCode + "-"; movie.OfficialRating = !string.IsNullOrEmpty(ourRelease.certification) ? ratingPrefix + ourRelease.certification : !string.IsNullOrEmpty(usRelease.certification) ? usRelease.certification : !string.IsNullOrEmpty(minimunRelease.certification) ? minimunRelease.iso_3166_1 + "-" + minimunRelease.certification : null; } } if (movieData.release_date.Year != 1) { //no specific country release info at all movie.PremiereDate = movieData.release_date.ToUniversalTime(); movie.ProductionYear = movieData.release_date.Year; } // If that didn't find a rating and we are a boxset, use the one from our first child if (movie.OfficialRating == null && movie is BoxSet && !movie.LockedFields.Contains(MetadataFields.OfficialRating)) { var boxset = movie as BoxSet; Logger.Info("MovieDbProvider - Using rating of first child of boxset..."); var firstChild = boxset.Children.Concat(boxset.GetLinkedChildren()).FirstOrDefault(); boxset.OfficialRating = firstChild != null ? firstChild.OfficialRating : null; } //studios if (movieData.production_companies != null && !movie.LockedFields.Contains(MetadataFields.Studios)) { movie.Studios.Clear(); foreach (var studio in movieData.production_companies.Select(c => c.name)) { movie.AddStudio(studio); } } // genres // Movies get this from imdb var genres = movieData.genres ?? new List<GenreItem>(); if (!movie.LockedFields.Contains(MetadataFields.Genres)) { // Only grab them if a boxset or there are no genres. // For movies and trailers we'll use imdb via omdb // But omdb data is for english users only so fetch if language is not english if (!(movie is Movie) || movie.Genres.Count == 0 || !string.Equals(movie.GetPreferredMetadataLanguage(), "en", StringComparison.OrdinalIgnoreCase)) { movie.Genres.Clear(); foreach (var genre in genres.Select(g => g.name)) { movie.AddGenre(genre); } } } if (!movie.LockedFields.Contains(MetadataFields.Cast)) { movie.People.Clear(); //Actors, Directors, Writers - all in People //actors come from cast if (movieData.casts != null && movieData.casts.cast != null) { foreach (var actor in movieData.casts.cast.OrderBy(a => a.order)) movie.AddPerson(new PersonInfo { Name = actor.name.Trim(), Role = actor.character, Type = PersonType.Actor, SortOrder = actor.order }); } //and the rest from crew if (movieData.casts != null && movieData.casts.crew != null) { foreach (var person in movieData.casts.crew) movie.AddPerson(new PersonInfo { Name = person.name.Trim(), Role = person.job, Type = person.department }); } } if (movieData.keywords != null && movieData.keywords.keywords != null && !movie.LockedFields.Contains(MetadataFields.Keywords)) { var hasTags = movie as IHasKeywords; if (hasTags != null) { hasTags.Keywords = movieData.keywords.keywords.Select(i => i.name).ToList(); } } if (movieData.trailers != null && movieData.trailers.youtube != null && movieData.trailers.youtube.Count > 0) { var hasTrailers = movie as IHasTrailers; if (hasTrailers != null) { hasTrailers.RemoteTrailers = movieData.trailers.youtube.Select(i => new MediaUrl { Url = string.Format("http://www.youtube.com/watch?v={0}", i.source), IsDirectLink = false, Name = i.name, VideoSize = string.Equals("hd", i.size, StringComparison.OrdinalIgnoreCase) ? VideoSize.HighDefinition : VideoSize.StandardDefinition }).ToList(); } } }
private void ParseAdditionalMetadata(BaseItem item, RootObject result) { // Grab series genres because imdb data is better than tvdb. Leave movies alone // But only do it if english is the preferred language because this data will not be localized if (!item.LockedFields.Contains(MetadataFields.Genres) && item is Series && !string.IsNullOrWhiteSpace(result.Genre) && !string.Equals(result.Genre, "n/a", StringComparison.OrdinalIgnoreCase) && string.Equals(ConfigurationManager.Configuration.PreferredMetadataLanguage, "en")) { item.Genres.Clear(); foreach (var genre in result.Genre .Split(new[] { ',' }, StringSplitOptions.RemoveEmptyEntries) .Select(i => i.Trim()) .Where(i => !string.IsNullOrWhiteSpace(i))) { item.AddGenre(genre); } } }