From f9f689828b9e9e1ca15dc18a8ee7c3da90d2730e Mon Sep 17 00:00:00 2001 From: John Wiseman Date: Sat, 14 Dec 2019 10:20:42 -0800 Subject: [PATCH] Added --no-tweeing flag. --- src/main/lemondronor/circlebot.cljs | 9 +++++---- src/main/lemondronor/circlebot/geo.cljc | 4 ++-- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/src/main/lemondronor/circlebot.cljs b/src/main/lemondronor/circlebot.cljs index 64e8167..0e2bdd6 100644 --- a/src/main/lemondronor/circlebot.cljs +++ b/src/main/lemondronor/circlebot.cljs @@ -370,11 +370,11 @@ description))]) (fn [[image-path description]] (if (and image-path description) - (if (:twitter config) + (if (and (:tweeting-enabled? config) (:twitter config)) (twitter/tweet (twitter/twit (:twitter config)) description [image-path]) - (log-warn "Skipping tweeting: No twitter config provided")) + (log-warn "Skipping tweeting")) (log-warn "Skipping tweet %s %s" image-path description))))))))))) @@ -395,14 +395,15 @@ (.requiredOption "--lat " "Latitude of the circle of region of interest" parse-number) (.requiredOption "--lon " "Longitude of the circle of the region of interest" parse-number) (.requiredOption "--url " "API url") - (.option "--queue " "Queue URL (graphile)") (.option "--radius " "Radius of the circle of interest, in nautical miles" 20 parse-number) + (.option "--no-tweeting" "Do not tweet.") (.parse (.-argv js/process))) (let [start-time (current-time)] (p/then (p/all [(read-history-db history-db-path) (util/read-config secrets-path)]) (fn [[db config]] - (p/let [data (get-adsbexchange-live-data + (p/let [config (assoc config :tweeting-enabled? (.-tweeting commander)) + data (get-adsbexchange-live-data {:url (.-url commander) :api-key (get-in config [:adsbx :api-key]) :lat (.-lat commander) diff --git a/src/main/lemondronor/circlebot/geo.cljc b/src/main/lemondronor/circlebot/geo.cljc index 1431ce1..e91a17b 100644 --- a/src/main/lemondronor/circlebot/geo.cljc +++ b/src/main/lemondronor/circlebot/geo.cljc @@ -75,8 +75,8 @@ (nil? bearing)) -(defn spurious-bearing-diff [^double bearing] - (> (Math/abs bearing) 160)) +(defn spurious-bearing-diff [^double bearing-diff] + (> (Math/abs bearing-diff) 160)) (defn curviness