aboutsummaryrefslogtreecommitdiff
path: root/scheme/idest/format/pic.scm
diff options
context:
space:
mode:
authorSergey Poznyakoff <gray@gnu.org.ua>2011-07-27 19:49:26 +0300
committerSergey Poznyakoff <gray@gnu.org.ua>2011-07-27 19:49:26 +0300
commitc675f974b1787097237be644f77ba1d40385e425 (patch)
treeb7bf6e322b9a1afbc03f6952c0268212477cfd45 /scheme/idest/format/pic.scm
parent2c553ede1ca6293d44e6b909d8824c7938ce5c31 (diff)
downloadidest-c675f974b1787097237be644f77ba1d40385e425.tar.gz
idest-c675f974b1787097237be644f77ba1d40385e425.tar.bz2
Add full support for APIC frames.
* src/frametab.gperf: Support APIC. * src/idop.c (field_binary_from_string): Accept lowercase hex digits. * scheme/idest/batch/setpic.scm: New batch. * scheme/idest/format/pic.scm: Use named elements.
Diffstat (limited to 'scheme/idest/format/pic.scm')
-rw-r--r--scheme/idest/format/pic.scm20
1 files changed, 11 insertions, 9 deletions
diff --git a/scheme/idest/format/pic.scm b/scheme/idest/format/pic.scm
index 8f94599..29f658b 100644
--- a/scheme/idest/format/pic.scm
+++ b/scheme/idest/format/pic.scm
@@ -32,7 +32,7 @@
;; ~P - Picture type
;; ~I - pid
(define (format-file-name fmt input-name frame)
- (let* ((rawdata (assoc-ref (cdr frame) 'rawdata))
+ (let* ((data (cdr frame))
(fmtlist (string-split fmt #\~))
(segments (reverse
(fold
@@ -60,13 +60,13 @@
(if pos
(substring bname 0 pos)
bname)))
- ((#\C) (list-ref (list-ref rawdata 3) 2))
- ((#\T) (let* ((t (list-ref (list-ref rawdata 1) 2))
+ ((#\C) (assoc-ref data 'condesc))
+ ((#\T) (let* ((t (assoc-ref data 'mime-type))
(pos (string-index t #\/)))
(if pos
(substring t (+ pos 1))
t)))
- ((#\P) (list-ref (list-ref rawdata 0) 2))
+ ((#\P) (assoc-ref data 'pic-type))
((#\I) (number->string (getpid))))
(substring seg 1)))
segments))))
@@ -168,16 +168,18 @@
(lambda (name frames)
(let ((pictures (filter
(lambda (frame)
- (let ((rawdata (assoc-ref (cdr frame) 'rawdata))
+ (let ((data (cdr frame))
(id (car frame)))
(and (string=? id "APIC")
(or (not mime-type)
(string-ci=?
- (list-ref (list-ref rawdata 1) 2)
+ (or (assoc-ref data 'mime-type)
+ "image/png")
mime-type))
(or (not description)
(string-ci=?
- (list-ref (list-ref rawdata 3) 2)
+ (or (assoc-ref data 'condesc)
+ "")
description)))))
frames)))
(force-output (current-output-port))
@@ -189,10 +191,10 @@
(else
(for-each
(lambda (pic)
- (let ((data (list-ref (assoc-ref (cdr pic) 'rawdata) 4))
+ (let ((data (assoc-ref (cdr pic) 'text))
(file-name (format-file-name file name pic)))
(format #t "Saving ~A~%" file-name)
- (save-picture file-name (list-ref data 2))
+ (save-picture file-name data)
(cond
((not store)
(let ((res (system* viewer file-name)))

Return to:

Send suggestions and report system problems to the System administrator.