예제 #1
0
        public SubtitleSearchResultCollection SearchSubtitles(params SearchQuery[] query)
        {
            CheckSession();

            var options = new SearchOptions { Limit = SearchLimit };
            var result =  proxy.SearchSubtitles(
                session.Token, query, options);

            if (!result.IsSuccess)
            {
                throw new OSDbException(
                    $"Subtitle search failed: {result.Status}");
            }

            return result;
        }
예제 #2
0
        public async Task<SubtitleSearchResultCollection> SearchSubtitlesAsync(params SearchQuery[] query)
        {
            CheckSession();

            var options = new SearchOptions { Limit = SearchLimit };
            var task = Task.Factory.FromAsync(
                (callback, state) => proxy.BeginSearchSubtitles(session.Token, query, options, callback),
                proxy.EndSearchSubtitles,
                null);

            var result = await task.WithTimeout(Timeout);

            if (!result.IsSuccess)
            {
                throw new OSDbException(result);
            }

            return result;
        }