From aa6ff513a625c68fa80de4292706b6d3f2bbdaeb Mon Sep 17 00:00:00 2001 From: shimon Date: Mon, 20 Jun 2022 14:44:04 +0300 Subject: [PATCH] restore --- app/config/collections.php | 2 +- app/controllers/api/projects.php | 4 ++- app/controllers/api/storage.php | 29 ------------------- .../Services/Video/VideoCustomServerTest.php | 3 +- 4 files changed, 6 insertions(+), 32 deletions(-) diff --git a/app/config/collections.php b/app/config/collections.php index 721df6f543..435a180303 100644 --- a/app/config/collections.php +++ b/app/config/collections.php @@ -2846,7 +2846,7 @@ $collections = [ ] ], 'videos' => [ - '$collection' => 'video_renditions', + '$collection' => Database::METADATA, '$id' => 'video_renditions', '$name' => 'Video_renditions', 'attributes' => [ diff --git a/app/controllers/api/projects.php b/app/controllers/api/projects.php index 1c98983bea..848bfb231d 100644 --- a/app/controllers/api/projects.php +++ b/app/controllers/api/projects.php @@ -121,6 +121,8 @@ App::post('/v1/projects') if (($collection['$collection'] ?? '') !== Database::METADATA) { continue; } + + $attributes = []; $indexes = []; @@ -147,7 +149,7 @@ App::post('/v1/projects') 'orders' => $index['orders'], ]); } - + var_dump($key); $dbForProject->createCollection($key, $attributes, $indexes); } diff --git a/app/controllers/api/storage.php b/app/controllers/api/storage.php index 6963f4153b..da70665e8b 100644 --- a/app/controllers/api/storage.php +++ b/app/controllers/api/storage.php @@ -125,35 +125,6 @@ App::post('/v1/storage/buckets') $dbForProject->createCollection('bucket_' . $bucket->getInternalId(), $attributes, $indexes); - $attributes = []; - $indexes = []; - - $videos = Config::getParam('collections', [])['videos'] ?? []; - - foreach ($videos['attributes'] as $attribute) { - $attributes[] = new Document([ - '$id' => $attribute['$id'], - 'type' => $attribute['type'], - 'size' => $attribute['size'], - 'required' => $attribute['required'], - 'signed' => $attribute['signed'], - 'array' => $attribute['array'], - 'filters' => $attribute['filters'], - 'default' => $attribute['default'] ?? null, - 'format' => $attribute['format'] ?? '' - ]); - } - - foreach ($videos['indexes'] as $index) { - $indexes[] = new Document([ - '$id' => $index['$id'], - 'type' => $index['type'], - 'attributes' => $index['attributes'], - 'lengths' => $index['lengths'], - 'orders' => $index['orders'], - ]); - } - $dbForProject->createCollection('bucket_' . $bucket->getInternalId() . '_video_renditions', $attributes, $indexes); } catch (Duplicate $th) { throw new Exception('Bucket already exists', 409, Exception::STORAGE_BUCKET_ALREADY_EXISTS); } diff --git a/tests/e2e/Services/Video/VideoCustomServerTest.php b/tests/e2e/Services/Video/VideoCustomServerTest.php index dc782e37e3..c533d287af 100644 --- a/tests/e2e/Services/Video/VideoCustomServerTest.php +++ b/tests/e2e/Services/Video/VideoCustomServerTest.php @@ -17,6 +17,7 @@ class VideoCustomServerTest extends Scope { + // $bucket = $this->client->call(Client::METHOD_POST, '/storage/buckets', [ // 'content-type' => 'application/json', // 'x-appwrite-project' => $this->getProject()['$id'], @@ -121,7 +122,7 @@ class VideoCustomServerTest extends Scope $key = '1cd0589616c0b0b98dbc42764399799e3dcf0fbcfa0d1f1db2a258573783802267551853ffa77d2895e57597835055afb645237e84d07cffd33f946af6598f40cdfdc11b9eb6bee09fdd0a325a4b5e3ef34fdf4ba745a87dc4de16f9935803c9ff6349f424774b2a4d3c8ce8a40a835b16486dec9e8c1f8fc16bc37e357f9daf'; $fid = '62aedd7dcdcc014783ff'; $bid = '62aedd7c90a8570ebf31'; - $stream = 'dash'; + $stream = 'hls'; $renditions = $this->client->call(Client::METHOD_GET, '/video/buckets/' . $bid . '/files/' . $stream . '/' . $fid, [ 'content-type' => 'application/json',