ID3 Editing and Scripting Tool
The rules for writing batch modules are similar to those for formats (see format modules) with only few differences.
The source for format module name must be saved in the file named name.scm located in the subdirectory idest/batch somewhere in the Guile load path. It must begin with the following clause:
(define-module (idest batch name))
The module must define and export the ‘idest-main’ function,
whose calling convention is the same as that in
idest scripts (see idest-main). This function
must return the new list of frames. If it returns an empty list,
all existing frames will be deleted. If the function chooses not
to modify any frames, it must return
If the module needs to process command line arguments, it should do so in the function ‘idest-init’, defined as:
(define-public (idest-init) ...)
Finally, the module should export the symbol ‘description’ with a concise description of the module. This description will be shown in the --batch=help output (see help batch).
To illustrate this, here is the code for module ‘delfrm’, which removes the requested frames from all argument files:
(define-module (idest batch delfrm)) (define-public description "remove requested frames from the input files") (define frame-list '()) (define-public (idest-main) (filter (lambda (frame) (not (member (car frame) frame-list))) frames)) (define-public (idest-init) (let ((cmd (command-line))) (cond ((< (length cmd) 3) (error "usage: idest --batch=delfrm FRAME-LIST FILE...") (exit 1)) (else (set! frame-list (string-split (list-ref cmd 1) #\,)) (set-program-arguments (cons (car cmd) (list-tail cmd 2)))))))
This document was generated on March 11, 2017 using makeinfo.Verbatim copying and distribution of this entire article is permitted in any medium, provided this notice is preserved.