IdEst – ID3 Editing and Scripting Tool (split by node):   Section:   Chapter:FastBack: Scripting   Up: Scripting   FastForward: Backups   Contents: Table of ContentsIndex: Concept Index

10.5 Testing Scripts

When writing a script which modifies tags, it is good idea to test it before applying it to your data. Idest provides a special option for that: --dry-run (-n, e.g.:

$ idest --dry-run --script settitle *.mp3

This will run your script as usual, but instead of applying the changes to the input files, idest will verbosely print results of each invocation of ‘idest-main’. When --dry-run is used, input files are opened in read-only mode.

This option works with batch files as well, e.g.:

$ idest --dry-run --batch delfrm *.mp3

Here is an example of the dry-run output, obtained from the command above:

dry-run: loading ../examples/settitle.scm ...
dry-run: loading /usr/share/guile/1.8/ice-9/regex.scm ...
dry-run: loading /usr/share/guile/1.8/srfi/srfi-13.scm ...
File Tinc_un_clavell_per_a_tu.mp3
(TIT2 (text . Tinc un clavell per a tu))
(TALB (descr . Album/movie/show title) (text . Maremar))
...

The first frame shown (‘TIT2’) was produced by settitle.scm (see the previous chapter). Rest of frames come from the input file itself.

Notice the diagnostics lines which start with ‘dry-run’. In dry-run mode idest verbosely reports the full file names of all files it loads. In this particular case, the line

dry-run: loading ../examples/settitle.scm ...

shows the full path of the script file itself, whereas the two lines

dry-run: loading /usr/share/guile/1.8/ice-9/regex.scm ...
dry-run: loading /usr/share/guile/1.8/srfi/srfi-13.scm ...

reflect the use-modules clause at the beginning of settitle.scm (see settitle.scm).

Implementation note

The ‘dry-run’ mode is actually implemented as a usual idest Guile script, named dry-run.scm. The script is installed to the package script directory. Its source can be found in the subdirectory scheme of the idest distribution.

IdEst – ID3 Editing and Scripting Tool (split by node):   Section:   Chapter:FastBack: Scripting   Up: Scripting   FastForward: Backups   Contents: Table of ContentsIndex: Concept Index