Example #1
0
#!/usr/bin/php -q
<?php 
// 20151014
// Auto GSM to MP3 Converter
// Uses Cron, Samba and Sox
//
// runs every 2 minutes via cron
// */2 * * * * /root/auto_convert/convert.php >/dev/null 2>&1
require 'classes.php';
$fs = new classFileSystem();
$cwd = '/shared/public/converter';
// Rebuild the directory structure if somebody deleted them
$fs->rebuildDirectory($cwd);
echo "Processing folder {$cwd}\n";
// Get all GSM files
$gsmList = $fs->getFileList("{$cwd}/*.gsm");
// Convert
if (count($gsmList) > 0) {
    for ($i = 0; $i < count($gsmList); $i++) {
        $fs->gsm2mp3($gsmList[$i]);
    }
}
Example #2
0
#!/usr/bin/php -q
<?php 
// 20151014
// Auto Scrubber
// Uses Samba and xlsx2csv
//
// runs every 2 minutes via cron
// */2 * * * * /root/auto_scrub/scrub.php >/dev/null 2>&1
require 'db.php';
require 'classes.php';
$dnc = new classDnc($DBH);
$fs = new classFileSystem();
$ipAddress = array('10.0.0.1', '10.0.0.2', '10.0.0.3');
$cwd = array('/shared/public/scrubber', '/shared/iconcept/scrubber', '/shared/qub/scrubber');
// Remove all the previous uploaded list first
for ($n = 0; $n < count($ipAddress); $n++) {
    $dnc->deleteLeads($ipAddress[$n]);
}
for ($n = 0; $n < count($ipAddress); $n++) {
    // Rebuild the directory structure if somebody deleted them
    $fs->rebuildDirectory($cwd[$n]);
    echo "Processing folder {$cwd[$n]}\n";
    // convert xlsx files to csv if needed
    $xlsxList = $fs->getFileList("{$cwd[$n]}/*.xlsx");
    if (count($xlsxList) > 0) {
        for ($i = 0; $i < count($xlsxList); $i++) {
            $fs->xlsx2csv($xlsxList[$i]);
        }
    }
    $csvList = $fs->getFileList("{$cwd[$n]}/*.csv");
    if (count($csvList) <= 0) {