rlm@0: ":";exec java -cp $HOME/roBin/src:$HOME/roBin/lib/* clojure.main $0 $*; rlm@0: rlm@0: (ns rlm.play-all rlm@0: (:gen-class rlm@0: :name rlm.playAll rlm@0: :main true) rlm@0: (:use [clojure.contrib rlm@0: [shell-out :only [sh]] rlm@0: [accumulators :only [combine]] rlm@0: [command-line :only [with-command-line]] rlm@0: [duck-streams :only [file-str]]] rlm@0: [rlm rlm@0: [shell-write :only [sw]] rlm@0: [shell-inspect :only [command-line?]]])) rlm@0: rlm@0: rlm@0: (def allowed-types rlm@0: [#".*\.mp3$" rlm@0: #".*\.m4a$" rlm@0: #".*\.wav$"]) rlm@0: rlm@0: (def music rlm@0: ["/home/r/Desktop/first-archive/sounds"]) rlm@0: rlm@0: (defn music-files [] rlm@0: (shuffle rlm@0: (doall (filter rlm@0: (fn [b] (some (fn [a] (re-matches a (.getPath b))) allowed-types)) rlm@0: (apply combine rlm@0: (map #(apply vector %) rlm@0: (map file-seq rlm@0: (map file-str music)))))))) rlm@0: rlm@0: (defn enqueue rlm@0: [#^java.io.File file] rlm@0: (sh "totem" "--enqueue" (.getPath file))) rlm@0: rlm@0: (defn play-all-music rlm@0: "runs commands which enque music to totem from a separate thread. rlm@0: just run this command and don't worry about it anymore." rlm@0: [] rlm@0: (.start (Thread. (partial sh "totem"))) rlm@0: (.start (Thread. (fn [] (dorun (map enqueue (music-files))))))) rlm@0: rlm@0: (defn -main [& args] rlm@0: (with-command-line args rlm@0: "Play every Music File ever :)" rlm@0: [] rlm@0: (println "playing all music from" music) rlm@0: (play-all-music) rlm@0: )) rlm@0: rlm@0: rlm@0: (if (command-line?) rlm@0: (apply -main *command-line-args*))