Bryce Harrington > SVG-Metadata > svg_annotate

Download:
SVG-Metadata-0.28.tar.gz

Annotate this POD

View/Report Bugs
Source  

NAME ^

svg_annotate - Adds RDF metadata to an SVG file. This script scans files and directories for SVG files and if they lack embedded RDF metadata, inserts it.

SYNOPSIS ^

svg_annotate [OPTIONS] [file1[, file2]] [subdir1[, subdir2...]]

 -V, --version     Displays version info for the script
 -h, --help        This help screen
 -D, --debug=N     Reports debugging info (1=sparse, 3=tons)
 -a, --author=s    Name of the author to use in the RDF
 -o, --owner=s     Name of the owner to use in the RDF
 -l, --license=s   License URL to use in the RDF
 -t, --title=s     Title string to use in the RDF
     --delete      Removes the RDF section(s) from the SVG file(s)

DESCRIPTION ^

This script uses SVG::Metadata to annotate RDF metadata to one or more SVG files. It checks to be sure the file does not already contain an RDF section (in which case it skips the file), and if not, places an RDF section at the end of the file, just before the closing </svg> tag.

The purpose of this script is to enable artists with large collections of images to quickly and easily annotate entire trees of files with metadata. The main aim of this is to assist the artists of the Open Clip Art Library (http://www.openclipart.org).

EXAMPLES ^

Annotate all the items in or under the current directory, with da Vinci as the artist. By default, license is Public Domain, and for 'my_file.svg', title is set to "Leonardo da Vinci - my_file":

  svg_annotate -a 'Leonardo da Vinci' .

Add RDF with specified author, license, and title for the SVG files in the current directory:

  svg_annotate *.svg \
     -a 'Leonardo da Vinci' \
     -l 'http://creativecommons.org/licenses/GPL/2.0/' \
     -t 'Mona Lisa (<FILENAME>)'

svg_annotate allows several fill-ins to be used in the title field:

    <FILENAME>  - the full filename of the file
    <FILEBASE>  - the basename of the filename (the part before the extension)
    <FILEEXT>   - the extension of the filename (usually always svg)
    <DIR>       - the directory path to the file
    <AUTHOR>    - the name of the author of the file
    <OWNER>     - the name of the owner of the file
    <KEYWORDS>  - the keywords for the file
    <LOCALTIME> - the current date and time
    <GMTIME>    - the current date and time in Coordinated Universal Time (UTC) format

It is also possible to delete the RDF from one or more files, using the --delete flag. For instance:

  svg_annotate --delete  *.svg

This will work recursively into any directories specified on the commandline, working on any *.svg files it finds in the indicated directory tree. E.g.:

  svg_annotate --delete  my_svg_files/

OPTIONS ^

-V, --version

Displays the version information about the script.

-h, --help

Prints a brief help message with option summary.

-D N, --debug=N

Prints debug messages. This expects a numerical argument corresponding to the debug message verbosity.

-a author, --author=author

Specifies the name of the author to use for the RDF. Remember to use quotes if you wish to specify a multi-word name. E.g., --author="Bryce W. Harrington".

-o owner, --owner=owner

The owner for the file. Typically the same as the author.

-k keyword0,keyword1,..., --keywords=keyword,...

Sets the keyword(s) for the image. This parameter can be used multiple times, such as:

    svg_metadata apple.svg -k apple -k fruit -k food

or can take comma delimited parameters, such as:

    svg_metadata apple.svg --keywords=apple,fruit,food
-l license, --license=license

The license URL to use for the file. See the Creative Common's site for typical licenses. By default it uses the Public Domain license, --license="http://web.resource.org/cc/PublicDomain".

-t title, --title=title

The title to use for all the indicated files. Note that several fill-in parameters are included, for a little dynamism (see DESCRIPTION, above).

--delete

Causes svg_annotate to operate in RDF-deletion mode. Instead of adding RDF, the script will instead parse the SVG file and remove any metadata sections, as distinguished by the tags <rdf>, <rdf:RDF>, or <metadata>.

PREREQUISITES ^

Pod::Usage, Getopt::Long, File::Basename, File::Copy, File::Find, File::Path, File::Spec, XML::Twig, SVG::Metadata

COREQUISITES ^

None

SCRIPT CATEGORIES ^

Text Processing::Filters Utilities

BUGS ^

For licenses other than Public Domain, it screws up the Rights section.

SEE ALSO ^

SVG::Metadata, inkscape, XML::Twig

AUTHOR ^

Bryce Harrington <bryce@bryceharrington.org>

http://www.bryceharrington.org/

COPYRIGHT ^

Copyright (C) 2004 Bryce Harrington. All Rights Reserved.

This script is free software; you can redistribute it and/or modify it under the same terms as Perl itself.

syntax highlighting: