ini file support and cover art
This commit is contained in:
@@ -18,6 +18,9 @@
|
||||
|
||||
(provide run-player-agent-gui)
|
||||
|
||||
(struct exn:fail:agent-denied exn:fail ()
|
||||
#:transparent)
|
||||
|
||||
|
||||
(define (input-field label init-val panel)
|
||||
(let ((tf (new text-field%
|
||||
@@ -91,8 +94,14 @@
|
||||
(let ((response (read-json input)))
|
||||
(when (and (hash? response)
|
||||
(string? (hash-ref response 'error #f)))
|
||||
(error 'player-agent
|
||||
(hash-ref response 'error)))
|
||||
(if (equal? (hash-ref response 'code #f)
|
||||
"agent-not-authorized")
|
||||
(raise
|
||||
(exn:fail:agent-denied
|
||||
(hash-ref response 'error)
|
||||
(current-continuation-marks)))
|
||||
(error 'player-agent
|
||||
(hash-ref response 'error))))
|
||||
response))
|
||||
(λ ()
|
||||
(close-input-port input)))))
|
||||
@@ -122,6 +131,7 @@
|
||||
(define command-worker #f)
|
||||
(define executing-command-id 0)
|
||||
(define running? #f)
|
||||
(define authorization-notified? #f)
|
||||
(define audio #f)
|
||||
(define temporary-media #f)
|
||||
(define current-media-key #f)
|
||||
@@ -509,7 +519,30 @@
|
||||
|
||||
(define (poll-loop)
|
||||
(with-handlers
|
||||
((exn:fail?
|
||||
((exn:fail:agent-denied?
|
||||
(λ (exception)
|
||||
(define message
|
||||
(string-append
|
||||
"Deze playback agent is niet toegelaten door de server. "
|
||||
"Voeg het volgende applicatie-ID toe aan [playback-agents] "
|
||||
"in de server-INI:\n\n"
|
||||
app-id))
|
||||
(warn-player-agent "Agent authorization refused: ~a"
|
||||
(exn-message exception))
|
||||
(set-agent-error! message)
|
||||
(show-status! "Niet geautoriseerd — applicatie-ID staat niet in de server-INI")
|
||||
(unless authorization-notified?
|
||||
(set! authorization-notified? #t)
|
||||
(queue-callback
|
||||
(λ ()
|
||||
(message-box "Playback agent niet toegestaan"
|
||||
message
|
||||
frame
|
||||
'(ok stop)))))
|
||||
(when running?
|
||||
(sleep 3)
|
||||
(poll-loop))))
|
||||
(exn:fail?
|
||||
(λ (exception)
|
||||
(warn-player-agent "Connection cycle failed: ~a"
|
||||
(exn-message exception))
|
||||
@@ -588,6 +621,7 @@
|
||||
|
||||
(define (reconnect!)
|
||||
(stop-worker!)
|
||||
(set! authorization-notified? #f)
|
||||
(set! server-url (string-trim (send server-field get-value)))
|
||||
(let ((new-name (string-trim (send name-field get-value))))
|
||||
(set! assigned-name
|
||||
|
||||
Reference in New Issue
Block a user