Location: PHPKode > projects > mediaIndex > mediaIndexer.php
<?php
/**
  * $Id: mediaIndexer.php,v 1.82 2004/12/02 04:34:37 openface Exp $      
  *
  *               _ _        _         _                 
  *  _ __  ___ __| (_)__ _  (_)_ _  __| |_____ _____ _ _ 
  * | '  \/ -_) _` | / _` | | | ' \/ _` / -_) \ / -_) '_|
  * |_|_|_\___\__,_|_\__,_| |_|_||_\__,_\___/_\_\___|_|  
  *                                                     
  *     Standalone Indexer Script for Media Files
  *        jason hines, <hide@address.com>
  *
  * This library is free software; you can redistribute it and/or modify
  * it under the terms of the GNU Library General Public License as
  * published by the Free Software Foundation; either version 2 of the
  * License, or (at your option) any later version.
  *
  * This library is distributed in the hope that it will be useful, but
  * WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library
  * General Public License for more details.
  */

/**
 * Common configuration
 */

// absolute path to mediaIndexer install
define("_BASEPATH","/path/to/mediaIndexer");

// web url to mediaIndexer install
define("_BASEURL","http://domain.com");

// absolute path to media files
define("_MEDIAPATH","/path/to/media/files");

// web url to media files
define("_MEDIAURL","http://domain.com/files");

// site logo
define("_SITELOGO","img/logo.gif");

// site name
define("_SITENAME","mediaIndexer Demo Site");

// allow user comments?
define("_ENABLECOMMENTS",TRUE);

// allow directory downloading
define("_ENABLEZIPDIR",TRUE);

// number of items to display per row
define("_NUMCOLUMNS",2);

// date format for timestamps
define("_DATEFORMAT","M j Y, g:ia");

// Possible sorting methods
define("NAME_ASC",1);   // name ascending
define("NAME_DESC",2);  // name descending
define("CTIME_ASC",3);  // creation time ascending
define("CTIME_DESC",4); // creation time descending
define("MTIME_ASC",5);  // modified time ascending
define("MTIME_DESC",6); // modified time descending

// file sorting method 
// can be: NAME_ASC,NAME_DESC,CTIME_ASC,CTIME_DESC,MTIME_ASC,MTIME_DESC
define("_SORTMETHOD",CTIME_DESC);

// enable directory summaries (X files, X dirs)
// setting this false can improve performance if you have 
// very large directories
define("_DIRSUMMARIES",TRUE);

// absolute path to mdx images directory
define("_ICONSURL",_BASEURL."/img");

// absolute path to cache directory (must be writable)
define("_CACHEPATH",_BASEPATH."/var");

// web url to cache directory
define("_CACHEURL",_BASEURL."/var");

// absolute path to database file (must be writable)
define("_DATAFILE",_CACHEPATH."/metadata.sqlite");

// absolute path to ImageMagick convert binary
define("_CONVERT","/usr/bin/convert");
   
// desired size of thumbnails
define("_THUMBSIZE","80x80");

/**
 * Wildcard Exclusions
 *
 * Assemble an array with the following structure:
 * $_EXCLUDES = array("PATTERN1*","*PATTERN2*","*PATTERN3");
 */

$_EXCLUDES = array(
    'mediaIndexer',
    'CVS',
    '.*',
    'HEADER.html',
    'FOOTER.html',
    'README.html',
    'index.php',
    'var',
);

/**
 * Media group <> class name definition
 */

define("_GROUP_DEFAULT",     "default");   // required
define("_GROUP_DOWNLOADS",   "downloads");
define("_GROUP_TEXTFILES",   "textfiles");
define("_GROUP_IMAGES",      "images");
define("_GROUP_MUSIC",       "music");
define("_GROUP_MOVIES",      "movies");
define("_GROUP_DOCUMENTS",   "documents");

/**
 * Media file handler <> class name definition
 */

define("_HANDLER_DEFAULT",   "default");  // required
define("_HANDLER_ARCHIVE",   "archive");
define("_HANDLER_CODE",      "code");
define("_HANDLER_TEXT",      "text");
define("_HANDLER_GZFILE",    "gzfile");
define("_HANDLER_IMAGE",     "image");
define("_HANDLER_AUDIO",     "audio");
define("_HANDLER_WINMEDIA",  "winmedia");
define("_HANDLER_QUICKTIME", "quicktime");
define("_HANDLER_REALPLAYER","realplayer");
define("_HANDLER_FLASH",     "flash");
define("_HANDLER_PDF",       "pdf");
define("_HANDLER_POSTSCRIPT","postscript");
define("_HANDLER_WORD",      "word");

/**
 * File patterns <> File handler associations
 *
 * Order is important here.
 * Assemble an array with the following structure:
 *
 * $_PATTERNS['*.extension'] = HANDLER_DEF;
 */
$_PATTERNS['*.txt']   = _HANDLER_TEXT;
$_PATTERNS['*.nfo']   = _HANDLER_TEXT;

