|
|
@ -22,11 +22,16 @@ namespace MediaBrowser.Providers.Plugins.Tmdb.Movies
|
|
|
|
{
|
|
|
|
{
|
|
|
|
public class TmdbSearch
|
|
|
|
public class TmdbSearch
|
|
|
|
{
|
|
|
|
{
|
|
|
|
|
|
|
|
private const string SearchUrl = TmdbUtils.BaseTmdbApiUrl + @"3/search/{3}?api_key={1}&query={0}&language={2}";
|
|
|
|
|
|
|
|
private const string SearchUrlTvWithYear = TmdbUtils.BaseTmdbApiUrl + @"3/search/tv?api_key={1}&query={0}&language={2}&first_air_date_year={3}";
|
|
|
|
|
|
|
|
private const string SearchUrlMovieWithYear = TmdbUtils.BaseTmdbApiUrl + @"3/search/movie?api_key={1}&query={0}&language={2}&primary_release_year={3}";
|
|
|
|
|
|
|
|
|
|
|
|
private static readonly CultureInfo _usCulture = new CultureInfo("en-US");
|
|
|
|
private static readonly CultureInfo _usCulture = new CultureInfo("en-US");
|
|
|
|
|
|
|
|
|
|
|
|
private static readonly Regex _cleanEnclosed = new Regex(@"\p{Ps}.*\p{Pe}", RegexOptions.Compiled);
|
|
|
|
private static readonly Regex _cleanEnclosed = new Regex(@"\p{Ps}.*\p{Pe}", RegexOptions.Compiled);
|
|
|
|
private static readonly Regex _cleanNonWord = new Regex(@"[\W_]+", RegexOptions.Compiled);
|
|
|
|
private static readonly Regex _cleanNonWord = new Regex(@"[\W_]+", RegexOptions.Compiled);
|
|
|
|
private static readonly Regex _cleanStopWords = new Regex(@"\b( # Start at word boundary
|
|
|
|
private static readonly Regex _cleanStopWords = new Regex(
|
|
|
|
|
|
|
|
@"\b( # Start at word boundary
|
|
|
|
19[0-9]{2}|20[0-9]{2}| # 1900-2099
|
|
|
|
19[0-9]{2}|20[0-9]{2}| # 1900-2099
|
|
|
|
S[0-9]{2}| # Season
|
|
|
|
S[0-9]{2}| # Season
|
|
|
|
E[0-9]{2}| # Episode
|
|
|
|
E[0-9]{2}| # Episode
|
|
|
@ -37,9 +42,6 @@ namespace MediaBrowser.Providers.Plugins.Tmdb.Movies
|
|
|
|
).* # Match rest of string",
|
|
|
|
).* # Match rest of string",
|
|
|
|
RegexOptions.Compiled | RegexOptions.IgnorePatternWhitespace | RegexOptions.IgnoreCase);
|
|
|
|
RegexOptions.Compiled | RegexOptions.IgnorePatternWhitespace | RegexOptions.IgnoreCase);
|
|
|
|
|
|
|
|
|
|
|
|
private const string SearchUrl = TmdbUtils.BaseTmdbApiUrl + @"3/search/{3}?api_key={1}&query={0}&language={2}";
|
|
|
|
|
|
|
|
private const string SearchUrlTvWithYear = TmdbUtils.BaseTmdbApiUrl + @"3/search/tv?api_key={1}&query={0}&language={2}&first_air_date_year={3}";
|
|
|
|
|
|
|
|
private const string SearchUrlMovieWithYear = TmdbUtils.BaseTmdbApiUrl + @"3/search/movie?api_key={1}&query={0}&language={2}&primary_release_year={3}";
|
|
|
|
|
|
|
|
private readonly ILogger _logger;
|
|
|
|
private readonly ILogger _logger;
|
|
|
|
private readonly IJsonSerializer _json;
|
|
|
|
private readonly IJsonSerializer _json;
|
|
|
|
private readonly ILibraryManager _libraryManager;
|
|
|
|
private readonly ILibraryManager _libraryManager;
|
|
|
@ -190,7 +192,7 @@ namespace MediaBrowser.Providers.Plugins.Tmdb.Movies
|
|
|
|
type);
|
|
|
|
type);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
var requestMessage = new HttpRequestMessage(HttpMethod.Get, url3);
|
|
|
|
using var requestMessage = new HttpRequestMessage(HttpMethod.Get, url3);
|
|
|
|
foreach (var header in TmdbUtils.AcceptHeaders)
|
|
|
|
foreach (var header in TmdbUtils.AcceptHeaders)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
requestMessage.Headers.Accept.Add(new MediaTypeWithQualityHeaderValue(header));
|
|
|
|
requestMessage.Headers.Accept.Add(new MediaTypeWithQualityHeaderValue(header));
|
|
|
@ -268,7 +270,12 @@ namespace MediaBrowser.Providers.Plugins.Tmdb.Movies
|
|
|
|
return results
|
|
|
|
return results
|
|
|
|
.Select(i =>
|
|
|
|
.Select(i =>
|
|
|
|
{
|
|
|
|
{
|
|
|
|
var remoteResult = new RemoteSearchResult {SearchProviderName = TmdbMovieProvider.Current.Name, Name = i.Name ?? i.Original_Name, ImageUrl = string.IsNullOrWhiteSpace(i.Poster_Path) ? null : baseImageUrl + i.Poster_Path};
|
|
|
|
var remoteResult = new RemoteSearchResult
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
SearchProviderName = TmdbMovieProvider.Current.Name,
|
|
|
|
|
|
|
|
Name = i.Name ?? i.Original_Name,
|
|
|
|
|
|
|
|
ImageUrl = string.IsNullOrWhiteSpace(i.Poster_Path) ? null : baseImageUrl + i.Poster_Path
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
if (!string.IsNullOrWhiteSpace(i.First_Air_Date))
|
|
|
|
if (!string.IsNullOrWhiteSpace(i.First_Air_Date))
|
|
|
|
{
|
|
|
|
{
|
|
|
|