Skip to content

Commit

Permalink
Move away from deprecated Beat Link methods.
Browse files Browse the repository at this point in the history
  • Loading branch information
brunchboy committed May 10, 2020
1 parent 01f865f commit 955071e
Show file tree
Hide file tree
Showing 7 changed files with 15 additions and 13 deletions.
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ This change log follows the conventions of
displayed correctly (previously this worked only for hot cues).
Thanks to [@ehendrikd](https://github.com/ehendrikd) for
[discovering
how](https://github.com/Deep-Symmetry/crate-digger/pull/13#issuecomment-626240309).
how](https://github.com/Deep-Symmetry/crate-digger/pull/13).
- Incorporates a number of other fixes and improvements to the
underlying Beat Link, Crate Digger, and Beat Carabiner libraries.
- Updated the Track Loader window to forewarn you that the XDJ-XZ
Expand Down
4 changes: 2 additions & 2 deletions src/beat_link_trigger/carabiner.clj
Original file line number Diff line number Diff line change
Expand Up @@ -396,9 +396,9 @@
device-announcement-listener
(reify DeviceAnnouncementListener
(deviceFound [this announcement]
(update-device-visibility (.getNumber announcement) true))
(update-device-visibility (.getDeviceNumber announcement) true))
(deviceLost [this announcement]
(update-device-visibility (.getNumber announcement) false))))
(update-device-visibility (.getDeviceNumber announcement) false))))

(defn- link-sync-state-changed
"Event handler for when the Link Sync checkbox has changed state.
Expand Down
2 changes: 1 addition & 1 deletion src/beat_link_trigger/core.clj
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@

(when-let [unreachables (seq (.findUnreachablePlayers virtual-cdj))]
(let [descriptions (map (fn [^DeviceAnnouncement device]
(str (.getName device) " (" (.getHostAddress (.getAddress device)) ")"))
(str (.getDeviceName device) " (" (.getHostAddress (.getAddress device)) ")"))
unreachables)]
(seesaw/invoke-now
(seesaw/alert (str "<html>Found devices on multiple networks, and DJ Link can only use one.<br>"
Expand Down
4 changes: 2 additions & 2 deletions src/beat_link_trigger/players.clj
Original file line number Diff line number Diff line change
Expand Up @@ -601,7 +601,7 @@
#_(defn- no-players-found
"Returns true if there are no visible players for us to display."
[]
(empty? (filter #(<= 1 (.getNumber %) 4) (.getCurrentDevices device-finder))))
(empty? (filter #(<= 1 (.getDeviceNumber %) 4) (.getCurrentDevices device-finder))))

(defn- extract-label
"Given a `SearchableItem` from track metadata, extracts the string
Expand Down Expand Up @@ -969,7 +969,7 @@
XDJ-XZ, which has two USB slots instead."
[cell ^DeviceAnnouncement device]
(seesaw/invoke-soon
(if (= (.getName device) "XDJ-XZ")
(if (= (.getDeviceName device) "XDJ-XZ")
(do
(seesaw/value! (seesaw/select cell [:#sd-label]) "USB 1:")
(seesaw/value! (seesaw/select cell [:#usb-label]) "USB 2:"))
Expand Down
2 changes: 1 addition & 1 deletion src/beat_link_trigger/show.clj
Original file line number Diff line number Diff line change
Expand Up @@ -3926,7 +3926,7 @@
[^DeviceAnnouncement announcement show visible?]
(let [show (latest-show show)
^javax.swing.JMenu import-menu (:import-menu show)
player (.getNumber announcement)]
player (.getDeviceNumber announcement)]
(when (and (< player 5) ; Ignore non-players, and attempts to make players visible when we are offline.
(or (online?) (not visible?)))
#_(timbre/info "Updating player" player "menu item visibility to" visible?)
Expand Down
12 changes: 7 additions & 5 deletions src/beat_link_trigger/track_loader.clj
Original file line number Diff line number Diff line change
Expand Up @@ -427,7 +427,7 @@
(let [reports (map (fn [{:keys [^DefaultMutableTreeNode node item]}]
(let [entry ^IMenuEntry (.getUserObject node)
player (.. entry getSlot player)
device (.. device-finder (getLatestAnnouncementFrom player) getName)
device (.. device-finder (getLatestAnnouncementFrom player) getDeviceName)
menu (clojure.string/join "->" (get-parent-list node))]
(str "When loading menu " menu " from device named " device ", don't understand: " item)))
unrecognized)]
Expand Down Expand Up @@ -1571,7 +1571,9 @@
CdjStatus$TrackSourceSlot/NO_TRACK ""))
extra (when-let [details (.getMediaDetailsFor metadata-finder slot-reference)]
(str (when-let [name (if (= kind "Computer")
(.getName (.getLatestAnnouncementFrom device-finder (.player slot-reference)))
(.. device-finder
(getLatestAnnouncementFrom (.player slot-reference))
getDeviceName)
(.name details))] (str ": " name))
(util/media-contents details)))]
(str base extra)))
Expand Down Expand Up @@ -1721,7 +1723,7 @@
"Sets up the initial content of the destination player combo box."
[^javax.swing.JComboBox players]
(doseq [^DeviceAnnouncement announcement (.getCurrentDevices device-finder)]
(add-device players (.getNumber announcement)))
(add-device players (.getDeviceNumber announcement)))
(.setSelectedIndex players 0))

(defn- update-selected-player
Expand Down Expand Up @@ -1940,10 +1942,10 @@
(.dispatchEvent root (WindowEvent. root WindowEvent/WINDOW_CLOSING)))))
dev-listener (reify DeviceAnnouncementListener
(deviceFound [this announcement]
(seesaw/invoke-later (add-device players (.getNumber announcement))))
(seesaw/invoke-later (add-device players (.getDeviceNumber announcement))))
(deviceLost [this announcement]
(seesaw/invoke-later
(remove-device players (.getNumber announcement) stop-listener))))
(remove-device players (.getDeviceNumber announcement) stop-listener))))
mount-listener (reify MountListener
(mediaMounted [this slot]
(seesaw/invoke-later (add-slot-node slots-tree slot)))
Expand Down
2 changes: 1 addition & 1 deletion src/beat_link_trigger/util.clj
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@
network (ignoring our virtual player, and any mixers or rekordbox
instances)."
[]
(filter #(< % 16) (map (fn [^DeviceAnnouncement device] (.getNumber device))
(filter #(< % 16) (map (fn [^DeviceAnnouncement device] (.getDeviceNumber device))
(.getCurrentDevices (DeviceFinder/getInstance)))))

(defn remove-blanks
Expand Down

0 comments on commit 955071e

Please sign in to comment.