X-Git-Url: https://njoseph.me/gitweb/babashka-scripts.git/blobdiff_plain/fa20f4c628ada7791b7d8c110e248b347cbaf9be..0b0f2aa39a06e77b1517f895a2c82946f684b568:/ebook-to-audio-book.clj diff --git a/ebook-to-audio-book.clj b/ebook-to-audio-book.clj index e6fa40a..c09b8d0 100755 --- a/ebook-to-audio-book.clj +++ b/ebook-to-audio-book.clj @@ -15,11 +15,11 @@ (defn run-cmd [command] - (->> command + (->> command p/process :out slurp)) - + (let [book-file (first *command-line-args*) title (first (split book-file #"\.")) txtz-file (str title ".txtz") @@ -28,12 +28,11 @@ mp3-file (str title ".mp3")] (println "Converting to text...") (run-cmd ["ebook-convert" book-file txtz-file]) - (spit txt-file (run-cmd ["unzip" "-p" txtz-file "index.txt"])) + (extract-file-from-zip txtz-file "index.txt" txt-file) (println "Converting text to audio. Don't hold your breath!") (run-cmd ["say" "-f" txt-file "-o" aiff-file]) (println "Creating mp3 file...") (run-cmd ["ffmpeg" "-i" aiff-file mp3-file]) (println "Cleaning up...") - (doseq [temp-file [txtz-file txt-file aiff-file]] - (io/delete-file temp-file)) + (run! #(io/delete-file %) [txtz-file txt-file aiff-file]) (println (str "Done! Check out " mp3-file)))