added support for retrieving progress information via helpers

This commit is contained in:
Robert Gruendler 2012-11-25 15:40:20 +01:00
commit 36b0036285
10 changed files with 463 additions and 7 deletions

View file

@ -24,6 +24,8 @@ use Symfony\Component\Process\ProcessBuilder;
class FFProbe extends Binary
{
protected $cachedFormats = array();
/**
* Probe the format of a given file
*
@ -39,6 +41,10 @@ class FFProbe extends Binary
throw new InvalidArgumentException($pathfile);
}
if (isset($this->cachedFormats[$pathfile])) {
return $this->cachedFormats[$pathfile];
}
$builder = ProcessBuilder::create(array(
$this->binary, $pathfile, '-show_format'
));
@ -69,7 +75,7 @@ class FFProbe extends Binary
$ret[$key] = $value;
}
return json_encode($ret);
return $this->cachedFormats[$pathfile] = json_encode($ret);
}
/**