Wijzigingen.

This commit is contained in:
2026-08-04 22:31:25 +02:00
parent e54f6f4a5f
commit 186b3bb8d7
6 changed files with 70 additions and 15 deletions
+1 -1
View File
@@ -19,7 +19,7 @@
[buffer-max-seconds 10]
[buffer-min-seconds 4]
[server-url #f]
[server-port 8080]
[server-port 8734] ;8080]
[listen-ip #f]
[poll-seconds 1.0]
[volume-poll-seconds 5.0])
+30
View File
@@ -0,0 +1,30 @@
#lang info
(define pkg-authors '(hnmdijkema))
(define version "0.1.1")
(define license 'MIT)
(define collection "rktplayer")
(define pkg-desc "rktplayer - A music player written in racket")
(define deps
'("racket/gui" "racket/base" "racket"
"finalizer" "draw-lib" "net-lib"
"simple-log" "simple-ini" "racket-sprintf"
"early-return" "let-assert"
"uni-channel" "port-channel"
"rackunit-lib"
)
)
(define build-deps
'("racket-doc"
"draw-doc"
"rackunit-lib"
"scribble-lib"
))
(define test-omit-paths 'all)
+19 -8
View File
@@ -27,6 +27,7 @@
(list id name local-path host prefixes current))
))
(define libraries%
(class object%
(init-field [settings settings])
@@ -52,9 +53,13 @@
(define/public (libraries)
(when (eq? libs #f)
(set! libs (sort (map to-library (send cfg get 'libraries '()))
(lambda (a b)
(string<? (send a get-name) (send b get-name))))))
(let ((cfg-libs (send cfg get 'libraries '())))
(dbg-rktplayer "libraries from ini: ~a" cfg-libs)
(set! libs (sort (map to-library cfg-libs)
(lambda (a b)
(string<? (send a get-name) (send b get-name)))))
(dbg-rktplayer "libs: ~a" (map (λ (x) (list (send x get-id) (send x get-name))) libs))
))
libs)
(define/public (set-libraries! libs*)
@@ -72,9 +77,16 @@
(define/public (get-library id)
(let ((libs (send this libraries)))
(for/or ([lib libs])
(when (eq? (send lib get-id) id)
lib))))
(letrec ((f (λ (libs)
(if (null? libs)
#f
(let* ((lib (car libs))
(lib-id (send lib get-id)))
(dbg-rktplayer "symbol? lib-id: ~a, lib-id: ~a (~a) eq? ~a" (symbol? lib-id) lib-id (send lib get-name) id)
(if (eq? lib-id id)
lib
(f (cdr libs))))))))
(f libs))))
(define/public (remove-library id)
(let ((libs (send this libraries)))
@@ -84,8 +96,7 @@
(define/public (add-library l)
(let ((libs (send this libraries)))
(send this set-libraries!
(cons (send l ->list) libs))
(send this set-libraries! (cons l libs))
(set! libs #f)
(send l get-id)))
+6 -2
View File
@@ -17,10 +17,12 @@
(define-runtime-path rkt-gui-dir "gui")
(define log-file (build-path (find-system-path 'cache-dir) ".rktplayer.log"))
(displayln log-file)
(sl-log-to-file log-file)
(define store (sl-log-to-store))
(void (current-opusfile-output-format 's24))
;(sl-log-to-display)
(define (my-file-getter url)
(dbg-rktplayer "my-file-getter - url = ~a" url)
@@ -62,6 +64,7 @@
[file-getter my-file-getter]
))
)
(displayln (format "ini file: ~a" (send ini get-file)))
(set-lang! (send ini get 'settings 'language 'en))
(let* ((window (new rktplayer% [wv-context context] [log-file log-file]))
(tray (new rktplayer-tray% [rktplayer-gui window]))
@@ -107,7 +110,8 @@
(webview-wait-for-quit)
(send rktplayer-tray close)
(webview-exit)
(exit))
;(exit)
)
)
)
)
+3 -1
View File
@@ -169,7 +169,9 @@
'()
(cons
(let* ((id (send libs library-id i))
(entry (send libs get-library id))
(entry (begin
(dbg-rktplayer "index = ~a, id = ~a, symbol? id = ~a" i id (symbol? id))
(send libs get-library id)))
(name (send entry get-name))
(local-path (send entry get-local-path))
(host (send entry get-host))
+11 -3
View File
@@ -51,15 +51,23 @@
(super-new [icon (build-path rkt-gui-dir "rktplayer.png")]
[tooltip (tr 'racket-music-player)])
(define last-state #f)
(begin
(send rktplayer-gui set-window-state-change-callback!
(λ ()
(let ((st (send rktplayer-gui window-state)))
(if (eq? st 'minimized)
(begin
(dbg-rktplayer "state = ~a, hiding window" st)
(send rktplayer-gui present)
(send rktplayer-gui hide))
(if (eq? last-state 'minimized)
(begin
(dbg-rktplayer "state = ~a, presenting window" st)
(send rktplayer-gui present)
(set! last-state 'presented))
(begin
(dbg-rktplayer "state = ~a, hiding window" st)
(send rktplayer-gui hide)
(set! last-state 'minimized))))
(adjust-menu))
)
)