scribbu
¶scribbu
understands both its own command-line parameters as
well as those understood by the guile
command. When it sees
parameters applicable to guile
, it will collect them and
pass them on to the Scheme interpreter (when this makes sense, of
course; supplying guile
options while invoking a
scribbu
sub-command, for instance, would make no sense &
results in an error). This means that scribbu
can take
advantage of the guile
scripting options (See Guile
Scripting in The Guile Reference Manual.)
Continuing our example, let us capture our work so far:
#!/usr/local/bin/scribbu -e main -s #! (use-modules (oop goops) (scribbu)) (define (main) (let* ((tags (read-tagset "opium.mp3")) (v1 (read-id3v1-tag "opium.mp3")) (tag (caar tags))) (slot-set! (list-ref (slot-ref tag 'frames) 2) 'dsc "sp1ff@pobox.com") (slot-set! v1 'genre 171)))
This Scheme program of course does nothing; it corrects the orphaned comment frame as well as the ID3v1 genre, but only in-memory. Let us write these out to disk. Writing out the ID3v1 is simpler since it’s a fixed size, so we’ll start with that:
#!/usr/local/bin/scribbu -e main -s #! (use-modules (oop goops) (scribbu)) (define (main) (let* ((tags (read-tagset "opium.mp3")) (v1 (read-id3v1-tag "opium.mp3")) (tag (caar tags))) (slot-set! (list-ref (slot-ref tag 'frames) 2) 'dsc "sp1ff@pobox.com") (slot-set! v1 'genre 171) (write-id3v1-tag v1 "optimum.mp3")))
Writing an ID3v1 tag is also easier because it is appended to the
file. NB. v1
may be written as an ID3v1, ID3v1.1 and/or an
ID3v1 enhanced tag, depending on the precise contents of v1
See ID3v1 tags.
Writing ID3v2 tagsets is more complicated, since their size can
vary. write-tagset
can either make a wholesale copy of the
file, or attempt to emplace the new tagset at the beginning of the
extant file (which is the default):
#!/usr/local/bin/scribbu -e main -s #! (use-modules (oop goops) (scribbu)) (define (main) (let* ((tags (read-tagset "opium.mp3")) (v1 (read-id3v1-tag "opium.mp3")) (tag (caar tags))) (slot-set! (list-ref (slot-ref tag 'frames) 2) 'dsc "sp1ff@pobox.com") (slot-set! v1 'genre 171) (write-id3v1-tag v1 "optimum.mp3") (write-tagset (list (list tag 3)) "opium.mp3")))