add more config to repair step
Signed-off-by: Varun Patil <varunpatil@ucla.edu>pull/563/head
parent
8cdfe0a97e
commit
312039deab
|
@ -35,18 +35,18 @@ class BinExt
|
|||
}
|
||||
|
||||
/** Detect the exiftool binary to use */
|
||||
public static function detectExiftool(): void
|
||||
public static function detectExiftool()
|
||||
{
|
||||
if (!empty($path = Util::getSystemConfig('memories.exiftool'))) {
|
||||
if (file_exists($path) && !is_executable($path)) {
|
||||
chmod($path, 0755);
|
||||
@chmod($path, 0755);
|
||||
}
|
||||
|
||||
return;
|
||||
return $path;
|
||||
}
|
||||
|
||||
if (Util::getSystemConfig('memories.exiftool_no_local')) {
|
||||
return;
|
||||
return implode(' ', self::getExiftool());
|
||||
}
|
||||
|
||||
// Detect architecture
|
||||
|
@ -64,12 +64,72 @@ class BinExt
|
|||
// make sure it is executable
|
||||
if (file_exists($path)) {
|
||||
if (!is_executable($path)) {
|
||||
chmod($path, 0755);
|
||||
@chmod($path, 0755);
|
||||
}
|
||||
} else {
|
||||
error_log("Exiftool binary not found: {$path}");
|
||||
Util::setSystemConfig('memories.exiftool_no_local', true);
|
||||
|
||||
return $path;
|
||||
}
|
||||
}
|
||||
|
||||
Util::setSystemConfig('memories.exiftool_no_local', true);
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/** Detect the go-vod binary to use */
|
||||
public static function detectGoVod()
|
||||
{
|
||||
$goVodPath = Util::getSystemConfig('memories.vod.path');
|
||||
|
||||
if (empty($goVodPath) || !file_exists($goVodPath)) {
|
||||
// Detect architecture
|
||||
$arch = \OCA\Memories\Util::getArch();
|
||||
$path = __DIR__."/../exiftool-bin/go-vod-{$arch}";
|
||||
$goVodPath = realpath($path);
|
||||
|
||||
if (!$goVodPath) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// Set config
|
||||
Util::setSystemConfig('memories.vod.path', $goVodPath);
|
||||
|
||||
// Make executable
|
||||
if (!is_executable($goVodPath)) {
|
||||
@chmod($goVodPath, 0755);
|
||||
}
|
||||
}
|
||||
|
||||
return $goVodPath;
|
||||
}
|
||||
|
||||
public static function detectFFmpeg()
|
||||
{
|
||||
$ffmpegPath = Util::getSystemConfig('memories.vod.ffmpeg');
|
||||
$ffprobePath = Util::getSystemConfig('memories.vod.ffprobe');
|
||||
|
||||
if (empty($ffmpegPath) || !file_exists($ffmpegPath) || empty($ffprobePath) || !file_exists($ffprobePath)) {
|
||||
// Use PATH
|
||||
$ffmpegPath = shell_exec('which ffmpeg');
|
||||
$ffprobePath = shell_exec('which ffprobe');
|
||||
if (!$ffmpegPath || !$ffprobePath) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// Trim
|
||||
$ffmpegPath = trim($ffmpegPath);
|
||||
$ffprobePath = trim($ffprobePath);
|
||||
|
||||
// Set config
|
||||
Util::setSystemConfig('memories.vod.ffmpeg', $ffmpegPath);
|
||||
Util::setSystemConfig('memories.vod.ffprobe', $ffprobePath);
|
||||
}
|
||||
|
||||
// Check if executable
|
||||
if (!is_executable($ffmpegPath) || !is_executable($ffprobePath)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return $ffmpegPath;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -24,11 +24,28 @@ class Repair implements IRepairStep
|
|||
|
||||
public function run(IOutput $output): void
|
||||
{
|
||||
// detect exiftool binary
|
||||
\OCA\Memories\BinExt::detectExiftool();
|
||||
|
||||
// kill any instances of go-transcode and go-vod
|
||||
\OCA\Memories\Util::pkill('go-transcode');
|
||||
// kill any instances of go-vod
|
||||
\OCA\Memories\Util::pkill('go-vod');
|
||||
|
||||
// detect exiftool
|
||||
if ($path = \OCA\Memories\BinExt::detectExiftool()) {
|
||||
$output->info("exiftool binary is configured: {$path}");
|
||||
} else {
|
||||
$output->warning('exiftool binary could not be configured');
|
||||
}
|
||||
|
||||
// detect go-vod
|
||||
if ($path = \OCA\Memories\BinExt::detectGoVod()) {
|
||||
$output->info("go-vod binary is configured: {$path}");
|
||||
} else {
|
||||
$output->warning('go-vod binary could not be configured');
|
||||
}
|
||||
|
||||
// detect ffmpeg
|
||||
if ($path = \OCA\Memories\BinExt::detectFFmpeg()) {
|
||||
$output->info("ffmpeg binary is configured: {$path}");
|
||||
} else {
|
||||
$output->warning('ffmpeg binary could not be configured');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -308,7 +308,7 @@ class Util
|
|||
// Check if the key is valid
|
||||
$defaults = self::systemConfigDefaults();
|
||||
if (!\array_key_exists($key, $defaults)) {
|
||||
throw new \InvalidArgumentException('Invalid system config key');
|
||||
throw new \InvalidArgumentException("Invalid system config key: {$key}");
|
||||
}
|
||||
|
||||
// Check if the value has the correct type
|
||||
|
|
|
@ -398,7 +398,7 @@ export default defineComponent({
|
|||
},
|
||||
|
||||
async update(key: string, value = null) {
|
||||
value ||= this[key];
|
||||
value = value ?? this[key];
|
||||
const setting = settings[key];
|
||||
|
||||
// Inversion
|
||||
|
|
|
@ -94,7 +94,7 @@ import LinkIcon from "vue-material-design-icons/LinkVariant.vue";
|
|||
import FileIcon from "vue-material-design-icons/File.vue";
|
||||
|
||||
// Is video transcoding enabled?
|
||||
const config_vodDisable = loadState("memories", "vod_disable");
|
||||
const config_vodDisable = loadState("memories", "vod_disable", true);
|
||||
|
||||
export default defineComponent({
|
||||
name: "ShareModal",
|
||||
|
|
|
@ -23,7 +23,7 @@ type PsVideoEvent = PsEvent & {
|
|||
content: VideoContent;
|
||||
};
|
||||
|
||||
const config_vodDisable = loadState("memories", "vod_disable");
|
||||
const config_vodDisable = loadState("memories", "vod_disable", true);
|
||||
|
||||
const config_video_default_quality = Number(
|
||||
loadState("memories", "video_default_quality", <string>"0") as string
|
||||
|
|
Loading…
Reference in New Issue