 (defn routes [req]
   (let [u (:uri req)]
     (cond
-     (.startsWith u "/tracks.json") (tracks-json req)
+     (.startsWith u "/tracks.json") (tracks-json-handler req)
      (.startsWith u "/bits/") (bits-handler req)
      :else ((ringo front-page-view) req)
      )))

                      fields)
        project (if-let [f (get p "_fields" ) ]
                  #(select-keys % (map keyword (str/split f #",")))
                  #(assoc % "_links" (media-links %)))
        tracks (distinct (map project
                              (search/search search/index terms num-rows)))]
    {:status 200
     :headers {"Content-type" "text/json"}
     :body (json/write-str tracks)}))


(def scripts

   "ogg" {"href" "/bits/L3BhdGgvdG8vYXVkaW8uZmxhYw.ogg"},
   "flac" {"href" "/bits/L3BhdGgvdG8vYXVkaW8uZmxhYw.flac"}}))

(defn tracks-data [req]
  (let [p (:params req)
        fields [:artist :album :title :year :album-artist :track :genre
                :encoding-type
