Login   Register  
PHP Classes
elePHPant
Icontem

File: cache-sc-server.php

Recommend this page to a friend!
Stumble It! Stumble It! Bookmark in del.icio.us Bookmark in del.icio.us
  Classes of kumar mcmillan  >  File Info Cache  >  cache-sc-server.php  >  Download  
File: cache-sc-server.php
Role: Example script
Content type: text/plain
Description: example script to cache mp3 files
Class: File Info Cache
Cache information about files to a database
Author: By
Last change:
Date: 2003-09-19 18:34
Size: 1,433 bytes
 

Contents

Class file image Download
#!/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);

?>