video: add support for go-vod run

Signed-off-by: Varun Patil <radialapps@gmail.com>
pull/888/head
Varun Patil 2023-10-20 14:28:08 -07:00
parent b5e324b394
commit c9317e9e37
4 changed files with 38 additions and 2 deletions

View File

@ -29,6 +29,7 @@ use OCA\Memories\Util;
use OCP\AppFramework\Http;
use OCP\AppFramework\Http\JSONResponse;
use OCP\AppFramework\Http\StreamResponse;
use OCP\IRequest;
class OtherController extends GenericApiController
{
@ -169,8 +170,20 @@ class OtherController extends GenericApiController
break;
case 'go-vod':
switch (\OC::$server->get(IRequest::class)->getParam('arch')) {
case 'x86_64':
case 'amd64':
return new StreamResponse(__DIR__.'/../../bin-ext/go-vod-amd64');
case 'aarch64':
case 'arm64':
return new StreamResponse(__DIR__.'/../../bin-ext/go-vod-aarch64');
}
// no break
default:
throw new \Exception('Unknown static file');
throw Exceptions::NotFound("File not found: {$name}");
}
/** @var Http\Response $response */

View File

@ -261,11 +261,15 @@ class VideoController extends GenericApiController
$url .= "?{$params}";
}
// Initialize request
$ch = curl_init($url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_1_1);
curl_setopt($ch, CURLOPT_HEADER, 0);
// Add header for expected go-vod version
curl_setopt($ch, CURLOPT_HTTPHEADER, ['X-Go-Vod-Version: '.BinExt::GOVOD_VER]);
// Catch connection abort here
ignore_user_abort(true);

View File

@ -9,7 +9,7 @@ use OCA\Memories\Util;
class BinExt
{
public const EXIFTOOL_VER = '12.60';
public const GOVOD_VER = '0.1.16';
public const GOVOD_VER = '0.1.18';
public const NX_VER_MIN = '1.1';
/** Get the path to the temp directory */

View File

@ -9,9 +9,20 @@ binExtVar() {
php -r "require '$SCRIPT_PATH/../lib/Service/BinExt.php'; echo \OCA\Memories\Service\BinExt::$1;"
}
arch() {
ARCH=$(uname -m)
if [ "$ARCH" = "x86_64" ]; then
ARCH="amd64"
elif [ "$ARCH" = "arm64" ]; then
ARCH="aarch64"
fi
echo $ARCH
}
EXIFTOOL_VER=$(binExtVar EXIFTOOL_VER)
GOVOD_VER=$(binExtVar GOVOD_VER)
# Get exiftool prebuilt binaries
rm -rf bin-ext
mkdir -p bin-ext
cd bin-ext
@ -22,15 +33,23 @@ wget -q "https://github.com/pulsejet/exiftool-bin/releases/download/$EXIFTOOL_VE
wget -q "https://github.com/pulsejet/exiftool-bin/releases/download/$EXIFTOOL_VER/exiftool-aarch64-glibc"
chmod 755 *
# Get exiftool source
wget -q "https://github.com/exiftool/exiftool/archive/refs/tags/$EXIFTOOL_VER.zip"
unzip -qq "$EXIFTOOL_VER.zip"
mv "exiftool-$EXIFTOOL_VER" exiftool
rm -rf *.zip exiftool/t exiftool/html exiftool/windows_exiftool
chmod 755 exiftool/exiftool
# Get go-vod prebuilt binaries
echo "Getting go-vod $GOVOD_VER"
wget -q "https://github.com/pulsejet/go-vod/releases/download/$GOVOD_VER/go-vod-amd64"
wget -q "https://github.com/pulsejet/go-vod/releases/download/$GOVOD_VER/go-vod-aarch64"
chmod 755 go-vod-*
# Check the version of go-vod is correct internally
if [ "$(./go-vod-$(arch) -version)" != "go-vod $GOVOD_VER" ]; then
echo "[BUG] go-vod binary version mismatch"
exit 1
fi
cd ..