Files
Pichome/dzz/ffmpeg/classes/info.php

47 lines
1.6 KiB
PHP
Raw Normal View History

2021-12-09 21:00:09 +08:00
<?php
namespace dzz\ffmpeg\classes;
use \core as C;
use \fmpeg as fmpeg;
2022-06-25 14:48:20 +08:00
use \IO as IO;
2021-12-09 21:00:09 +08:00
class info
{
2022-06-25 14:48:20 +08:00
public function run($data)
2021-12-09 21:00:09 +08:00
{
2022-06-25 14:48:20 +08:00
if(strpos($data['realpath'],':') === false){
$bz = 'dzz';
}else{
$patharr = explode(':', $data['realpath']);
$bz = $patharr[0];
$did = $patharr[1];
2021-12-09 21:00:09 +08:00
}
2022-06-25 14:48:20 +08:00
if(!is_numeric($did) || $did < 2){
$bz = 'dzz';
}
if(!$data['ext'] || $bz != 'dzz' || !in_array($data['ext'],explode(',',getglobal('config/pichomeffmpeggetvieoinfoext')))){
return '';
}
$videostatus = DB::result_first('select mediastatus from %t where bz = %s',array('connect_storage',$bz));
if(!$videostatus) return '';
2021-12-09 21:00:09 +08:00
require_once DZZ_ROOT . './dzz/ffmpeg/class/class_fmpeg.php';
try {
if ($info = fmpeg::getInfo($data)) {
if (isset($info['duration'])) C::t('pichome_resources_attr')->update($data['rid'], array('duration' => $info['duration']));
if (isset($info['width'])) C::t('pichome_resources')->update($data['rid'], array('width' => $info['width'], 'height' => $info['height']));
2022-06-25 14:48:20 +08:00
C::t('pichome_resources_attr')->update($data['rid'],array('isget'=>1));
return false;
}else{
C::t('pichome_resources_attr')->update($data['rid'],array('isget'=>-1));
2021-12-09 21:00:09 +08:00
}
} catch (\Exception $e) {
runlog('ffmpeg', $e->getMessage() . 'rid:' . $data['rid']);
2022-06-25 14:48:20 +08:00
C::t('pichome_resources_attr')->update($data['rid'],array('isget'=>-1));
2021-12-09 21:00:09 +08:00
}
}
}