clojuredesign-podcast

JR 2024-05-03T13:35:34.460539Z

Adding some listening material to an mp3 player for a long walk. Glad to see another episode to add to the collection!

neumann 2024-05-03T16:32:17.038789Z

Nice! Thanks for making us a part of your playlist!

practicalli-johnny 2024-05-03T17:54:19.755419Z

Google Podcasts is being closed down on 24 June 2024, so have exported my subscription to YouTube Music (exports to any OPML podcast player). I'm now listening on YouTube music. Seems to be working well and have auto download for new episodes. Looks quite nice too.

practicalli-johnny 2024-05-03T17:58:48.644849Z

I remember that I also have the back catalogue on the phone, played through VLC. Very useful when traveling

1
neumann 2024-05-03T19:48:59.455759Z

@jr0cket Very cool! How did you go about downloading the back catalog?

practicalli-johnny 2024-05-03T21:30:17.474839Z

I downloaded one or two episode files individually, from the https://clojuredesign.club/ website. Usually Just before a walk. However after listening to the Spotify series, I am inspired to write some Clojure code to do the download for me, should I loose that data on the phone:grin:

JR 2024-05-03T22:48:02.890249Z

Haha, I wrote a very hacky clojure script to download the back catalog!

neumann 2024-05-03T22:48:09.856809Z

@jr0cket https://clojuredesign.club/index.xml I look forward to seeing what you come up with!

neumann 2024-05-03T22:48:23.700099Z

@john.t.richardson.dev I'd love to see it.

JR 2024-05-03T22:50:12.342329Z

It's horrible, just a fiddle file, but I'll post that here

JR 2024-05-03T22:50:41.190859Z

(ns download
  (:require [clojure.data.xml :as xml]))

(def tmp-feed (slurp ""))

tmp-feed

(def content-data (:content (reduce :content (:content (xml/parse-str tmp-feed)))))

content-data

(def items (filter #(= :item (:tag %)) content-data))

items

(filter
 #(= (:tag %) :enclosure)
 (:content (first items)))


(def all-mp3s (->> (map :content items)
     (map #(filter (fn [x] (= (:tag x) :enclosure)) %))
     (map #(map (fn [x] (get-in x [:attrs :url])) %))))

(defn copy-uri-to-file [uri file]
  (with-open [in ( uri)
              out ( file)]
    ( in out)))

(doseq [one-mp3 all-mp3s]
  (prn one-mp3))

(doseq [one-mp3 all-mp3s]
  (let [mp3 (first one-mp3)
        file-name (last (clojure.string/split mp3 #"/"))]
    (copy-uri-to-file mp3 file-name))
  )


(map :url (map (comp :attrs)(filter
 #(= (:tag %) :enclosure)
 (:content (first items))))
)

(reduce #(= :content (:tag %)) items)

(filter #(= (:tag %) :enclosure) items)



(let [feed (slurp "")]
  (str feed))

JR 2024-05-03T22:53:10.225569Z

It just uses clojure.data.xml to get at the URLs and downloads them. Sorry about your eyes 👓

neumann 2024-05-03T23:12:50.940239Z

@john.t.richardson.dev Nice! Thanks for posting it! I love how non-general it is. It's just enough to get it working.

🤪 1
neumann 2024-05-03T23:13:36.017899Z

Also, I had no idea you could slurp a URL! What?! How have I never done that?!