mirror of
https://github.com/alchemy-fr/Phraseanet.git
synced 2025-10-15 05:53:13 +00:00
V 3.5 RC 1
This commit is contained in:
34
lib/classes/binaryAdapter/audio/previewExtract.class.php
Normal file
34
lib/classes/binaryAdapter/audio/previewExtract.class.php
Normal file
@@ -0,0 +1,34 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of Phraseanet
|
||||
*
|
||||
* (c) 2005-2010 Alchemy
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
/**
|
||||
*
|
||||
* @package binaryAdapter
|
||||
* @license http://opensource.org/licenses/gpl-3.0 GPLv3
|
||||
* @link www.phraseanet.com
|
||||
*/
|
||||
class binaryAdapter_audio_previewExtract extends binaryAdapter_adapterAbstract
|
||||
{
|
||||
|
||||
/**
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $processors = array(
|
||||
'binaryAdapter_audio_previewExtract_exiftool'
|
||||
);
|
||||
|
||||
public function get_name()
|
||||
{
|
||||
return 'Binary adapter audio image-preview extract';
|
||||
}
|
||||
|
||||
}
|
@@ -0,0 +1,80 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of Phraseanet
|
||||
*
|
||||
* (c) 2005-2010 Alchemy
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
/**
|
||||
* Exiftool preview extractor from raw images processor
|
||||
* for binaryAdapter package
|
||||
*
|
||||
* @package binaryAdapter
|
||||
* @license http://opensource.org/licenses/gpl-3.0 GPLv3
|
||||
* @link www.phraseanet.com
|
||||
*/
|
||||
class binaryAdapter_audio_previewExtract_exiftool extends binaryAdapter_processorAbstract
|
||||
{
|
||||
|
||||
/**
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $options = array();
|
||||
/**
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $binary_name = 'GV_exiftool';
|
||||
|
||||
/**
|
||||
*
|
||||
* @param system_file $raw_datas
|
||||
* @param string $dest
|
||||
* @return system_file
|
||||
*/
|
||||
protected function process(system_file $raw_datas, $dest)
|
||||
{
|
||||
$cmd = sprintf('%s -s -t %s'
|
||||
, $this->binary
|
||||
, $this->escapeshellargs($raw_datas->getPathname())
|
||||
);
|
||||
|
||||
$out = $this->shell_cmd($cmd);
|
||||
|
||||
if (!$out)
|
||||
throw new Exception('Unable to extract preview datas from audio');
|
||||
|
||||
foreach ($out as $outP)
|
||||
{
|
||||
$infos = explode("\t", $outP);
|
||||
|
||||
if (count($infos) != 2 || $infos[0] != 'Picture')
|
||||
continue;
|
||||
|
||||
$this->log("Some preview datas found in audio file");
|
||||
|
||||
$cmd = sprintf('%s -b -Picture %s > %s'
|
||||
, $this->binary
|
||||
, $this->escapeshellargs($raw_datas->getPathname())
|
||||
, $this->escapeshellargs($dest)
|
||||
);
|
||||
|
||||
$this->shell_cmd($cmd);
|
||||
|
||||
if (filesize($dest) > 0)
|
||||
{
|
||||
return $this;
|
||||
}
|
||||
else
|
||||
{
|
||||
unlink($dest);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
34
lib/classes/binaryAdapter/audio/resample.class.php
Normal file
34
lib/classes/binaryAdapter/audio/resample.class.php
Normal file
@@ -0,0 +1,34 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of Phraseanet
|
||||
*
|
||||
* (c) 2005-2010 Alchemy
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
/**
|
||||
*
|
||||
* @package binaryAdapter
|
||||
* @license http://opensource.org/licenses/gpl-3.0 GPLv3
|
||||
* @link www.phraseanet.com
|
||||
*/
|
||||
class binaryAdapter_audio_resample extends binaryAdapter_adapterAbstract
|
||||
{
|
||||
|
||||
/**
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $processors = array(
|
||||
'binaryAdapter_audio_resample_ffmpeg'
|
||||
);
|
||||
|
||||
public function get_name()
|
||||
{
|
||||
return 'Binary adapter audio resampler';
|
||||
}
|
||||
|
||||
}
|
51
lib/classes/binaryAdapter/audio/resample/ffmpeg.class.php
Normal file
51
lib/classes/binaryAdapter/audio/resample/ffmpeg.class.php
Normal file
@@ -0,0 +1,51 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of Phraseanet
|
||||
*
|
||||
* (c) 2005-2010 Alchemy
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
/**
|
||||
*
|
||||
* @package binaryAdapter
|
||||
* @license http://opensource.org/licenses/gpl-3.0 GPLv3
|
||||
* @link www.phraseanet.com
|
||||
*/
|
||||
class binaryAdapter_audio_resample_ffmpeg extends binaryAdapter_processorAbstract
|
||||
{
|
||||
|
||||
/**
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $options = array();
|
||||
/**
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $binary_name = 'GV_ffmpeg';
|
||||
|
||||
/**
|
||||
*
|
||||
* @param system_file $origine
|
||||
* @param string $dest
|
||||
* @return binaryAdapter_audio_resample_ffmpeg
|
||||
*/
|
||||
protected function process(system_file $origine, $dest)
|
||||
{
|
||||
$cmd = sprintf('%s -y -i %s %s'
|
||||
, $this->binary
|
||||
, $this->escapeshellargs($origine->getPathname())
|
||||
, $this->escapeshellargs($dest)
|
||||
);
|
||||
|
||||
$this->shell_cmd($cmd);
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
}
|
Reference in New Issue
Block a user