                           :download-slots default-download-slots
                           :num-of-uploads 0
                           :num-of-downloads 0
-                          :download-progress {}}))
+                          :download-progress {}
+                          :download-status {}}))
 
 (enable-console-print!)
 

(defn indices [pred coll]
  (keep-indexed #(when (pred %2) %1) coll))

(defn is-track-downloaded? [track-id]
  (not (nil? (get (:music-files @app-state) track-id))))

(defn get-next-track-to-download []
  (let [track-order (:track-order @app-state)

    (.on stream "end"
      (fn []
        (println "Download complete!")
        (swap! app-state assoc :download-status (merge (:download-status @app-state)
                                                       {track-id :complete}))

        (swap! app-state assoc :num-of-downloads (dec (:num-of-downloads @app-state)))
        (swap! app-state assoc :download-progress (dissoc (:download-progress @app-state) track-id))

