public async Task <IEnumerable <RemoteSubtitleInfo> > Search(SubtitleSearchRequest request, CancellationToken cancellationToken) { string hash = Helpers.Utils.GetMovieHash(request.MediaPath); Response resp = _client.SearchSubtitleAsync(hash, true).GetAwaiter().GetResult(); Helpers.CsvResponseParser csvResponseParser = new CsvResponseParser(); IReadOnlyList <Language> languages = csvResponseParser.ParseSearchSubtitle(ASCIIEncoding.ASCII.GetString((byte[])resp.Body), true); List <RemoteSubtitleInfo> list = new List <RemoteSubtitleInfo>(); _logger.LogInformation("Searched for languages on the hash " + hash + " and found " + languages.Count.ToString() + " results"); foreach (Language lang in languages) { _logger.LogInformation(lang.Name.ToString() + " " + lang.Count.ToString()); _logger.LogInformation("Fant en sub med riktig språk"); RemoteSubtitleInfo remoteSubtitleInfo = new RemoteSubtitleInfo() { Name = lang.Name, Id = lang.Name + "-n0t-" + hash, }; list.Add(remoteSubtitleInfo); } return(list); }
public HistoricalPriceResponseProcessor(CsvResponseParser csv_response_parser) { this.csv_response_parser = csv_response_parser; }