private static async Task<Episode> GetEpisodeInfo(Episode e) { var content = await LoadUri(e.Uri); var match = _regexMagnet.Match(content); if (match.Success) e = e.WithMagnetLink(match.Groups["magnet"].Value); match = _regexFileSize.Match(content); if (match.Success) e = e.WithFileSize(match.Groups["fileSize"].Value); match = _regexReleaseDate.Match(content); if (match.Success) e = e.WithReleaseDate(ParseReleaseDate(match.Groups["releaseDate"].Value)); return e; }
private static SyndicationItem CreateEpisodeElement(Episode e) { var item = new SyndicationItem { Title = new TextSyndicationContent(e.Name), Id = e.Uri.ToString() }; item.Authors.Add(new SyndicationPerson("*****@*****.**") { Name = "Kim Birkelund" }); item.Links.Add(new SyndicationLink(e.Uri)); if (e.ReleaseDate != null) { item.PublishDate = new DateTimeOffset(e.ReleaseDate.Value.ToUniversalTime()); item.LastUpdatedTime = new DateTimeOffset(e.ReleaseDate.Value.ToUniversalTime()); } string description = ""; if (!string.IsNullOrWhiteSpace(e.MagnetLink)) { description += "<p><a title=\"Magnet link\" href=\"" + e.MagnetLink + "\">Magnet link</a></p>"; item.Links.Add(new SyndicationLink(new Uri(e.MagnetLink), "related", "Magnet", "application/octet-stream", 0)); } if (!string.IsNullOrWhiteSpace(e.FileSize)) description += "<p><b>File size: </b>" + e.FileSize + "</p>"; if (!string.IsNullOrWhiteSpace(description)) item.Summary = SyndicationContent.CreateHtmlContent(description); return item; }