43 lines
1.1 KiB
PHP
43 lines
1.1 KiB
PHP
<?php
|
|
declare(strict_types=1);
|
|
|
|
namespace Esun\Video\Model;
|
|
|
|
use Magento\Framework\App\Config\ScopeConfigInterface;
|
|
use Magento\Store\Model\ScopeInterface;
|
|
|
|
class Config
|
|
{
|
|
private const PREFIX = 'esun_video/general/';
|
|
|
|
public function __construct(private readonly ScopeConfigInterface $scopeConfig)
|
|
{
|
|
}
|
|
|
|
public function isEnabled(): bool
|
|
{
|
|
return $this->scopeConfig->isSetFlag(self::PREFIX . 'enabled', ScopeInterface::SCOPE_WEBSITE);
|
|
}
|
|
|
|
public function getMediaPath(): string
|
|
{
|
|
$path = trim((string)$this->scopeConfig->getValue(self::PREFIX . 'media_path'), '/ ');
|
|
return $path !== '' ? $path : 'esun/video';
|
|
}
|
|
|
|
public function getChunkSizeBytes(): int
|
|
{
|
|
return max(1, (int)$this->scopeConfig->getValue(self::PREFIX . 'chunk_size')) * 1024 * 1024;
|
|
}
|
|
|
|
public function getFfprobeBinary(): string
|
|
{
|
|
return trim((string)$this->scopeConfig->getValue(self::PREFIX . 'ffprobe_binary')) ?: 'ffprobe';
|
|
}
|
|
|
|
public function getFfmpegBinary(): string
|
|
{
|
|
return trim((string)$this->scopeConfig->getValue(self::PREFIX . 'ffmpeg_binary')) ?: 'ffmpeg';
|
|
}
|
|
}
|