Update media-library logging and return value

This commit is contained in:
TakeV 2024-05-25 19:28:44 -04:00
parent 4fcc130c9c
commit 86af891b0c
Signed by: TakeV
GPG key ID: A64F41345C7400AF

View file

@ -27,19 +27,17 @@
(*media-library*))
(define (create-media-library)
(write-log! "Creating media library.")
(make-media-library (make-eq-hashtable)
(make-eq-hashtable)))
(define (add-image! media-library image-symbol image)
(write-log! "Adding image: " image-symbol)
(hashtable-set! (media-images media-library) image-symbol image))
(define (add-images! media-library images)
(write-log! "Adding images: " images)
(for-each (lambda (val)
(add-image! media-library (car val) (cdr val)))
images))
(define (get-image media-library image-symbol)
(hashtable-ref (media-images media-library) image-symbol #f))
"Gets the image in the library, or 'image-not-found if the image does not exists."
(hashtable-ref (media-images media-library) image-symbol 'image-not-found))