changeset 939:dc3ac7470ec0

Moar work.
author Matti Hamalainen <ccr@tnsp.org>
date Fri, 28 Nov 2014 00:43:40 +0200
parents 7accae8e896c
children 2acb03b775fe
files faptool.php
diffstat 1 files changed, 15 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/faptool.php	Fri Nov 28 00:23:55 2014 +0200
+++ b/faptool.php	Fri Nov 28 00:43:40 2014 +0200
@@ -121,15 +121,19 @@
 }
 
 
-function wtConvertSample($inFilename, $outFilename, $opts)
+function wtConvertSample($inFilename, $outFilename, $type)
 {
   $sfreq     = intval(stGetSetting("sampleFreq"));
   $sduration = intval(stGetSetting("sampleDuration"));
   $schannels = intval(stGetSetting("sampleChannels"));
 
-  foreach ($opts as $okey => $oval)
+  $stypes = stGetSetting("sampleTypes");
+  if (!isset($stypes[$type]))
+    die("ERROR: Specified sample type '".$type."' not defined in sampleTypes in mconfig.inc.php\n");
+
+  foreach ($stypes[$type] as $okey => $oval)
     $optStr .= $okey." ".$oval." ";
-  
+
   return wtExec(
     "/usr/local/bin/avconv",
     "-y -t ".intval($sduration)." ".
@@ -143,7 +147,10 @@
 function wtPurgeDir($path)
 {
   if (file_exists($path))
-    wtExecOrDie("/bin/echo", "-fR ".escapeshellarg($path));
+  {
+    echo "PURGING: ".$path."\n";
+    //wtExecOrDie("/bin/echo", "-fR ".escapeshellarg($path));
+  }
 }
 
 
@@ -200,14 +207,16 @@
     return FALSE;
 
   // Scan through files ...
+  $res = FALSE;
   $dir = opendir($path);
   while (($dentry = readdir($dir)) !== false)
   {
+    $fname = $path."/".$dentry;
   }
   closedir($dir);
 
   wtPurgeDir($path);
-  return TRUE;
+  return $res;
 }
 
 
@@ -305,7 +314,7 @@
       wtScanArchive(
         $efile,
         stMakePath(FALSE, TRUE, array($setEntryPath, $compo["cpath"], $efile["filename"]),
-        "wtCheckOneArchiveFile", $compo["preview_type"]);
+        "wtHandleSingleEntryPreviewDispatch", array($compo, $entry, $pdata));
 
       unpack to tempdir
       if compo preview type is image, scan archive for images ..