diff options
Diffstat (limited to 'src/gizmo')
| -rw-r--r-- | src/gizmo/wasp-bannerads.el | 25 | ||||
| -rw-r--r-- | src/gizmo/wasp-biblicality.el | 3 | ||||
| -rw-r--r-- | src/gizmo/wasp-heartrate.el | 10 |
3 files changed, 34 insertions, 4 deletions
diff --git a/src/gizmo/wasp-bannerads.el b/src/gizmo/wasp-bannerads.el index 2586600e..70f9c8be 100644 --- a/src/gizmo/wasp-bannerads.el +++ b/src/gizmo/wasp-bannerads.el @@ -9,6 +9,8 @@ (require 'wasp-utils) (require 'wasp-chat) +(defvar w/banner-ad-block nil) + (defcustom w/banner-ad-buffer "*wasp-banner-ad*" "Name of buffer used to display banner ad." :type '(string) @@ -32,9 +34,13 @@ (setq-local cursor-type nil) (let* ((inhibit-read-only t)) (erase-buffer) - (let* ((paths (f-files (w/asset "bannerads"))) - (path (w/pick-random paths))) - (w/write (propertize "bannerad" 'display (create-image path nil nil :max-width 555 :max-height 175))))))) + (if w/banner-ad-block + (w/write "This advertisement was blocked by your adblocker") + (let* ((paths (f-files (w/asset "bannerads"))) + (path (w/pick-random paths)) + (img (create-image path nil nil :max-width 555 :max-height 175))) + (image-animate img nil t) + (w/write (propertize "bannerad" 'display img))))))) (defvar w/banner-ad-timer nil) (defun w/run-banner-ad-timer () @@ -47,5 +53,18 @@ (run-with-timer 60 nil #'w/run-banner-ad-timer))) (w/run-banner-ad-timer) + +(defun w/banner-ad-block () + "Toggle adblock." + (setq w/banner-ad-block t) + (w/render-banner-ad) + (w/model-toggle-set "adblock") + (run-with-timer 10 nil + (lambda () + (setq w/banner-ad-block nil) + (w/model-toggle-unset "adblock") + (w/render-banner-ad))) + nil) + (provide 'wasp-bannerads) ;;; wasp-bannerads.el ends here diff --git a/src/gizmo/wasp-biblicality.el b/src/gizmo/wasp-biblicality.el index b7c46ed8..317e87f7 100644 --- a/src/gizmo/wasp-biblicality.el +++ b/src/gizmo/wasp-biblicality.el @@ -37,7 +37,8 @@ (let ((occs (ht-get w/bible-table (downcase (s-trim word)))) (thresh 0.6)) (if occs - (+ thresh (/ (min occs 1000.0) (/ 1000.0 (- 1.0 thresh)))) + ;; (+ thresh (/ (min occs 1000.0) (/ 1000.0 (- 1.0 thresh)))) + (+ thresh (/ (min occs 10.0) (/ 10.0 (- 1.0 thresh)))) 0.0)))) (defun w/bible-word-color (word) diff --git a/src/gizmo/wasp-heartrate.el b/src/gizmo/wasp-heartrate.el index 62994680..a195e0c5 100644 --- a/src/gizmo/wasp-heartrate.el +++ b/src/gizmo/wasp-heartrate.el @@ -14,10 +14,19 @@ (let ((res (shell-command-to-string "uptime"))) (string-to-number (s-trim (car (s-split "," (cadr (s-split "load average:" res)))))))) +(defun w/get-disk-usage (disk) + "Get the current usage percent for DISK" + (let ((res (shell-command-to-string (format "df %s" disk)))) + (string-to-number (s-chop-suffix "%" (nth 4 (s-split " " (cadr (s-lines res)) t)))))) + (defun w/get-heartrate () "Get the streamer's heart rate." (* 100 (w/get-load))) +(defun w/get-blood-pressure () + "Get the streamer's blood pressure." + (format "%s/%s" (w/get-disk-usage "/") (w/get-disk-usage "/home"))) + (defface w/heartrate-big '((t :foreground "white" @@ -57,6 +66,7 @@ (let* ((inhibit-read-only t)) (erase-buffer) (w/write-line (format "%3d bpm" (w/get-heartrate)) 'w/heartrate-big) + (w/write-line (format "blood pressure: %s" (w/get-blood-pressure)) 'w/heartrate-small) (w/write (format "arbitrary counter: %s times" w/chat-bpm-count) 'w/heartrate-small)))) (defvar w/heartrate-timer nil) |
