47 lines
1.8 KiB
Racket
47 lines
1.8 KiB
Racket
#lang racket
|
|
|
|
(require racket/gui
|
|
"gui.rkt"
|
|
simple-ini/class
|
|
racket-sound
|
|
racket-webview
|
|
racket/runtime-path
|
|
"utils.rkt"
|
|
)
|
|
|
|
(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]))
|
|
(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)
|
|
(let ((prefix (path->string
|
|
(build-path (find-system-path 'cache-dir)
|
|
"rktplayer-cover-image"))))
|
|
(dbg-rktplayer "prefix= ~a" prefix)
|
|
(dbg-rktplayer "is-prefix? = ~a" (string-prefix? file prefix))
|
|
(if (string-prefix? file prefix)
|
|
(begin
|
|
(dbg-rktplayer "RETURNING FILE")
|
|
file)
|
|
path)))
|
|
)]
|
|
))
|
|
(window (new rktplayer% [wv-context context]))
|
|
)
|
|
window)
|
|
)
|
|
|
|
;(run) |