public void CanSearchWithSeasonAndEpisode() { var client = Osdb.Create(UserAgent); var results = client.SearchSubtitlesFromQuery("en", "arrow", 1, 1).Result; Assert.IsTrue(results.Count > 0); }
public void CanSearchOnlyText() { var client = Osdb.Create(UserAgent); var results = client.SearchSubtitlesFromQuery("en", "Arrow").Result; Assert.IsTrue(results.Count > 0); }
static void DownloadSubtitle(string movieFileName, bool lucky, IList <string> languages) { using (var osdb = Osdb.Create("TemporaryUserAgent")) { var subtitles = osdb.SearchSubtitlesFromFile(languages.Aggregate((a, b) => a + "," + b), movieFileName).Result; int subtitlesCount = subtitles.Count; if (subtitlesCount == 0) { Console.WriteLine("Sorry, no subtitles found for your movie"); return; } var selectedSubtitle = subtitles.First(); if (!lucky) { var canceled = !PromptForSubtitle(subtitles, ref selectedSubtitle); if (canceled) { return; } } string subtitleFile = osdb.DownloadSubtitleToPath(Path.GetDirectoryName(movieFileName), selectedSubtitle).Result; Console.WriteLine("Subtitle downloaded to '{0}'", subtitleFile); } }
async static Task <bool> SearchOpenSubtitles(string fileHash, long fileSize, string languages = DEFAULT_LANGUAGE) { bool retval = false; var client = Osdb.Create("SubSearch"); List <Subtitle> targetSubList = (await client.SearchSubtitlesFromHash(languages, fileHash, fileSize)).ToList(); return(retval); }