small bugs.
This commit is contained in:
+32
-1
@@ -125,13 +125,44 @@
|
||||
(error 'make-tags-picture-from-bitmap "could not encode bitmap as ~a" mimetype))
|
||||
(get-output-bytes out))
|
||||
|
||||
|
||||
(define picture-type-names
|
||||
(hash 0 "Other"
|
||||
1 "File Icon"
|
||||
2 "Other File Icon"
|
||||
3 "Front Cover"
|
||||
4 "Back Cover"
|
||||
5 "Leaflet Page"
|
||||
6 "Media"
|
||||
7 "Lead Artist"
|
||||
8 "Artist"
|
||||
9 "Conductor"
|
||||
10 "Band"
|
||||
11 "Composer"
|
||||
12 "Lyricist"
|
||||
13 "Recording Location"
|
||||
14 "During Recording"
|
||||
15 "During Performance"
|
||||
16 "Movie Screen Capture"
|
||||
17 "Coloured Fish"
|
||||
18 "Illustration"
|
||||
19 "Band Logo"
|
||||
20 "Publisher Logo"))
|
||||
|
||||
(define (picture-kind->string kind)
|
||||
(cond
|
||||
[(string? kind) kind]
|
||||
[(symbol? kind) (string-titlecase (regexp-replace* #rx"-" (symbol->string kind) " "))]
|
||||
[(integer? kind) (hash-ref picture-type-names kind (number->string kind))]
|
||||
[else (raise-argument-error 'make-tags-picture "(or/c string? symbol? integer?)" kind)]))
|
||||
|
||||
(define (make-tags-picture mimetype kind data #:description [description ""])
|
||||
(define bytes
|
||||
(cond
|
||||
[(bytes? data) data]
|
||||
[(is-a? data bitmap%) (bitmap->encoded-bytes data mimetype)]
|
||||
[else (raise-argument-error 'make-tags-picture "(or/c bytes? (is-a?/c bitmap%))" data)]))
|
||||
(make-id3-picture mimetype kind (bytes-length bytes) bytes description))
|
||||
(make-id3-picture mimetype (picture-kind->string kind) (bytes-length bytes) bytes description))
|
||||
|
||||
(define (make-tags-picture-from-bitmap bm kind #:mimetype [mimetype "image/png"] #:description [description ""])
|
||||
(make-tags-picture mimetype kind bm #:description description))
|
||||
|
||||
Reference in New Issue
Block a user