       (add-images folder video))))
 
 (defn add-file
-  "Adds a newly discovered file to the library."
+  "Adds a newly discovered file to the library and queues it for
+  processing."
   [folder file]
   (log/info "adding file" (str file))
   (when-let [video (video-for-file folder file)]

  (cond
    (video? file) (add-video folder file)
    (subtitle? file) (add-subtitle folder file)
    (image? file) (add-image folder file)))

(defn check-pending-files
  "Checks the pending files and adds the stable ones to the library."

    #_(log/trace "checking pending files")
    (doseq [file @pending-files]
      (try (when (stable? file)
             (add-file folder file))
           (when (or (stable? file) (not (.exists file)))
             (dosync (alter pending-files disj file)))
           (catch Exception e (log/error e "adding pending file" (str file)))))))

(defn add-pending-file
