simple-log integration

This commit is contained in:
2026-04-09 10:43:04 +02:00
parent c35eef081e
commit e099838fb8
6 changed files with 164 additions and 141 deletions

View File

@@ -3,33 +3,37 @@
(require racket/gui
"gui.rkt"
simple-ini/class
web-racket
racket-sound
racket-webview
racket/runtime-path
"utils.rkt"
)
(let ((os (system-type 'os)))
(cond
((eq? os 'windows)
(ww-set-custom-webui-wire-command! "C:/devel/racket/webui-wire/build/Release/webui-wire.exe"))
((eq? os 'unix)
(ww-set-custom-webui-wire-command! "/home/hans/src/racket/webui-wire/build/Release/webui-wire"))
(else (error "Cannot set custom webui-wire command"))
)
)
(ww-set-debug #f)
(ww-set-log-level 'info)
;(ww-tail-log)
;(ww-tail-log)
;(ao-set-async-mode! 'scheme)
;(collect-garbage 'incremental)
(define-runtime-path rkt-gui-dir "gui")
(ao-set-async-mode! 'ffi)
(define log-file (build-path (find-system-path 'home-dir) ".rktplayer.log"))
(sl-log-to-file log-file)
(displayln (format "Logging to file ~a" log-file))
(define (run)
(let* ((ini (new ini% [file 'rktplayer]))
(settings (new ww-simple-ini% [ini ini] [section 'player]))
(window (new rktplayer% [settings settings] [use-browser #t]))
(context (new wv-context%
[base-path rkt-gui-dir]
[ini ini]
[file-getter (webview-standard-file-getter rkt-gui-dir
#:not-exist
(λ (file base-path path)
(dbg-rktplayer "FILE:~a, ~a, ~a" file base-path path)
(if (string-prefix? file "/tmp/cover-image")
(begin
(dbg-rktplayer "RETURNING FILE")
file)
path))
)]
))
(window (new rktplayer% [wv-context context]))
)
window)
)