aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLuke Pulverenti <luke.pulverenti@gmail.com>2014-03-02 13:01:46 -0500
committerLuke Pulverenti <luke.pulverenti@gmail.com>2014-03-02 13:01:46 -0500
commit6987f2794aa0bb547072924c0a44aba7baf95350 (patch)
tree11adf0d1490975fab9b2b5d8c35a140f4eb2e1ab
parent043bef0a51ad8818097280c72f6625c29e680088 (diff)
search refinements
-rw-r--r--MediaBrowser.Controller/Entities/CollectionFolder.cs4
-rw-r--r--MediaBrowser.Providers/Movies/GenericMovieDbInfo.cs13
-rw-r--r--MediaBrowser.Providers/Movies/MovieDbProvider.cs14
-rw-r--r--MediaBrowser.Providers/TV/MovieDbSeriesProvider.cs49
-rw-r--r--MediaBrowser.Server.Implementations/Library/LibraryManager.cs18
5 files changed, 63 insertions, 35 deletions
diff --git a/MediaBrowser.Controller/Entities/CollectionFolder.cs b/MediaBrowser.Controller/Entities/CollectionFolder.cs
index 2d47cf632..6628ffc23 100644
--- a/MediaBrowser.Controller/Entities/CollectionFolder.cs
+++ b/MediaBrowser.Controller/Entities/CollectionFolder.cs
@@ -149,7 +149,7 @@ namespace MediaBrowser.Controller.Entities
try
{
- 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.Entities
try
{
- 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.cs
index c6d5d1502..bf2be654b 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;
+ }
}
//studios
diff --git a/MediaBrowser.Providers/Movies/MovieDbProvider.cs b/MediaBrowser.Providers/Movies/MovieDbProvider.cs
index b40158dd7..05f2d485e 100644
--- a/MediaBrowser.Providers/Movies/MovieDbProvider.cs
+++ b/MediaBrowser.Providers/Movies/MovieDbProvider.cs
@@ -79,6 +79,18 @@ namespace MediaBrowser.Providers.Movies
ImageUrl = 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.Movies
public 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.cs
index b149f709a..fc53d4c15 100644
--- a/MediaBrowser.Providers/TV/MovieDbSeriesProvider.cs
+++ b/MediaBrowser.Providers/TV/MovieDbSeriesProvider.cs
@@ -53,10 +53,6 @@ namespace MediaBrowser.Providers.TV
public 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.TV
var 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.TV
if (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.TV
if (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.TV
if (searchResult != null)
{
- tmdbId = searchResult.id.ToString(_usCulture);
+ tmdbId = searchResult.GetProviderId(MetadataProviders.Tmdb);
}
}
}
@@ -163,7 +144,7 @@ namespace MediaBrowser.Providers.TV
if (searchResult != null)
{
- tmdbId = searchResult.id.ToString(_usCulture);
+ tmdbId = searchResult.GetProviderId(MetadataProviders.Tmdb);
}
}
}
@@ -418,7 +399,7 @@ namespace MediaBrowser.Providers.TV
return 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.TV
if (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.cs
index 66e9e4fa1..c5cddf40a 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);
}