/// <summary> /// Searches for download links on multiple services asynchronously. /// </summary> /// <param name="query">The name of the release to search for.</param> /// <returns>List of search tasks.</returns> public List <Task> SearchAsync(string query) { if (Filter) { if (ShowNames.Regexes.Numbering.IsMatch(query)) { var tmp = ShowNames.Parser.Split(query); _titleRegex = Database.GetReleaseName(tmp[0]); _episodeRegex = ShowNames.Parser.GenerateEpisodeRegexes(tmp[1]); } else { _titleRegex = Database.GetReleaseName(query); _episodeRegex = null; } } _done = new ConcurrentBag <DownloadSearchEngine>(); query = ShowNames.Parser.CleanTitleWithEp(query, false); Log.Debug("Starting async search for " + query + "..."); _start = DateTime.Now; var tlist = new List <Task>(); foreach (var engine in SearchEngines.OrderBy(e => AutoDownloader.Parsers.IndexOf(e.Name))) { tlist.Add(engine.SearchAsync(query)); } return(tlist); }
/// <summary> /// Searches for subtitles on multiple services asynchronously. /// </summary> /// <param name="query">The name of the release to search for.</param> public void SearchAsync(string query) { if (Filter) { if (ShowNames.Regexes.Numbering.IsMatch(query)) { var tmp = ShowNames.Parser.Split(query); _titleRegex = Database.GetReleaseName(tmp[0]); _episodeRegex = ShowNames.Parser.GenerateEpisodeRegexes(tmp[1]); } else { _titleRegex = Database.GetReleaseName(query); _episodeRegex = null; } } _done = new ConcurrentBag <SubtitleSearchEngine>(); Log.Debug("Starting async search for " + query + "..."); _start = DateTime.Now; foreach (var engine in SearchEngines.OrderBy(e => SubtitlesPage.Actives.IndexOf(e.Name))) { engine.SearchAsync(query); } }