search refinements

pull/702/head
Luke Pulverenti 10 years ago
parent 043bef0a51
commit 6987f2794a

@ -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)
{

@ -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

@ -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; }

@ -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;
}
}
}

@ -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);
}

Loading…
Cancel
Save