public IndexerPageableRequestChain GetSearchRequests(TvSearchCriteria searchCriteria) { var pageableRequests = new IndexerPageableRequestChain(); var query = new TorrentQuery(); var tvdbId = searchCriteria.TvdbId.GetValueOrDefault(0); var imdbId = ParseUtil.GetImdbID(searchCriteria.ImdbId).GetValueOrDefault(0); if (searchCriteria.Categories?.Length > 0) { query.Category = Capabilities.Categories.MapTorznabCapsToTrackers(searchCriteria.Categories).Select(int.Parse).ToArray(); } if (tvdbId == 0 && imdbId == 0 && searchCriteria.SearchTerm.IsNotNullOrWhiteSpace()) { query.Search = searchCriteria.SanitizedTvSearchString; } if (tvdbId != 0) { query.TvdbInfo = query.TvdbInfo ?? new TvdbInfo(); query.TvdbInfo.Id = tvdbId; query.TvdbInfo.Season = searchCriteria.Season; query.TvdbInfo.Episode = searchCriteria.Episode; } if (imdbId != 0) { query.ImdbInfo = query.ImdbInfo ?? new ImdbInfo(); query.ImdbInfo.Id = imdbId; } pageableRequests.Add(GetRequest(query)); return(pageableRequests); }
private IEnumerable <IndexerRequest> GetRequest(TorrentQuery query) { var request = new HttpRequestBuilder(Settings.BaseUrl) .Resource("/api/torrents") .Build(); request.Method = HttpMethod.POST; const string appJson = "application/json"; request.Headers.Accept = appJson; request.Headers.ContentType = appJson; query.Username = Settings.Username; query.Passkey = Settings.ApiKey; query.Category = Settings.Categories.ToArray(); query.Codec = Settings.Codecs.ToArray(); query.Medium = Settings.Mediums.ToArray(); // Require Internal only if came from RSS sync if (Settings.RequireInternal && query.ImdbInfo == null) { query.Origin = 1; } request.SetContent(query.ToJson()); yield return(new IndexerRequest(request)); }
private bool TryAddSearchParameters(TorrentQuery query, SearchCriteriaBase searchCriteria) { if (searchCriteria.Series.TvdbId != 0) { query.TvdbInfo = query.TvdbInfo ?? new TvdbInfo(); query.TvdbInfo.Id = searchCriteria.Series.TvdbId; return(true); } return(false); }
public virtual IndexerPageableRequestChain GetSearchRequests(MovieSearchCriteria searchCriteria) { var pageableRequests = new IndexerPageableRequestChain(); var query = new TorrentQuery(); if (TryAddSearchParameters(query, searchCriteria)) { pageableRequests.Add(GetRequest(query)); } return(pageableRequests); }
private bool TryAddSearchParameters(TorrentQuery query, SearchCriteriaBase searchCriteria) { var imdbId = int.Parse(searchCriteria.Movie.ImdbId.Substring(2)); if (imdbId != 0) { query.ImdbInfo = query.ImdbInfo ?? new ImdbInfo(); query.ImdbInfo.Id = imdbId; return(true); } return(false); }
public virtual IndexerPageableRequestChain GetSearchRequests(MovieSearchCriteria searchCriteria) { var pageableRequests = new IndexerPageableRequestChain(); var queryBase = new TorrentQuery(); if (TryAddSearchParameters(queryBase, searchCriteria)) { var query = queryBase.Clone(); query.ImdbInfo.Id = int.Parse(searchCriteria.Movie.ImdbId.Substring(2)); pageableRequests.Add(GetRequest(query)); } return(pageableRequests); }
public IList<IEnumerable<IndexerRequest>> GetSearchRequests(DailyEpisodeSearchCriteria searchCriteria) { var requests = new List<IEnumerable<IndexerRequest>>(); var query = new TorrentQuery(); if (TryAddSearchParameters(query, searchCriteria)) { query.Search = String.Format("{0:yyyy}-{0:MM}-{0:dd}", searchCriteria.AirDate); requests.Add(GetRequest(query)); } return requests; }
public virtual IndexerPageableRequestChain GetSearchRequests(DailyEpisodeSearchCriteria searchCriteria) { var pageableRequests = new IndexerPageableRequestChain(); var query = new TorrentQuery(); if (TryAddSearchParameters(query, searchCriteria)) { query.Search = string.Format("{0:yyyy}-{0:MM}-{0:dd}", searchCriteria.AirDate); pageableRequests.Add(GetRequest(query)); } return pageableRequests; }
public IList <IEnumerable <IndexerRequest> > GetSearchRequests(DailyEpisodeSearchCriteria searchCriteria) { var requests = new List <IEnumerable <IndexerRequest> >(); var query = new TorrentQuery(); if (TryAddSearchParameters(query, searchCriteria)) { query.Search = String.Format("{0:yyyy}-{0:MM}-{0:dd}", searchCriteria.AirDate); requests.Add(GetRequest(query)); } return(requests); }
public virtual IndexerPageableRequestChain GetSearchRequests(DailyEpisodeSearchCriteria searchCriteria) { var pageableRequests = new IndexerPageableRequestChain(); var query = new TorrentQuery(); if (TryAddSearchParameters(query, searchCriteria)) { query.Search = string.Format("{0:yyyy}-{0:MM}-{0:dd}", searchCriteria.AirDate); pageableRequests.Add(GetRequest(query)); } return(pageableRequests); }
public virtual IndexerPageableRequestChain GetSearchRequests(DailySeasonSearchCriteria searchCriteria) { var pageableRequests = new IndexerPageableRequestChain(); var query = new TorrentQuery(); if (TryAddSearchParameters(query, searchCriteria)) { query.Search = string.Format("{0}-", searchCriteria.Year); pageableRequests.Add(GetRequest(query)); } return(pageableRequests); }
public IList<IEnumerable<IndexerRequest>> GetSearchRequests(AnimeEpisodeSearchCriteria searchCriteria) { var requests = new List<IEnumerable<IndexerRequest>>(); var queryBase = new TorrentQuery(); if (TryAddSearchParameters(queryBase, searchCriteria)) { foreach (var episode in searchCriteria.Episodes) { var query = queryBase.Clone(); query.TvdbInfo.Season = episode.SeasonNumber; query.TvdbInfo.Episode = episode.EpisodeNumber; } } return requests; }
private IEnumerable <IndexerRequest> GetRequest(TorrentQuery query) { var builder = new HttpRequestBuilder(Settings.BaseUrl); var request = builder.Build("/api/torrents"); request.Method = HttpMethod.POST; const string appJson = "application/json"; request.Headers.Accept = appJson; request.Headers.ContentType = appJson; query.Username = Settings.Username; query.Passkey = Settings.ApiKey; request.Body = query.ToJson(); yield return(new IndexerRequest(request)); }
public virtual IndexerPageableRequestChain GetSearchRequests(AnimeEpisodeSearchCriteria searchCriteria) { var pageableRequests = new IndexerPageableRequestChain(); var queryBase = new TorrentQuery(); if (TryAddSearchParameters(queryBase, searchCriteria)) { foreach (var episode in searchCriteria.Episodes) { var query = queryBase.Clone(); query.TvdbInfo.Season = episode.SeasonNumber; query.TvdbInfo.Episode = episode.EpisodeNumber; } } return pageableRequests; }
public IList <IEnumerable <IndexerRequest> > GetSearchRequests(AnimeEpisodeSearchCriteria searchCriteria) { var requests = new List <IEnumerable <IndexerRequest> >(); var queryBase = new TorrentQuery(); if (TryAddSearchParameters(queryBase, searchCriteria)) { foreach (var episode in searchCriteria.Episodes) { var query = queryBase.Clone(); query.TvdbInfo.Season = episode.SeasonNumber; query.TvdbInfo.Episode = episode.EpisodeNumber; } } return(requests); }
public virtual IndexerPageableRequestChain GetSearchRequests(AnimeEpisodeSearchCriteria searchCriteria) { var pageableRequests = new IndexerPageableRequestChain(); var queryBase = new TorrentQuery(); if (TryAddSearchParameters(queryBase, searchCriteria)) { foreach (var episode in searchCriteria.Episodes) { var query = queryBase.Clone(); query.TvdbInfo.Season = episode.SeasonNumber; query.TvdbInfo.Episode = episode.EpisodeNumber; } } return(pageableRequests); }
public IList<IEnumerable<IndexerRequest>> GetSearchRequests(SeasonSearchCriteria searchCriteria) { var requests = new List<IEnumerable<IndexerRequest>>(); var queryBase = new TorrentQuery(); if (TryAddSearchParameters(queryBase, searchCriteria)) { foreach (var seasonNumber in searchCriteria.Episodes.Select(e => e.SeasonNumber).Distinct()) { var query = queryBase.Clone(); query.TvdbInfo.Season = seasonNumber; requests.Add(GetRequest(query)); } } return requests; }
public IndexerPageableRequestChain GetSearchRequests(BasicSearchCriteria searchCriteria) { var pageableRequests = new IndexerPageableRequestChain(); var query = new TorrentQuery(); if (searchCriteria.Categories?.Length > 0) { query.Category = Capabilities.Categories.MapTorznabCapsToTrackers(searchCriteria.Categories).Select(int.Parse).ToArray(); } if (searchCriteria.SearchTerm.IsNotNullOrWhiteSpace()) { query.Search = searchCriteria.SanitizedSearchTerm; } pageableRequests.Add(GetRequest(query)); return(pageableRequests); }
public virtual IndexerPageableRequestChain GetSearchRequests(SeasonSearchCriteria searchCriteria) { var pageableRequests = new IndexerPageableRequestChain(); var queryBase = new TorrentQuery(); if (TryAddSearchParameters(queryBase, searchCriteria)) { foreach (var seasonNumber in searchCriteria.Episodes.Select(e => e.SeasonNumber).Distinct()) { var query = queryBase.Clone(); query.TvdbInfo.Season = seasonNumber; pageableRequests.Add(GetRequest(query)); } } return pageableRequests; }
public virtual IndexerPageableRequestChain GetSearchRequests(SeasonSearchCriteria searchCriteria) { var pageableRequests = new IndexerPageableRequestChain(); var queryBase = new TorrentQuery(); if (TryAddSearchParameters(queryBase, searchCriteria)) { foreach (var seasonNumber in searchCriteria.Episodes.Select(e => e.SeasonNumber).Distinct()) { var query = queryBase.Clone(); query.TvdbInfo.Season = seasonNumber; pageableRequests.Add(GetRequest(query)); } } return(pageableRequests); }
public IList <IEnumerable <IndexerRequest> > GetSearchRequests(SeasonSearchCriteria searchCriteria) { var requests = new List <IEnumerable <IndexerRequest> >(); var queryBase = new TorrentQuery(); if (TryAddSearchParameters(queryBase, searchCriteria)) { foreach (var seasonNumber in searchCriteria.Episodes.Select(e => e.SeasonNumber).Distinct()) { var query = queryBase.Clone(); query.TvdbInfo.Season = seasonNumber; requests.Add(GetRequest(query)); } } return(requests); }
private IEnumerable <IndexerRequest> GetRequest(TorrentQuery query) { var request = new HttpRequestBuilder(Settings.BaseUrl) .Resource("/api/torrents") .Build(); request.Method = HttpMethod.Post; const string appJson = "application/json"; request.Headers.Accept = appJson; request.Headers.ContentType = appJson; query.Username = Settings.Username; query.Passkey = Settings.ApiKey; query.Codec = Settings.Codecs.ToArray(); query.Medium = Settings.Mediums.ToArray(); request.SetContent(query.ToJson()); yield return(new IndexerRequest(request)); }
private IEnumerable<IndexerRequest> GetRequest(TorrentQuery query) { var request = new HttpRequestBuilder(Settings.BaseUrl) .Resource("/api/torrents") .Build(); request.Method = HttpMethod.POST; const string appJson = "application/json"; request.Headers.Accept = appJson; request.Headers.ContentType = appJson; query.Username = Settings.Username; query.Passkey = Settings.ApiKey; request.SetContent(query.ToJson()); yield return new IndexerRequest(request); }
private bool TryAddSearchParameters(TorrentQuery query, SearchCriteriaBase searchCriteria) { if (searchCriteria.Series.TvdbId != 0) { query.TvdbInfo = query.TvdbInfo ?? new TvdbInfo(); query.TvdbInfo.Id = searchCriteria.Series.TvdbId; return true; } return false; }