This commit is contained in:
shimon
2023-04-10 16:41:23 +03:00
parent 14575a7e40
commit db4506b0fe
3 changed files with 37 additions and 10 deletions
+14 -8
View File
@@ -186,7 +186,8 @@ class VideosV1 extends Worker
$this->getVideoDevice($this->project->getId())->write(
$path . $name,
(new Local('/'))->read($this->outDir . $name)
(new Local('/'))->read($this->outDir . $name),
mime_content_type($this->outDir . $name)
);
$preview = $this->database->findOne('videos_previews', [
@@ -309,7 +310,8 @@ class VideosV1 extends Worker
*/
$this->getVideoDevice($this->project->getId())->write(
$this->getVideoDevice($this->project->getId())->getPath($this->video->getId() . '/timeline/timeline.vtt'),
$data
$data,
'text/vtt'
);
console::info('Uploading timeline vtt');
@@ -323,7 +325,8 @@ class VideosV1 extends Worker
console::info('Uploading ' . $fileinfo->getFilename());
$this->getVideoDevice($this->project->getId())->write(
$path . $fileinfo->getFilename(),
(new Local('/'))->read($this->outDir . $fileinfo->getFilename())
(new Local('/'))->read($this->outDir . $fileinfo->getFilename()),
mime_content_type($this->outDir . $fileinfo->getFilename())
);
}
}
@@ -336,7 +339,7 @@ class VideosV1 extends Worker
$subs = [];
$subtitles = $this->database->find('videos_subtitles', [
Query::equal('videoId', [$this->video->getId()]),
Query::equal('status', '')
Query::equal('status', [''])
]);
foreach ($subtitles as $subtitle) {
@@ -484,15 +487,19 @@ class VideosV1 extends Worker
$dir = new DirectoryIterator($this->outDir);
foreach ($dir as $fileinfo) {
if (!$fileinfo->isDot()) {
console::info('Uploading ' . $fileinfo->getFilename());
$data = (new Local('/'))->read($this->outDir . $fileinfo->getFilename());
$to = $renditionPath;
if (str_contains($fileinfo->getFilename(), "_subtitles_") || str_contains($fileinfo->getFilename(), ".vtt")) {
$to = $renditionRootPath . 'subtitles/';
}
$this->getVideoDevice($this->project->getId())->write($to . $fileinfo->getFilename(), $data);
console::info('Uploading ' . $fileinfo->getFilename());
$this->getVideoDevice($this->project->getId())->write(
$to . $fileinfo->getFilename(),
$data,
mime_content_type($this->outDir . $fileinfo->getFilename())
);
if ($fileinfo->key() === 0) {
$query->setAttribute('progress', '100');
@@ -500,7 +507,6 @@ class VideosV1 extends Worker
$query->setAttribute('path', $renditionPath);
$this->database->updateDocument('videos_renditions', $query->getId(), $query);
$this->send($query, 'update');
console::info('Uploading to ' . $to);
}
}
}
+2 -2
View File
@@ -41,6 +41,7 @@
"ext-openssl": "*",
"ext-zlib": "*",
"ext-sockets": "*",
"ext-fileinfo": "*",
"appwrite/php-clamav": "1.1.*",
"appwrite/php-runtimes": "0.11.*",
"utopia-php/abuse": "0.18.*",
@@ -74,7 +75,7 @@
"captioning/captioning": "2.*",
"ext-simplexml": "*",
"webonyx/graphql-php": "14.11.*",
"mhor/php-mediainfo": "5.4.3"
"mhor/php-mediainfo": "5.4.3",
},
"repositories": [
{
@@ -88,7 +89,6 @@
],
"require-dev": {
"appwrite/sdk-generator": "dev-shimon-video-test",
"ext-fileinfo": "*",
"phpunit/phpunit": "9.5.20",
"squizlabs/php_codesniffer": "^3.6",
"swoole/ide-helper": "4.8.9",
+21
View File
@@ -255,6 +255,27 @@ services:
environment:
- _APP_ENV
- _APP_OPENSSL_KEY_V1
- _APP_STORAGE_DEVICE
- _APP_STORAGE_S3_ACCESS_KEY
- _APP_STORAGE_S3_SECRET
- _APP_STORAGE_S3_REGION
- _APP_STORAGE_S3_BUCKET
- _APP_STORAGE_DO_SPACES_ACCESS_KEY
- _APP_STORAGE_DO_SPACES_SECRET
- _APP_STORAGE_DO_SPACES_REGION
- _APP_STORAGE_DO_SPACES_BUCKET
- _APP_STORAGE_BACKBLAZE_ACCESS_KEY
- _APP_STORAGE_BACKBLAZE_SECRET
- _APP_STORAGE_BACKBLAZE_REGION
- _APP_STORAGE_BACKBLAZE_BUCKET
- _APP_STORAGE_LINODE_ACCESS_KEY
- _APP_STORAGE_LINODE_SECRET
- _APP_STORAGE_LINODE_REGION
- _APP_STORAGE_LINODE_BUCKET
- _APP_STORAGE_WASABI_ACCESS_KEY
- _APP_STORAGE_WASABI_SECRET
- _APP_STORAGE_WASABI_REGION
- _APP_STORAGE_WASABI_BUCKET
- _APP_REDIS_HOST
- _APP_REDIS_PORT
- _APP_REDIS_USER