       (infof (:name t) "is ready to download")
       (>!! queue t))))
 
+(defn- unpack-downloads[this]
+  "looks for things that should be unpacked"
+  (thread
+    (doseq [t (db/by-state :downloaded)]
+      (unpack-torrent this t))))
+
 (defrecord Downloader [dir download-queue jobs credentials remote-base-url
                        sickbeard-post-process-url concurrent-downloads]
   component/Lifecycle

      false)))

(defn- get-rar-files [t]
  (filter #(.endsWith (join "/" (get %1 "path")) ".rar") (:files t)))

(defn- unpack-torrent [this t]
  (doseq [file (get-rar-files t)]
    (sh "unrar" "x" "-y"  (join "/" (filter #(pos? (count %)) (get file "path"))) :dir (join "/" (get-download-dir this t)))))

(defn- do-download [this t]
  (try

;;; NEEDS TO BE NOT TERRIBLE
;;; should handle partially downloaded better
(defn- download-file [this filename torrent size]
  (infof "downloading: %s" filename)
  (let [file ^java.io.File (apply io/file (conj (get-download-dir this torrent) filename))]
    (when (< (.getTotalSpace file) size)
      (with-open [out (io/output-stream file)]
