protected override async Task<IDictionary<BaseSubtitleMatch<string>, byte[]>> DownloadSubtitleAsync(SubtitleInfo subtitle)
    {
      var subs = new Dictionary<BaseSubtitleMatch<string>, byte[]>();
      if (!subtitle.DataProviders.Contains(_providerName))
        return subs;

      var files = await _subtitleDownloaderHandler.DownloadSubtileAsync(new SubtitleDownloaderResult(subtitle.SubtitleId, subtitle.MediaTitle, subtitle.Name, 
        new CultureInfo(subtitle.Language).ThreeLetterISOLanguageName));

      foreach (var file in files)
      {
        var match = new BaseSubtitleMatch<string>() { Id = subtitle.SubtitleId, ItemName = file.Name, Language = subtitle.Language };
        subs.Add(match, File.ReadAllBytes(file.FullName));
        //Delete temp file
        try { File.Delete(file.FullName); } catch { }
      }
      return subs;
    }
Example #2
0
        protected override async Task <IDictionary <BaseSubtitleMatch <string>, byte[]> > DownloadSubtitleAsync(SubtitleInfo subtitle)
        {
            var subs = new Dictionary <BaseSubtitleMatch <string>, byte[]>();

            if (!subtitle.DataProviders.Contains(_name))
            {
                return(subs);
            }

            var file = await _subDbHandler.DownloadSubtileAsync(subtitle.SubtitleId);

            var match = new BaseSubtitleMatch <string>()
            {
                Id = subtitle.SubtitleId, ItemName = file.Name, Language = subtitle.Language
            };

            subs.Add(match, File.ReadAllBytes(file.FullName));
            //Delete temp file
            try { File.Delete(file.FullName); } catch { }
            return(subs);
        }