didl toevoegingen
This commit is contained in:
@@ -0,0 +1,41 @@
|
||||
#lang racket/base
|
||||
|
||||
(require rackunit
|
||||
racket/port
|
||||
xml
|
||||
"../didl-lite.rkt"
|
||||
"../private/xml.rkt")
|
||||
|
||||
(define metadata
|
||||
(didl-lite-audio-item
|
||||
"http://example.test/audio?a=1&b=2"
|
||||
#:protocol-info
|
||||
"http-get:*:audio/flac:DLNA.ORG_OP=01;DLNA.ORG_CI=0"
|
||||
#:title "Rock & Roll <live>"
|
||||
#:duration 639.9
|
||||
#:size 50357462))
|
||||
|
||||
(define document
|
||||
(call-with-input-string metadata read-xml))
|
||||
|
||||
(define root
|
||||
(xml->xexpr (document-element document)))
|
||||
|
||||
(define item
|
||||
(car (xexpr-child-elements root "item")))
|
||||
|
||||
(define resource
|
||||
(car (xexpr-child-elements item "res")))
|
||||
|
||||
(check-equal? (xexpr-child-text item "title")
|
||||
"Rock & Roll <live>")
|
||||
(check-equal? (xexpr-child-text item "class")
|
||||
"object.item.audioItem.musicTrack")
|
||||
(check-equal? (xexpr-text resource)
|
||||
"http://example.test/audio?a=1&b=2")
|
||||
(check-equal? (xexpr-attribute resource 'protocolInfo)
|
||||
"http-get:*:audio/flac:DLNA.ORG_OP=01;DLNA.ORG_CI=0")
|
||||
(check-equal? (xexpr-attribute resource 'duration)
|
||||
"0:10:39")
|
||||
(check-equal? (xexpr-attribute resource 'size)
|
||||
"50357462")
|
||||
+17
-1
@@ -186,7 +186,17 @@
|
||||
(check-equal? (transport-position-seconds position) 151/2)
|
||||
(check-equal? (transport-position-duration position) 210)
|
||||
(check-equal? (transport-position-uri position) "http://example/test.flac"))
|
||||
(av-transport-set-uri! av "http://127.0.0.1/test?a=1&b=2")
|
||||
(av-transport-set-uri!
|
||||
av
|
||||
"http://127.0.0.1/test?a=1&b=2"
|
||||
#:metadata
|
||||
(didl-lite-audio-item
|
||||
"http://127.0.0.1/test?a=1&b=2"
|
||||
#:protocol-info
|
||||
"http-get:*:audio/flac:DLNA.ORG_OP=01;DLNA.ORG_CI=0"
|
||||
#:title "Test & metadata"
|
||||
#:duration 210
|
||||
#:size 123456))
|
||||
(check-equal? (rendering-control-volume rendering) 37)
|
||||
(rendering-control-set-volume! rendering 300)
|
||||
(let-values ([(source sink) (connection-manager-protocols connection)])
|
||||
@@ -212,5 +222,11 @@
|
||||
(ormap (lambda (body)
|
||||
(regexp-match? #rx"http://127.0.0.1/test\\?a=1&b=2" body))
|
||||
(unbox recorded-bodies)))
|
||||
(check-true
|
||||
(ormap (lambda (body)
|
||||
(and (regexp-match? #rx"CurrentURIMetaData" body)
|
||||
(regexp-match? #rx"DIDL-Lite" body)
|
||||
(regexp-match? #rx"DLNA[.]ORG_OP=01" body)))
|
||||
(unbox recorded-bodies)))
|
||||
|
||||
(displayln "UPnP tests passed")
|
||||
|
||||
Reference in New Issue
Block a user