예제 #1
0
파일: Mapper.cs 프로젝트: salsal97/mystikos
    private static Episode Map(Item item)
    {
        var description = item.Summary ?? item.Description ?? throw new ArgumentNullException(nameof(Item.Description));
        var duration    = RssHelper.ConvertDuration(item.Duration);
        var @explicit   = !string.IsNullOrEmpty(item.Explicit) ? item.Explicit : "no";
        var pubDate     = RssHelper.ConvertDateTime(item.PubDate).GetValueOrDefault();
        var url         = item.Enclosure !.Url ?? throw new ArgumentNullException(nameof(Enclosure.Url));

        var episode = new Episode(description, duration, @explicit, pubDate, item.Title, url);

        return(episode);
    }