PHP Classes

File: cache-sc-server.php

Recommend this page to a friend!
  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: 20 years ago
Size: 1,433 bytes


Class file image Download
#!/usr/local/php/bin/php -q

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:
require_once 'adodb/';
// get AudioFile:
require_once 'audiofile/classAudioFile.php';

$DBobj = ADONewConnection('mysql');
$DBobj->debug = false;

$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