refactoring volgens skill
This commit is contained in:
+14
-14
@@ -77,7 +77,7 @@
|
||||
(list-ref (current-tracks playback) index)))
|
||||
|
||||
(define (normalized-file file)
|
||||
(with-handlers ((exn:fail? (lambda (_) (format "~a" file))))
|
||||
(with-handlers ((exn:fail? (λ (_) (format "~a" file))))
|
||||
(path->string (path->complete-path file))))
|
||||
|
||||
(define (same-file? first second)
|
||||
@@ -136,7 +136,7 @@
|
||||
((not (equal? following (dlna-playback-prepared-index playback)))
|
||||
(with-handlers
|
||||
((exn:fail?
|
||||
(lambda (exception)
|
||||
(λ (exception)
|
||||
(set-dlna-playback-prepared-index! playback #f)
|
||||
(warn-web-player-dlna
|
||||
"Could not prepare next DLNA track: ~a"
|
||||
@@ -155,7 +155,7 @@
|
||||
"index" index))
|
||||
(with-handlers
|
||||
((exn:fail?
|
||||
(lambda (exception)
|
||||
(λ (exception)
|
||||
(report-failure! playback (exn-message exception))
|
||||
(raise exception))))
|
||||
(dlna-player-play! (dlna-playback-player playback) (track-file item))
|
||||
@@ -286,11 +286,11 @@
|
||||
(when (dlna-playback-running? playback)
|
||||
(with-handlers
|
||||
((exn:fail?
|
||||
(lambda (exception)
|
||||
(λ (exception)
|
||||
(warn-web-player-dlna
|
||||
"Could not update DLNA playback state: ~a"
|
||||
(exn-message exception)))))
|
||||
(with-lock playback (lambda () (poll/locked! playback))))
|
||||
(with-lock playback (λ () (poll/locked! playback))))
|
||||
(loop)))))
|
||||
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
@@ -319,26 +319,26 @@
|
||||
playback)
|
||||
|
||||
(define (dlna-playback-play-index! playback index)
|
||||
(with-lock playback (lambda () (play-index/locked! playback index))))
|
||||
(with-lock playback (λ () (play-index/locked! playback index))))
|
||||
|
||||
(define (dlna-playback-pause! playback)
|
||||
(with-lock
|
||||
playback
|
||||
(lambda ()
|
||||
(λ ()
|
||||
(dlna-player-pause! (dlna-playback-player playback))
|
||||
(notify! playback 'paused (dlna-player-info (dlna-playback-player playback))))))
|
||||
|
||||
(define (dlna-playback-resume! playback)
|
||||
(with-lock
|
||||
playback
|
||||
(lambda ()
|
||||
(λ ()
|
||||
(dlna-player-resume! (dlna-playback-player playback))
|
||||
(notify! playback 'playing (dlna-player-info (dlna-playback-player playback))))))
|
||||
|
||||
(define (dlna-playback-stop! playback)
|
||||
(with-lock
|
||||
playback
|
||||
(lambda ()
|
||||
(λ ()
|
||||
(set-dlna-playback-stop-requested?! playback #t)
|
||||
(set-dlna-playback-playing-seen?! playback #f)
|
||||
(set-dlna-playback-progress-seen?! playback #f)
|
||||
@@ -351,7 +351,7 @@
|
||||
(define (dlna-playback-seek-percentage! playback percentage)
|
||||
(with-lock
|
||||
playback
|
||||
(lambda ()
|
||||
(λ ()
|
||||
(dlna-player-seek-percentage! (dlna-playback-player playback) percentage)
|
||||
;; racket-audio-dlna updates its cache synchronously after Seek. Publish
|
||||
;; that value immediately so the web slider does not jump back.
|
||||
@@ -363,7 +363,7 @@
|
||||
(define (dlna-playback-volume! playback percentage)
|
||||
(with-lock
|
||||
playback
|
||||
(lambda ()
|
||||
(λ ()
|
||||
(dlna-player-volume! (dlna-playback-player playback) percentage)
|
||||
(define info (dlna-player-info (dlna-playback-player playback)))
|
||||
(notify! playback
|
||||
@@ -373,7 +373,7 @@
|
||||
(define (dlna-playback-repeat! playback repeat)
|
||||
(with-lock
|
||||
playback
|
||||
(lambda ()
|
||||
(λ ()
|
||||
(set-dlna-playback-repeat! playback repeat)
|
||||
(set-dlna-playback-prepared-index! playback #f)
|
||||
(prepare-next! playback))))
|
||||
@@ -387,7 +387,7 @@
|
||||
(set-dlna-playback-monitor! playback #f)
|
||||
(with-lock
|
||||
playback
|
||||
(lambda ()
|
||||
(λ ()
|
||||
(dlna-player-close! (dlna-playback-player playback))))))
|
||||
|
||||
(module+ test
|
||||
@@ -400,7 +400,7 @@
|
||||
(track (build-path "music" "02.flac")
|
||||
"Second" "Artist" "Album" 60 "audio/flac"))
|
||||
(define playback
|
||||
(dlna-playback #f (lambda () (list first second)) void void
|
||||
(dlna-playback #f (λ () (list first second)) void void
|
||||
'off 0 #f #f #f #f #f #f 0 #f #t #f #f
|
||||
(make-semaphore 1)))
|
||||
|
||||
|
||||
Reference in New Issue
Block a user