view · edit · attach · print · history

The contents of this website are Copyright (c)2004 by Brian Manning <brian at antlinux dot com>. Please do not reuse any of the content on this website without permission from the author.

See also Gallery, a web gallery builder. Adversity testing should also be made a part of these scripts, so if someone else were to pick them up and try to use them, they would actually work. The Perl Media Modules will do the behind-the-scenes work of Tag.

Tool of Media Management "Tag" is a script that will let you manipulate the metadata (tags) stored in various kinds of media files. Files such as JPEGs, PNGs, MP3s, OGGs and FLACs all allow you to store metadata inside the file as part of the file's normal structure.

The goal will be to build a set of Perl scripts that reads in a file, and then depending on what type of file was read, create an object for that file that can manipulate the file's physical properties as far as adding and removing metadata information from the file. Image files could have copyright and keywords added to the text tags, music files could be tagged with artist/album/song name and recording location, etc.

Code for reading files and outputting data should be modular, so new file formats can be added at any time with a minimum amount of hassle. Along with the filetypes listed below for input, output could consist of generating web pages based on the list of files that is generated, or the files can be added to a database for later retrieval by other scripts/applications.

Use Model/View/Controller architecture to decouple the interface from the backend machinery. Build a text interface, then a curses interface, then a Tk GUI interface.

You could also call the program non-interactively with a tag file, and Tag will apply what's in the tagfile to the file specified on the command line. Have Tag generate blank tagfiles for it's own use, so there's no confusion about which tag goes where.

Basic Tag Script Steps

TODO- create a flowchart for the below steps...

  • initialization
    • parse commandline options. See http://search.cpan.org/modlist/Option_Parameter_Config_Processing for external modules that can do this for you
    • detect where needed binaries are
      • PATH variables added to tell the script where to look for external binaries
    • keep a list of binaries that could be used for each type of operation, and run through the list when doing the initialization; if more than one binary for each operation is available, offer the user a choice between binaries
    • set up logging by creating a log/debug object; the code in the rest of the application would just use this log object, and the log object would take care of what log data needs to go where based on user options passed in at runtime
    • always change all GIF's to PNG's unless disabled via commandline switch
  • detection steps
    • file type detection
    • detection of existing tags (if any)
    • see AntBuild for a list of Perl modules that do filetype detection
  • manipulation steps
    • chop/crop/retag the file
  • output steps (both copies of original files and HTML/PHP wrappers for gallery listings)
view · edit · attach · print · history
Page last modified on August 19, 2005, at 05:19 PM