 ;; (swap! player-state assoc :font-size "small")
 ;; (swap! player-state assoc :speed 1)
 
-(defonce reload-fn (atom nil))
+(defonce reload-fn (atom (fn [])))
 
 (defn reload []
   (@reload-fn))

  (reset! reload-fn reload-player)
  (reload-player))

(def v0-url "/frames-21195.json")
(def v1-url "/21195.json")

(defn fetch-json [url]
  (let [ch (chan)]

                actual-cursor (:cursor vt)
                expected-lines (get-in v0-frames [n :lines])
                expected-cursor (get-in v0-frames [n :cursor])]
            (when (>= n check-from)
              (when (not= actual-cursor expected-cursor)
                (print n)
                (print "fed: " str)

                (print "expected cursor:")
                (prn expected-cursor)
                (print "got cursor:")
                (prn actual-cursor)
                (print "prev cursor:")
                (prn prev-cursor)
                (throw "expectation failed"))

              (when (not= actual-lines expected-lines)
                (print n)
                (print "fed: " str)

                (print "prev lines:")
                (prn prev-lines)
                (print "expected lines:")
                (prn expected-lines)
                (print "got lines:")
                (prn actual-lines)
                (print "first non-matching line:")
                (let [conflict (first (filter #(apply not= %) (map vector expected-lines actual-lines)))]
                  (prn "expected: " (first conflict))
                  (prn "got: " (second conflict)))
                ;; (feed-verbose prev-vt str)
                (throw "expectation failed")))

            (recur (inc n) vt))
          (print "success"))))))

(defn start-debug []
  ;; (reset! reload-fn debug)
  (debug))
