 
 (defn audio-length
   "Return the audio legth for a given DAISY Talking Book in seconds"
-  [{path :path}]
+  [dtb]
   ;; unfortunatelly getting the audio length of an mp3 file doesn't
   ;; seem to be supported at the moment. You need to have the proper
   ;; providers. Maybe this is a problem of openjdk? So just use wav
   ;; files for the calculation.
-  (let [audio-files (filter wav-file? (file-seq (file path)))] 
+  (let [audio-files (filter wav-file? (file-seq (file dtb)))] 
     (reduce + (map file-audio-length audio-files))))
 
 (defn meta-data

(defn audio-format
  "Return the format in which the audio files in the DTB file set are
  written for a given DAISY Talking Book"
  [{path :path}]
  (let [mime-types (->> (file-seq (file path))
                        (filter audio-file?)
                        (remove #(= (.getName %) "tpbnarrator_res.mp3"))
                        (map mime-type-of))]

(defn- has-type? [type-pred path]
  (some type-pred (file-seq (file path))))

(defn- has-audio? [dtb] (has-type? audio-file? dtb))
(defn- has-text? [dtb] (has-type? text-file? dtb))
(defn- has-image? [dtb] (has-type? image-file? dtb))
(defn- has-ncx? [dtb] (has-type? ncx-file? dtb))

(defn- audio-content [dtb] (when (has-audio? dtb) "audio"))
(defn- text-content [dtb] (when (has-text? dtb) "text"))