$_PATTERNS['*.gz']    = _HANDLER_GZFILE;

$_PATTERNS['*.tgz']   = _HANDLER_ARCHIVE;
$_PATTERNS['*.zip']   = _HANDLER_ARCHIVE;
$_PATTERNS['*.rpm']   = _HANDLER_ARCHIVE;
$_PATTERNS['*.tar.gz']= _HANDLER_ARCHIVE;
$_PATTERNS['*.rar']   = _HANDLER_ARCHIVE;
$_PATTERNS['*.iso']   = _HANDLER_ARCHIVE;
$_PATTERNS['*.exe']   = _HANDLER_ARCHIVE;


$_PATTERNS['*.mp3']   = _HANDLER_AUDIO;
$_PATTERNS['*.ogg']   = _HANDLER_AUDIO;
$_PATTERNS['*.m4a']   = _HANDLER_AUDIO;
$_PATTERNS['*.pac']   = _HANDLER_AUDIO;
$_PATTERNS['*.shn']   = _HANDLER_AUDIO;
$_PATTERNS['*.fla']   = _HANDLER_AUDIO;
$_PATTERNS['*.flac']  = _HANDLER_AUDIO;
$_PATTERNS['*.wav']   = _HANDLER_AUDIO;
$_PATTERNS['*.wma']   = _HANDLER_AUDIO;
$_PATTERNS['*.mid']   = _HANDLER_AUDIO;
$_PATTERNS['*.ra']    = _HANDLER_AUDIO;

$_PATTERNS['*.png']   = _HANDLER_IMAGE;
$_PATTERNS['*.gif']   = _HANDLER_IMAGE;
$_PATTERNS['*.jpg']   = _HANDLER_IMAGE;
$_PATTERNS['*.jpeg']  = _HANDLER_IMAGE;
$_PATTERNS['*.bmp']   = _HANDLER_IMAGE;

$_PATTERNS['*.php']   = _HANDLER_CODE;
$_PATTERNS['*.html']  = _HANDLER_CODE;
$_PATTERNS['*.sh']    = _HANDLER_CODE;
$_PATTERNS['*.c']     = _HANDLER_CODE;

$_PATTERNS['*.wmv']   = _HANDLER_WINMEDIA;
$_PATTERNS['*.avi']   = _HANDLER_WINMEDIA;
$_PATTERNS['*.asf']   = _HANDLER_WINMEDIA;
$_PATTERNS['*.mov']   = _HANDLER_QUICKTIME;
$_PATTERNS['*.mpg']   = _HANDLER_QUICKTIME;
$_PATTERNS['*.mpeg']  = _HANDLER_QUICKTIME;
$_PATTERNS['*.rm']    = _HANDLER_REALPLAYER;

$_PATTERNS['*.swf']   = _HANDLER_FLASH;

$_PATTERNS['*.pdf']   = _HANDLER_PDF;

$_PATTERNS['*.ps']   = _HANDLER_POSTSCRIPT;

$_PATTERNS['*.doc']   = _HANDLER_WORD;

/**
 * Media file handler <> Group associations
 * 
 * Assemble an array with the following structure:
 * $_MAPPINGS[HANDLER] = GROUP;
 */

$_MAPPING[_HANDLER_DEFAULT]   = _GROUP_DEFAULT;    // required
$_MAPPING[_HANDLER_ARCHIVE]   = _GROUP_DOWNLOADS;
$_MAPPING[_HANDLER_CODE]      = _GROUP_TEXTFILES;
$_MAPPING[_HANDLER_TEXT]      = _GROUP_TEXTFILES;
$_MAPPING[_HANDLER_GZFILE]    = _GROUP_TEXTFILES;
$_MAPPING[_HANDLER_IMAGE]     = _GROUP_IMAGES;
$_MAPPING[_HANDLER_AUDIO]     = _GROUP_MUSIC;
$_MAPPING[_HANDLER_WINMEDIA]  = _GROUP_MOVIES;
$_MAPPING[_HANDLER_QUICKTIME] = _GROUP_MOVIES;
$_MAPPING[_HANDLER_REALPLAYER]= _GROUP_MOVIES;
$_MAPPING[_HANDLER_FLASH]     = _GROUP_MOVIES;
$_MAPPING[_HANDLER_PDF]       = _GROUP_DOCUMENTS;
$_MAPPING[_HANDLER_POSTSCRIPT]= _GROUP_DOCUMENTS;
$_MAPPING[_HANDLER_WORD]      = _GROUP_DOCUMENTS;

/**
 * Users configuration
 *
 * Assemble an array $_USERS with the following structure
 * $_USERS["user_group"][] = array("username","password");
 */

// administrators
$_USERS["admin"][] = array("admin","testpw");

/**
 * Include initialization file
 */

// include initialization / functions file
include_once(_BASEPATH . "/includes/init.php");

?>
Return current item: mediaIndex