Added the new advanced search into the search page too.

pull/332/head
tidusjar 9 years ago
parent 7ca1272ca4
commit 89db8eb728

@ -114,7 +114,7 @@ namespace PlexRequests.Services.Jobs
matchResult = IsMovieAvailable(movies, r.Title, releaseDate, r.ImdbId); matchResult = IsMovieAvailable(movies, r.Title, releaseDate, r.ImdbId);
break; break;
case RequestType.TvShow: case RequestType.TvShow:
matchResult = IsTvShowAvailable(shows, r.Title, releaseDate, r.ProviderId.ToString()); matchResult = IsTvShowAvailable(shows, r.Title, releaseDate, r.TvDbId);
break; break;
case RequestType.Album: case RequestType.Album:
matchResult = IsAlbumAvailable(albums, r.Title, r.ReleaseDate.Year.ToString(), r.ArtistName); matchResult = IsAlbumAvailable(albums, r.Title, r.ReleaseDate.Year.ToString(), r.ArtistName);

@ -279,6 +279,7 @@ namespace PlexRequests.UI.Modules
private async Task<Response> SearchTvShow(string searchTerm) private async Task<Response> SearchTvShow(string searchTerm)
{ {
var plexSettings = await PlexService.GetSettingsAsync();
Log.Trace("Searching for TV Show {0}", searchTerm); Log.Trace("Searching for TV Show {0}", searchTerm);
var apiTv = new List<TvMazeSearch>(); var apiTv = new List<TvMazeSearch>();
@ -327,7 +328,15 @@ namespace PlexRequests.UI.Modules
Status = t.show.status Status = t.show.status
}; };
if (Checker.IsTvShowAvailable(plexTvShows.ToArray(), t.show.name, t.show.premiered?.Substring(0, 4)))
var providerId = string.Empty;
if (plexSettings.AdvancedSearch)
{
providerId = viewT.Id.ToString();
}
if (Checker.IsTvShowAvailable(plexTvShows.ToArray(), t.show.name, t.show.premiered?.Substring(0, 4), providerId))
{ {
viewT.Available = true; viewT.Available = true;
} }
@ -575,7 +584,13 @@ namespace PlexRequests.UI.Modules
try try
{ {
var shows = Checker.GetPlexTvShows(); var shows = Checker.GetPlexTvShows();
if (Checker.IsTvShowAvailable(shows.ToArray(), showInfo.name, showInfo.premiered?.Substring(0, 4))) var providerId = string.Empty;
var plexSettings = await PlexService.GetSettingsAsync();
if (plexSettings.AdvancedSearch)
{
providerId = showId.ToString();
}
if (Checker.IsTvShowAvailable(shows.ToArray(), showInfo.name, showInfo.premiered?.Substring(0, 4), providerId))
{ {
return Response.AsJson(new JsonResponseModel { Result = false, Message = $"{fullShowName} is already in Plex!" }); return Response.AsJson(new JsonResponseModel { Result = false, Message = $"{fullShowName} is already in Plex!" });
} }
@ -602,7 +617,7 @@ namespace PlexRequests.UI.Modules
Issues = IssueState.None, Issues = IssueState.None,
ImdbId = showInfo.externals?.imdb ?? string.Empty, ImdbId = showInfo.externals?.imdb ?? string.Empty,
SeasonCount = showInfo.seasonCount, SeasonCount = showInfo.seasonCount,
TvDbId = showInfo.externals?.thetvdb?.ToString() ?? string.Empty, TvDbId = showId.ToString()
}; };
var seasonsList = new List<int>(); var seasonsList = new List<int>();

Loading…
Cancel
Save