Esempio n. 1
0
        public string GetRss(string name)
        {
            var podcastName = GetNormalizedName(name);

            var podcastPath = Path.Combine(settings.PodcastsLocation, name);
            var directory   = new DirectoryInfo(podcastPath);
            var filePaths   = directory.GetFiles().Select(t => new LocalFileInfo(t.FullName, GetFileUrl(t.Directory !.Name, t.Name))).ToArray();

            var rssGeneratorParams = new RssFromFileParams(podcastName, filePaths);

            return(rssGenerator.GenerateRss(rssGeneratorParams));
        }
Esempio n. 2
0
        public IEnumerable <PodcastInfo> GetPodcasts()
        {
            var baseDirectory = new DirectoryInfo(settings.PodcastsLocation);

            foreach (var directory in baseDirectory.GetDirectories())
            {
                var podcastName = GetNormalizedName(directory.Name);

                var filePaths = directory.GetFiles().Select(t => new LocalFileInfo(t.FullName, GetFileUrl(t.Directory !.Name, t.Name))).ToArray();

                var rssGeneratorParams = new RssFromFileParams(podcastName, filePaths);

                var feed = rssGenerator.BuildFeed(rssGeneratorParams);

                yield return(new PodcastInfo(directory.Name, feed.Title, feed.AuthorName ?? "Unknown author", $"{settings.PodcastServerUrl}/podcast/{directory.Name}", feed.ImageUrl, feed.Duration));
            }
        }