Merge pull request #37 from ClashTheBunny/podcasts

Add enclosure tag to facilitate Podcasting with Cryogen
This commit is contained in:
Carmen La 2015-09-03 22:43:54 -04:00
commit 85ede46a9e
2 changed files with 5 additions and 4 deletions

View file

@ -143,7 +143,7 @@
"Adds the uri and title of a post to the list of posts under each of its tags"
[tags post]
(reduce (fn [tags tag]
(update-in tags [tag] (fnil conj []) (select-keys post [:uri :title :content :date])))
(update-in tags [tag] (fnil conj []) (select-keys post [:uri :title :content :date :enclosure])))
tags (:tags post)))
(defn group-by-tags

View file

@ -1,18 +1,19 @@
(ns cryogen-core.rss
(:require [clj-rss.core :as rss]
[clojure.xml :refer [emit]]
[text-decoration.core :refer :all])
(:import java.util.Date))
(defn posts-to-items [site-url posts]
(map
(fn [{:keys [uri title content date]}]
(let [link (str (if (.endsWith site-url "/") (apply str (butlast site-url)) site-url) uri)]
(fn [{:keys [uri title content date enclosure]}]
(let [link (str (if (.endsWith site-url "/") (apply str (butlast site-url)) site-url) uri)
enclosure (if (nil? enclosure) "" enclosure)]
{:guid link
:link link
:title title
:description content
:enclosure enclosure
:pubDate date}))
posts))