pathFromHash($hash))) mkdir($dirId); Shell::bash(__DIR__ . "/../shell/processVideo.sh", OPENVK_ROOT, $filename, $hash)->start(); #async :DDD } catch(ShellUnavailableException $suex) { exit(OPENVK_ROOT_CONF["openvk"]["debug"] ? "Shell is unavailable" : VIDEOS_FRIENDLY_ERROR); } catch(UnknownCommandException $ucex) { exit(OPENVK_ROOT_CONF["openvk"]["debug"] ? "bash is not installed" : VIDEOS_FRIENDLY_ERROR); } usleep(200100); return true; } function getName(): string { return $this->getRecord()->name; } function getType(): int { if(!is_null($this->getRecord()->hash)) return Video::TYPE_DIRECT; else if(!is_null($this->getRecord()->link)) return Video::TYPE_EMBED; } function getVideoDriver(): ?VideoDriver { if($this->getType() !== Video::TYPE_EMBED) return NULL; [$videoDriver, $pointer] = explode(":", $this->getRecord()->link); $videoDriver = "openvk\\Web\\Models\\VideoDrivers\\$videoDriver" . "VideoDriver"; if(!class_exists($videoDriver)) return NULL; return new $videoDriver($pointer); } function getThumbnailURL(): string { if($this->getType() === Video::TYPE_DIRECT) { return preg_replace("%\.[A-z]++$%", ".gif", $this->getURL()); } else { return $this->getVideoDriver()->getThumbnailURL(); } } function setLink(string $link): string { if(preg_match(file_get_contents(__DIR__ . "/../VideoDrivers/regex/youtube.txt"), $link, $matches)) { $pointer = "YouTube:$matches[1]"; } else if(preg_match(file_get_contents(__DIR__ . "/../VideoDrivers/regex/vimeo.txt"), $link, $matches)) { $pointer = "Vimeo:$matches[1]"; } else { throw new ISE("Invalid link"); } $this->stateChanges("link", $pointer); return $pointer; } }