 (defn enqueue-track [queue track]
   (update-in queue [:tracks] conj track))
 
-(defn search-results []
-  (om/ref-cursor (:results (:search (om/root-cursor app-state)))))
-
-(defn player-queue []
-  (om/ref-cursor (:player-queue (om/root-cursor app-state))))
-
-(defn player-state []
-  (om/ref-cursor (:player (om/root-cursor app-state))))
-
-(defn player-pause []
-  (om/transact! (player-state) #(update-in % [:playing] not)))
-
-(defn current-track []
-  (nth (player-queue) (:track-number (player-state)) nil))
-
-(defn player-next []
-  ;; how do we make this fail if there are no more tracks?
-  (om/transact! (player-state) #(update-in % [:track-number] inc)))
-
-(defn player-playing [e]
-  (let [player (.-target e)
-        offset (.-currentTime player)]
-    (om/transact! (player-state)
-                  #(update-in % [:track-offset]
-                              (fn [time] offset)))))
-
-(defn player-prev []
-  (let [dec0 #(max (dec %) 0)]
-    (om/transact! (player-state) #(update-in % [:track-number] dec0))))
-
-
-(defn player-el []
-  (aget (.getElementsByTagName js/document "audio") 0))
-
-(defn enqueue-track [track]
-  (om/transact! (player-queue) #(conj % track)))
-
-(defn dequeue-track [index]
-  (om/transact! (player-queue)
-                (fn [v] (vec (concat (subvec v 0 index)
-                                     (subvec v (inc index)))))))
 (deftest enqueue-test
   (let [q {:tracks [:a :b :c :d] :next-track 2}]
     (is (= (:tracks (enqueue-track q :z)) [:a :b :c :d :z]))))
 
-(defn dequeue-all []
-  (om/transact! (player-queue) (fn [v] [])))
 
 (defn mmss [seconds]
   (let [m (quot seconds 60)

        (polygon 40,0 80,50 40,100 40,0)
        (polygon 85,0 95,0 95,100 85,100 85,0)]))

(defn transport-buttons-view [app owner]
  (reify
    om/IRender
    (render [this]
      (let [queue (om/observe owner (player-queue))
            playing? (:playing (player-state))
            track (current-track)]
        (html
         [:div {:id "transport"
                :onClick #(om/transact! app [:viewing-queue?] not)
                }
          [:span {:className "index"}
           [:span {:className "current"}
            (inc (:track-number (player-state)))]
           "/"
           [:span {:className "total"}
            (count (player-queue))]]
          [:div {:className "title-artist"}
           [:span {:className "title"}
            (get track "title")]

              :term #{}
              :results []
              }
     :player {
              :queue {
                      :tracks []
                      :next-track 0 ; now-playing (dec next-track)
                      }
              :want-play true
              :audio-el {:track-offset 0 :playing false}
              }
     }))

