Skip to content

Commit

Permalink
Apply suggestions from code review
Browse files Browse the repository at this point in the history
  • Loading branch information
zubeydecivelek committed Dec 4, 2024
1 parent d58528f commit 477f7c7
Show file tree
Hide file tree
Showing 2 changed files with 61 additions and 66 deletions.
38 changes: 12 additions & 26 deletions Bruno Collection - CDS Videos Publish Video.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
"name": "Optional Change access of the video",
"seq": 8,
"request": {
"url": "{{baseURl}}/api/deposits/video/{{video_id}}",
"url": "{{baseURL}}/api/deposits/video/{{video_id}}",
"method": "PUT",
"headers": [
{
Expand All @@ -19,7 +19,7 @@
"params": [],
"body": {
"mode": "json",
"json": "{\n \"_access\": {\n \"update\": [\n \"[email protected]\",\n \"atlas-outreach-cds-video@cern.ch\" //Update the access according to category\n ],\n // If you want to restrict the video, update access read\n \"read\": [\n \"atlas-readaccess-active-members@cern.ch\"\n ]\n\n }\n}\n\n",
"json": "{\n \"_access\": {\n \"update\": [\n \"[email protected]\",\n \"your-egroup@cern.ch\" //Update the access according to category\n ],\n // If you want to restrict the video, update access read\n \"read\": [\n \"your-egroup@cern.ch\"\n ]\n\n }\n}\n\n",
"formUrlEncoded": [],
"multipartForm": []
},
Expand All @@ -37,7 +37,7 @@
"name": "Get project to check the flow is finished",
"seq": 5,
"request": {
"url": "{{baseURl}}/api/deposits/project/{{project_id}}",
"url": "{{baseURL}}/api/deposits/project/{{project_id}}",
"method": "GET",
"headers": [
{
Expand Down Expand Up @@ -67,7 +67,7 @@
"name": "Step 1- Create a project",
"seq": 1,
"request": {
"url": "{{baseURl}}/api/deposits/project/",
"url": "{{baseURL}}/api/deposits/project/",
"method": "POST",
"headers": [
{
Expand All @@ -79,7 +79,7 @@
"params": [],
"body": {
"mode": "json",
"json": "{\n \"$schema\": \"https://localhost:5000/schemas/deposits/records/videos/project/project-v1.0.0.json\",\n \"_access\": {\n \"update\": [\n \"[email protected]\",\n \"atlas-outreach-cds-video@cern.ch\"\n ],\n \"read\": [ // If you want to restrict the project, add access read\n \"atlas-readaccess-active-members@cern.ch\"\n ]\n },\n // Add category and type\n \"category\": \"ATLAS\",\n \"type\": \"VIDEO\"\n}",
"json": "{\n \"$schema\": \"https://localhost:5000/schemas/deposits/records/videos/project/project-v1.0.0.json\",\n \"_access\": {\n \"update\": [\n \"[email protected]\",\n \"your-egroup@cern.ch\"\n ],\n \"read\": [ // If you want to restrict the project, add access read\n \"your-egroup@cern.ch\"\n ]\n },\n // Add category and type\n \"category\": \"ATLAS\",\n \"type\": \"VIDEO\"\n}",
"formUrlEncoded": [],
"multipartForm": []
},
Expand All @@ -99,7 +99,7 @@
"name": "Step 2- Create a video",
"seq": 2,
"request": {
"url": "{{baseURl}}/api/deposits/video/",
"url": "{{baseURL}}/api/deposits/video/",
"method": "POST",
"headers": [
{
Expand All @@ -111,7 +111,7 @@
"params": [],
"body": {
"mode": "json",
"json": "{\n \"$schema\":\"https://localhost:5000/schemas/deposits/records/videos/video/video-v1.0.0.json\",\n \"_project_id\":\"{{project_id}}\",\n \"title\":\n {\n \"title\":\"217490_medium\"\n },\n\n \"vr\": false,\n \"featured\": false,\n \"language\": \"en\",\n \"contributors\": [\n {\n \"name\": \"Civelek, Zubeyde\",\n \"ids\": [\n {\n \"value\": \"868056\",\n \"source\": \"cern\"\n }\n ],\n \"email\": \"zubeyde.civelek@cern.ch\",\n \"role\": \"Co-Producer\"\n }\n ],\n \"description\": \"Description\",\n \"date\": \"2024-11-12\"\n}",
"json": "{\n \"$schema\":\"https://localhost:5000/schemas/deposits/records/videos/video/video-v1.0.0.json\",\n \"_project_id\":\"{{project_id}}\",\n \"title\":\n {\n \"title\":\"217490_medium\"\n },\n\n \"vr\": false,\n \"featured\": false,\n \"language\": \"en\",\n \"contributors\": [\n {\n \"name\": \"Surname, Name\",\n \"ids\": [\n {\n \"value\": \"868056\",\n \"source\": \"cern\"\n }\n ],\n \"email\": \"test@cern.ch\",\n \"role\": \"Co-Producer\"\n }\n ],\n \"description\": \"Description\",\n \"date\": \"2024-11-12\"\n}",
"formUrlEncoded": [],
"multipartForm": []
},
Expand All @@ -131,7 +131,7 @@
"name": "Step 3- Upload the video",
"seq": 3,
"request": {
"url": "{{baseURl}}/api/files/{{bucket_id}}/{{video_name}}",
"url": "{{baseURL}}/api/files/{{bucket_id}}/{{video_name}}",
"method": "PUT",
"headers": [
{
Expand All @@ -151,20 +151,6 @@
}
],
"params": [],
"body": {
"mode": "formUrlEncoded",
"formUrlEncoded": [],
"multipartForm": [
{
"type": "file",
"name": "",
"value": [
"/Users/zubeydecivelek/Downloads/217490_medium.mp4"
],
"enabled": true
}
]
},
"script": {
"req": "const fs = require('fs');\nconst path = require('path');\n\n// File details\nconst filename = \"CHANGE HERE\";\nconst filePath = \"CHANGE HERE\";\nbru.setEnvVar(\"video_name\",filename);\n\n// Read the file as raw binary data\nconst fileContent = fs.readFileSync(filePath);\n\n// Set request headers\nreq.setHeader(\"Content-Type\", \"video/mp4\"); // File content type\nreq.setHeader(\"Accept\", \"application/json, text/plain, */*\"); \nreq.setHeader(\"Accept-Encoding\", \"gzip, deflate, br, zstd\"); \nreq.setHeader(\"Content-Length\", fileContent.length);\n\n// Attach the file content as the request body\nreq.setBody(fileContent);\n",
"res": "let data = res.body ;\nbru.setEnvVar(\"main_file_version_id\", data.version_id);\nbru.setEnvVar(\"video_key\", data.key);"
Expand All @@ -182,7 +168,7 @@
"name": "Step 4- Create a flow",
"seq": 4,
"request": {
"url": "{{baseURl}}/api/flows/",
"url": "{{baseURL}}/api/flows/",
"method": "POST",
"headers": [
{
Expand Down Expand Up @@ -212,7 +198,7 @@
"name": "Step 5- Upload additional file",
"seq": 6,
"request": {
"url": "{{baseURl}}/api/files/{{bucket_id}}/{{additional_file}}",
"url": "{{baseURL}}/api/files/{{bucket_id}}/{{additional_file}}",
"method": "PUT",
"headers": [],
"params": [],
Expand All @@ -238,7 +224,7 @@
"name": "Step 6- Publish",
"seq": 7,
"request": {
"url": "{{baseURl}}/api/deposits/video/{{video_id}}/actions/publish",
"url": "{{baseURL}}/api/deposits/video/{{video_id}}/actions/publish",
"method": "POST",
"headers": [
{
Expand Down Expand Up @@ -269,7 +255,7 @@
{
"variables": [
{
"name": "baseURl",
"name": "baseURL",
"value": "https://localhost:5000/",
"enabled": true,
"secret": false,
Expand Down
89 changes: 49 additions & 40 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,9 @@ Table of Contents
- `Step 3: Upload the Video <#step-3-upload-the-video>`_
- `Step 4: Create a Flow <#step-4-create-a-flow>`_
- `Step 5: (Optional) Upload Additional File <#step-5-optional-upload-additional-file>`_
- `Step 6: Publish Video <#step-6-publish-video>`_
- `Optional: Update the Access of the Video <#optional-update-the-access-of-the-video>`_
- `Optional: Get Project Status <#optional-get-project-status>`_
- `Step 6: Get Project to Check the Flow Status <#step-6-get-project-to-check-the-flow-status>`_
- `Step 7: Publish Video <#step-7-publish-video>`_
- `License <#license>`_


Expand Down Expand Up @@ -186,7 +186,7 @@ Generate a Personal Access Token
---------------------------------

- Navigate to the ``CDS Videos`` platform.
- Click your user info in the top-right corner.
- Click on your user info in the top-right corner.
- Go to **Applications** and create a new **Personal Access Token**.
- Copy the token and store it securely.

Expand Down Expand Up @@ -286,10 +286,10 @@ To restrict the project, add ``_access/read``:
"_access": {
"update": [
"[email protected]",
"atlas-outreach-cds-video@cern.ch"
"your-egroup@cern.ch"
],
"read": [
"atlas-readaccess-active-members@cern.ch"
"your-egroup@cern.ch"
]
},
"category": "ATLAS",
Expand Down Expand Up @@ -377,7 +377,7 @@ Step 2: Create a Video
* - **vr**
- boolean
- body
-
- Indicates if the video is 360.
- Optional
* - **contributors**
- array<object>
Expand All @@ -402,7 +402,7 @@ Step 2: Create a Video
* - **featured**
- boolean
- body
- Whether the video is featured.
- Whether the video is featured. (Available for members of `VIDEOS_EOS_PATH_EGROUPS <./cds/config.py#L1277>`_)
- Optional
* - **keywords**
- list<json>
Expand All @@ -428,6 +428,11 @@ To restrict the video, add ``_access/read``. The ``_access/update`` will be the
{
"title":"217490_medium"
},
"_access": {
"read": [
"[email protected]"
]
},
"vr": false,
"featured": false,
"language": "en",
Expand Down Expand Up @@ -600,35 +605,6 @@ Step 5: (Optional) Upload Additional File

Uploaded additional file JSON.

Step 6: Publish Video
----------------------

**Request:**

``POST`` ``{{baseURL}}/api/deposits/video/{{video_id}}/actions/publish``

**Headers:**

- ``content-type: application/json``

**Parameters:**

.. list-table::
:header-rows: 1

* - **Name**
- **Type**
- **Location**
- **Description**
* - **video_id**
- string
- path
- ID of the video to publish.


**Response:**

Published video deposit JSON.

Optional: Update the Access of the Video
----------------------------------------
Expand Down Expand Up @@ -665,10 +641,10 @@ To restrict the video, add ``_access/read``. If you want to change the access/up
"_access": {
"update": [
"[email protected]",
"atlas-outreach-cds-video@cern.ch"
"your-egroup@cern.ch"
],
"read": [
"atlas-readaccess-active-members@cern.ch"
"your-egroup@cern.ch"
]
}
}
Expand All @@ -678,8 +654,8 @@ To restrict the video, add ``_access/read``. If you want to change the access/up
Updated video JSON.


Optional: Get Project Status
---------------------------
Step 6: Get Project to Check the Flow Status
--------------------------------------------

**Request:**

Expand Down Expand Up @@ -721,6 +697,39 @@ Updated project JSON with flow status as ``state``:
}
Step 7: Publish Video
----------------------

Before publishing the video, ensure that the workflow is complete.

**Request:**

``POST`` ``{{baseURL}}/api/deposits/video/{{video_id}}/actions/publish``

**Headers:**

- ``content-type: application/json``

**Parameters:**

.. list-table::
:header-rows: 1

* - **Name**
- **Type**
- **Location**
- **Description**
* - **video_id**
- string
- path
- ID of the video to publish.


**Response:**

Published video deposit JSON.


License
=======

Expand Down

0 comments on commit 477f7c7

Please sign in to comment.