The Free Software Media System - Server Backend & API
search refinements
Luke Pulverenti6987f2794aa0
diff --git a/MediaBrowser.Controller/Entities/CollectionFolder.cs b/MediaBrowser.Controller/Entities/CollectionFolder.csindex 2d47cf632e..6628ffc234 100644--- a/MediaBrowser.Controller/Entities/CollectionFolder.cs+++ b/MediaBrowser.Controller/Entities/CollectionFolder.cs@@ -149,7 +149,7 @@ namespace MediaBrowser.Controller.Entitiestry{- locationsDicionary = PhysicalLocations.Distinct().ToDictionary(i => i, StringComparer.OrdinalIgnoreCase);+ locationsDicionary = PhysicalLocations.Distinct(StringComparer.OrdinalIgnoreCase).ToDictionary(i => i, StringComparer.OrdinalIgnoreCase);}catch (IOException ex){@@ -181,7 +181,7 @@ namespace MediaBrowser.Controller.Entitiestry{- locationsDicionary = PhysicalLocations.Distinct().ToDictionary(i => i, StringComparer.OrdinalIgnoreCase);+ locationsDicionary = PhysicalLocations.Distinct(StringComparer.OrdinalIgnoreCase).ToDictionary(i => i, StringComparer.OrdinalIgnoreCase);}catch (IOException ex){diff --git a/MediaBrowser.Providers/Movies/GenericMovieDbInfo.cs b/MediaBrowser.Providers/Movies/GenericMovieDbInfo.csindex c6d5d1502b..bf2be654b4 100644--- a/MediaBrowser.Providers/Movies/GenericMovieDbInfo.cs+++ b/MediaBrowser.Providers/Movies/GenericMovieDbInfo.cs@@ -176,11 +176,16 @@ namespace MediaBrowser.Providers.Movies: null;}- if (movieData.release_date.Year != 1)+ if (!string.IsNullOrWhiteSpace(movieData.release_date)){- //no specific country release info at all- movie.PremiereDate = movieData.release_date.ToUniversalTime();- movie.ProductionYear = movieData.release_date.Year;+ DateTime r;++ // These dates are always in this exact format+ if (DateTime.TryParse(movieData.release_date, _usCulture, DateTimeStyles.None, out r))+ {+ movie.PremiereDate = r.ToUniversalTime();+ movie.ProductionYear = movie.PremiereDate.Value.Year;+ }}//studiosdiff --git a/MediaBrowser.Providers/Movies/MovieDbProvider.cs b/MediaBrowser.Providers/Movies/MovieDbProvider.csindex b40158dd70..05f2d485e6 100644--- a/MediaBrowser.Providers/Movies/MovieDbProvider.cs+++ b/MediaBrowser.Providers/Movies/MovieDbProvider.cs@@ -79,6 +79,18 @@ namespace MediaBrowser.Providers.MoviesImageUrl = string.IsNullOrWhiteSpace(obj.poster_path) ? null : tmdbImageUrl + obj.poster_path};+ if (!string.IsNullOrWhiteSpace(obj.release_date))+ {+ DateTime r;++ // These dates are always in this exact format+ if (DateTime.TryParse(obj.release_date, _usCulture, DateTimeStyles.None, out r))+ {+ remoteResult.PremiereDate = r.ToUniversalTime();+ remoteResult.ProductionYear = remoteResult.PremiereDate.Value.Year;+ }+ }+remoteResult.SetProviderId(MetadataProviders.Tmdb, obj.id.ToString(_usCulture));if (!string.IsNullOrWhiteSpace(obj.imdb_id))@@ -571,7 +583,7 @@ namespace MediaBrowser.Providers.Moviespublic string poster_path { get; set; }public List<ProductionCompany> production_companies { get; set; }public List<ProductionCountry> production_countries { get; set; }- public DateTime release_date { get; set; }+ public string release_date { get; set; }public int revenue { get; set; }public int runtime { get; set; }public List<SpokenLanguage> spoken_languages { get; set; }diff --git a/MediaBrowser.Providers/TV/MovieDbSeriesProvider.cs b/MediaBrowser.Providers/TV/MovieDbSeriesProvider.csindex b149f709ad..fc53d4c151 100644--- a/MediaBrowser.Providers/TV/MovieDbSeriesProvider.cs+++ b/MediaBrowser.Providers/TV/MovieDbSeriesProvider.cs@@ -53,10 +53,6 @@ namespace MediaBrowser.Providers.TVpublic async Task<IEnumerable<RemoteSearchResult>> GetSearchResults(SeriesInfo searchInfo, CancellationToken cancellationToken){- var tmdbSettings = await MovieDbProvider.Current.GetTmdbSettings(cancellationToken).ConfigureAwait(false);-- var tmdbImageUrl = tmdbSettings.images.base_url + "original";-var tmdbId = searchInfo.GetProviderId(MetadataProviders.Tmdb);if (!string.IsNullOrEmpty(tmdbId))@@ -69,6 +65,9 @@ namespace MediaBrowser.Providers.TVvar obj = _jsonSerializer.DeserializeFromFile<RootObject>(dataFilePath);+ var tmdbSettings = await MovieDbProvider.Current.GetTmdbSettings(cancellationToken).ConfigureAwait(false);+ var tmdbImageUrl = tmdbSettings.images.base_url + "original";+var remoteResult = new RemoteSearchResult{Name = obj.name,@@ -95,16 +94,7 @@ namespace MediaBrowser.Providers.TVif (searchResult != null){- var remoteResult = new RemoteSearchResult- {- Name = searchResult.name,- SearchProviderName = Name,- ImageUrl = string.IsNullOrWhiteSpace(searchResult.poster_path) ? null : tmdbImageUrl + searchResult.poster_path- };-- remoteResult.SetProviderId(MetadataProviders.Tmdb, searchResult.id.ToString(_usCulture));-- return new[] { remoteResult };+ return new[] { searchResult };}}@@ -116,16 +106,7 @@ namespace MediaBrowser.Providers.TVif (searchResult != null){- var remoteResult = new RemoteSearchResult- {- Name = searchResult.name,- SearchProviderName = Name,- ImageUrl = string.IsNullOrWhiteSpace(searchResult.poster_path) ? null : tmdbImageUrl + searchResult.poster_path- };-- remoteResult.SetProviderId(MetadataProviders.Tmdb, searchResult.id.ToString(_usCulture));-- return new[] { remoteResult };+ return new[] { searchResult };}}@@ -148,7 +129,7 @@ namespace MediaBrowser.Providers.TVif (searchResult != null){- tmdbId = searchResult.id.ToString(_usCulture);+ tmdbId = searchResult.GetProviderId(MetadataProviders.Tmdb);}}}@@ -163,7 +144,7 @@ namespace MediaBrowser.Providers.TVif (searchResult != null){- tmdbId = searchResult.id.ToString(_usCulture);+ tmdbId = searchResult.GetProviderId(MetadataProviders.Tmdb);}}}@@ -418,7 +399,7 @@ namespace MediaBrowser.Providers.TVreturn false;}- private async Task<MovieDbSearch.TvResult> FindByExternalId(string id, string externalSource, CancellationToken cancellationToken)+ private async Task<RemoteSearchResult> FindByExternalId(string id, string externalSource, CancellationToken cancellationToken){var url = string.Format("http://api.themoviedb.org/3/tv/find/{0}?api_key={1}&external_source={2}",id,@@ -441,7 +422,19 @@ namespace MediaBrowser.Providers.TVif (tv != null){- return tv;+ var tmdbSettings = await MovieDbProvider.Current.GetTmdbSettings(cancellationToken).ConfigureAwait(false);+ var tmdbImageUrl = tmdbSettings.images.base_url + "original";++ var remoteResult = new RemoteSearchResult+ {+ Name = tv.name,+ SearchProviderName = Name,+ ImageUrl = string.IsNullOrWhiteSpace(tv.poster_path) ? null : tmdbImageUrl + tv.poster_path+ };++ remoteResult.SetProviderId(MetadataProviders.Tmdb, tv.id.ToString(_usCulture));++ return remoteResult;}}}diff --git a/MediaBrowser.Server.Implementations/Library/LibraryManager.cs b/MediaBrowser.Server.Implementations/Library/LibraryManager.csindex 66e9e4fa1d..c5cddf40a0 100644--- a/MediaBrowser.Server.Implementations/Library/LibraryManager.cs+++ b/MediaBrowser.Server.Implementations/Library/LibraryManager.cs@@ -922,6 +922,9 @@ namespace MediaBrowser.Server.Implementations.Library/// <returns>Task.</returns>public Task ValidatePeople(CancellationToken cancellationToken, IProgress<double> progress){+ // Ensure the location is unavailable.+ Directory.CreateDirectory(ConfigurationManager.ApplicationPaths.PeoplePath);+return new PeopleValidator(this, _logger).ValidatePeople(cancellationToken, progress);}@@ -933,6 +936,9 @@ namespace MediaBrowser.Server.Implementations.Library/// <returns>Task.</returns>public Task ValidateArtists(CancellationToken cancellationToken, IProgress<double> progress){+ // Ensure the location is unavailable.+ Directory.CreateDirectory(ConfigurationManager.ApplicationPaths.ArtistsPath);+return new ArtistsValidator(this, _userManager, _logger).Run(progress, cancellationToken);}@@ -944,6 +950,9 @@ namespace MediaBrowser.Server.Implementations.Library/// <returns>Task.</returns>public Task ValidateMusicGenres(CancellationToken cancellationToken, IProgress<double> progress){+ // Ensure the location is unavailable.+ Directory.CreateDirectory(ConfigurationManager.ApplicationPaths.MusicGenrePath);+return new MusicGenresValidator(this, _userManager, _logger).Run(progress, cancellationToken);}@@ -955,6 +964,9 @@ namespace MediaBrowser.Server.Implementations.Library/// <returns>Task.</returns>public Task ValidateGameGenres(CancellationToken cancellationToken, IProgress<double> progress){+ // Ensure the location is unavailable.+ Directory.CreateDirectory(ConfigurationManager.ApplicationPaths.GameGenrePath);+return new GameGenresValidator(this, _userManager, _logger).Run(progress, cancellationToken);}@@ -966,6 +978,9 @@ namespace MediaBrowser.Server.Implementations.Library/// <returns>Task.</returns>public Task ValidateStudios(CancellationToken cancellationToken, IProgress<double> progress){+ // Ensure the location is unavailable.+ Directory.CreateDirectory(ConfigurationManager.ApplicationPaths.StudioPath);+return new StudiosValidator(this, _userManager, _logger).Run(progress, cancellationToken);}@@ -977,6 +992,9 @@ namespace MediaBrowser.Server.Implementations.Library/// <returns>Task.</returns>public Task ValidateGenres(CancellationToken cancellationToken, IProgress<double> progress){+ // Ensure the location is unavailable.+ Directory.CreateDirectory(ConfigurationManager.ApplicationPaths.GenrePath);+return new GenresValidator(this, _userManager, _logger).Run(progress, cancellationToken);}