   (.emit socket "resume"))
 
 (defn indices [pred coll]
-   (keep-indexed #(when (pred %2) %1) coll))
+  (keep-indexed #(when (pred %2) %1) coll))
 
 (defn get-current-track-num []
   (first (indices #(= (.-id %1) (:current-track-id @app-state))

    (.on stream "end"
      (fn []
        (println "Download complete!")
        (swap! app-state assoc :num-of-downloads (- (:num-of-downloads @app-state) 1))
        (swap! app-state assoc :download-progress (dissoc (:download-progress @app-state) track-id))

        (if (> (:download-slots @app-state) (:num-of-downloads @app-state))

         (:music-info @app-state))
    0))

(defn request-file-download [track-id]
  (if (nil? (get (:music-files @app-state) track-id))
    (do
      (swap! app-state assoc :music-files (merge (:music-files @app-state)
                                                 {track-id (new js/Blob)}))
      (swap! app-state assoc :num-of-downloads (inc (:num-of-downloads @app-state)))
      (.emit socket "file-download-request" track-id)
      (println (str "Num of file downloads: " (:num-of-downloads @app-state))))))

; TODO: reimplement this
(defn get-next-track-to-download []
  nil)

(defn request-new-track []
  (let [track-id (get-next-track-to-download)]
    (if-not (nil? track-id)
      (request-file-download track-id))))

(defn pause []
  (player/pause)
