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" "Adds the uri and title of a post to the list of posts under each of its tags"
[tags post] [tags post]
(reduce (fn [tags tag] (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))) tags (:tags post)))
(defn group-by-tags (defn group-by-tags

View file

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