#!/usr/local/php/bin/php -q
 
<?php
 
 
/*********************
 
example file for FileInfoCache
 
 
chmod u+x this-file.php
 
run it like ./this-file.php from a shell or crontab
 
(you may need to specify the path to your php binary)
 
This script was used to cache mp3 file info so that a weighted playlist could be generated for a Shoutcast server.
 
*********************/
 
 
// get ADODB: http://php.weblogs.com/ADODB
 
require_once 'adodb/adodb.inc.php';
 
// get AudioFile: http://www.phpclasses.org/browse.html/package/482.html
 
require_once 'audiofile/classAudioFile.php';
 
require_once 'file-info-cache.class.php';
 
 
$DBobj = ADONewConnection('mysql');
 
$DBobj->debug = false;
 
$DBobj->Connect('localhost','username','password','file_cache');
 
 
$FileInfoCache = new FileInfoCache($DBobj);
 
$FileInfoCache->CacheAllFiles = false; // if false, all files must be registered with optional handler
 
$FileInfoCache->OverwritePreviousCache = true; // overwrites any previous cache associated with $RootDir
 
$FileInfoCache->SetAudioFileObj($AudioFileObj = new AudioFile); // required to cache mp3 files
 
// $FileInfoCache->RegisterFile('JPEG'); // example of registering a file
 
// $FileInfoCache->RegisterFile('JPG'); // example of registering a file
 
$FileInfoCache->RegisterFile('MP3','CacheFileMpegAudio'); // registering with additional handler
 
$FileInfoCache->Cache('/absolute/path/to/root/directory',FC_CACHE_AT_LOW_PRIORITY);
 
 
?>
 
 |