WACS: Application Programming Interface

Contents

Modules

There are now five operational modules available as part of the WACS system, plus a utility module used by the installers. The key modules are:

In the 0.7.3 release, a new module called WacsUI.pm was added to contain functions directly related to the user interface. This was done to simplify the access for programmers and web designers to those functions that handle user interface aspects. The intention is that these components will also be available in the Wacs-PHP module of the same name.

Shortly after the 0.5 release, a new module called WacsId.pm - The WACS Identification Module - was introduced to concentrate all the heroic heuristics used in guessing details from filenames and other sources of information into a separate location from the main Wacs.pm module. The reason for this is that the heuristics require a lot of tuning and tweeking over time and are usually called only by the importer applications. Should bugs creep into these, keeping them separate would ensure that the functioning of the core Wacs system would be unaffected by changes and updates to these routines.

API definition

Below is a single line summary of each of the exported functions from the each of the WACS support perl modules. The next page on Wacs programming, gives a general introduction to using the wacs API in your own programs. For the lesser used calls, much more detailed information and comments can be found in the source code to the perl modules themselves.

Wacs.pm: The Main WACS Support Module

read_conf() - locate and read the XML based configuration file
check_auth() - check that this is an authorised access
auth_error() - report an authentication error and suggest remedies
auth_user() - return the registered username for this IP
add_auth() - add a new authentication token to access control system
find_config_location() - try to locate the specified XML config file
conf_get_attr() - get the requested configuration attribute
auth_get_attr() - get the requested access control list attribute
gettoday() - get today's date as a string suitable for the current DB
timecomps() - break a date down into component parts
vendlink() - provide a link to the vendors site
describeher() - tries to make a sensible sentance out of model data
whatshedoes() - describes the kind of sets this model appears in
getvaluename() - takes a single character flag and converts to string
geticonlist() - gets the icon array for the specified object type
addkeyicons() - makes a little HTML table with the attribute icons
gettypecolour() - get the prevailing colour scheme for the set type
divideup() - make a directory name more readable
gettypecolour() - return background to use for this media type
iconlink() - build a link around the icon for this set
alsofeaturing() - find and list any other models featured in this set
checkexclude() - check for this file name being one to ignore/hide
addlinks() - add standard navigation links to top of page

WacsId.pm: The WACS Identification Module

ident_img() - Identify characteristics of an image set from download info
ident_vid() - Identify characteristics of a video clip from download info
reset_attr() - reset the global attribute table
id_get_flag() - get previously determined flag (run ident_* first)
id_get_info() - get previously determined catinfo (run ident_* first)
id_get_photog() - get previously determined photographer (run ident_* first)
id_get_dnldno() - get download record number
id_get_modelno() - get the model number
id_get_modelname() - get the model's name
id_get_vendor() - get the vendor reference
id_get_dbhandle() - get the current DB handle
id_get_key() - get the current models id at the current vendor
id_get_setkey() - get the set key at the current vendor
id_get_setname() - get the name of the most recent set
id_get_status() - get the status of the most recent set
id_get_notes() - get the current value of the notes field
addassoc() - Add a new model/set association
dnld_img() - retrieve a download record based upon the namestem
dnld_markdone() - mark the download as having been done
dnld_checkadd() - take a download specification and if not existing, add it
dnld_update() - update an attribute in the download record
vend_dnld() - return the download location for this vendor
alloc_nextkey() - allocate the next free primary key for named table
find_cookies() - find the current web browser cookies file (firefox only)
vid_getsize() - get the size of a video clip
removedups() - clean up a catinfo string, removing duplicate entries
extractphotog() - find the photographer name (only works on ATK at present)
find_namestem() - find the common stem of a file name
id_mpage() - process a modelpage looking for links to suitable sets
chk_vid_type() - check to see if this url is a video file type

wacs.php: The WACS runtime module for PHP

read_conf() - locate and read the XML based configuration file
check_auth() - check that this is an authorised access
auth_error() - report an authentication error and suggest remedies
auth_user() - return the registered username for this IP
find_config_location() - try to locate the specified XML config file
conf_get_attr() - get the requested configuration attribute
auth_get_attr() - get the requested access control list attribute
gettoday() - get today's date as a string suitable for the current DB
timecomps() - break a date down into component parts

Next Section: Database
Back to WACS Documentation Index