Skip to content

Commit

Permalink
docs: updated README and LICENSE
Browse files Browse the repository at this point in the history
  • Loading branch information
zubeydecivelek committed Dec 17, 2024
1 parent c17d8f2 commit d0f9765
Show file tree
Hide file tree
Showing 3 changed files with 64 additions and 50 deletions.
50 changes: 25 additions & 25 deletions Bruno Collection - CDS Videos Publish Video.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,22 +4,22 @@
"items": [
{
"type": "http",
"name": "Optional Change access of the video",
"seq": 8,
"name": "Step 6: Get Project to Check the Flow Status",
"seq": 7,
"request": {
"url": "{{baseURL}}/api/deposits/video/{{video_id}}",
"method": "PUT",
"url": "{{baseURL}}/api/deposits/project/{{project_id}}",
"method": "GET",
"headers": [
{
"name": "content-type",
"value": "application/vnd.video.partial+json",
"value": "application/vnd.project.partial+json",
"enabled": true
}
],
"params": [],
"body": {
"mode": "json",
"json": "{\n \"_access\": {\n \"update\": [\n \"[email protected]\",\n \"[email protected]\" //Update the access according to category\n ],\n // If you want to restrict the video, update access read\n \"read\": [\n \"[email protected]\"\n ]\n\n }\n}\n\n",
"json": "",
"formUrlEncoded": [],
"multipartForm": []
},
Expand All @@ -34,22 +34,22 @@
},
{
"type": "http",
"name": "Get project to check the flow is finished",
"seq": 5,
"name": "Optional: Update the Access of the Video",
"seq": 6,
"request": {
"url": "{{baseURL}}/api/deposits/project/{{project_id}}",
"method": "GET",
"url": "{{baseURL}}/api/deposits/video/{{video_id}}",
"method": "PUT",
"headers": [
{
"name": "content-type",
"value": "application/vnd.project.partial+json",
"value": "application/vnd.video.partial+json",
"enabled": true
}
],
"params": [],
"body": {
"mode": "json",
"json": "",
"json": "{\n \"_access\": {\n \"update\": [\n \"[email protected]\",\n \"[email protected]\" \n ],\n // If you want to restrict the video, update access read\n \"read\": [\n \"[email protected]\"\n ]\n\n }\n}\n\n",
"formUrlEncoded": [],
"multipartForm": []
},
Expand All @@ -64,7 +64,7 @@
},
{
"type": "http",
"name": "Step 1- Create a project",
"name": "Step 1: Create a project",
"seq": 1,
"request": {
"url": "{{baseURL}}/api/deposits/project/",
Expand Down Expand Up @@ -96,7 +96,7 @@
},
{
"type": "http",
"name": "Step 2- Create a video",
"name": "Step 2: Create a video",
"seq": 2,
"request": {
"url": "{{baseURL}}/api/deposits/video/",
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\": \"Surname, Name\",\n \"ids\": [\n {\n \"value\": \"868056\",\n \"source\": \"cern\"\n }\n ],\n \"email\": \"[email protected]\",\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\":\"your_title\"\n },\n \"_access\": {\n \"read\": [\n \"[email protected]\"\n ]\n },\n \"vr\": false,\n \"featured\": false,\n \"language\": \"en\",\n \"contributors\": [\n {\n \"name\": \"Surname, Name\",\n \"ids\": [\n {\n \"value\": \"cern id\",\n \"source\": \"cern\"\n }\n ],\n \"email\": \"[email protected]\",\n \"role\": \"Co-Producer\"\n }\n ],\n \"description\": \"Description\",\n \"date\": \"2024-11-12\",\n \"keywords\":[\n {\n \"name\": \"keyword\",\n \"value\": {\n \"name\": \"keyword\"\n }\n },\n {\n \"name\": \"keyword2\",\n \"value\": {\n \"name\": \"keyword2\"\n }\n }\n ],\n \"related_links\":[\n {\n \"name\": \"related link\",\n \"url\": \"https://relatedlink\"\n }\n ]\n}",
"formUrlEncoded": [],
"multipartForm": []
},
Expand All @@ -128,7 +128,7 @@
},
{
"type": "http",
"name": "Step 3- Upload the video",
"name": "Step 3: Upload the video",
"seq": 3,
"request": {
"url": "{{baseURL}}/api/files/{{bucket_id}}/{{video_name}}",
Expand All @@ -152,7 +152,7 @@
],
"params": [],
"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",
"req": "const fs = require('fs');\nconst path = require('path');\n\n// File details\nconst filename = \"video_name.mp4\"; // CHANGE HERE\nconst filePath = \"video_file_path\"; // 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);"
},
"vars": {},
Expand All @@ -165,7 +165,7 @@
},
{
"type": "http",
"name": "Step 4- Create a flow",
"name": "Step 4: Create a flow",
"seq": 4,
"request": {
"url": "{{baseURL}}/api/flows/",
Expand All @@ -180,7 +180,7 @@
"params": [],
"body": {
"mode": "json",
"json": "{\n \"version_id\":\"{{main_file_version_id}}\", //response of the put the video 'version_id' \n \"key\": \"{{video_key}}\",//response of the put the video 'key' \n \"bucket_id\":\"{{bucket_id}}\", // create video response \n \"deposit_id\":\"{{video_id}}\" // create video response\n}",
"json": "{\n \"version_id\":\"{{main_file_version_id}}\", //response of the `upload the video` 'version_id' \n \"key\": \"{{video_key}}\", //response of the `upload the video` 'key' \n \"bucket_id\":\"{{bucket_id}}\", // create video response \n \"deposit_id\":\"{{video_id}}\" // create video response\n}",
"formUrlEncoded": [],
"multipartForm": []
},
Expand All @@ -195,8 +195,8 @@
},
{
"type": "http",
"name": "Step 5- Upload additional file",
"seq": 6,
"name": "Step 5: Upload additional file",
"seq": 5,
"request": {
"url": "{{baseURL}}/api/files/{{bucket_id}}/{{additional_file}}",
"method": "PUT",
Expand All @@ -209,7 +209,7 @@
"multipartForm": []
},
"script": {
"req": "const fs = require('fs');\nconst path = require('path');\n\n// File details\nconst filename = \"CHANGE HERE\";\nconst filePath = \"CHANGE HERE\";\nbru.setEnvVar(\"additional_file\", filename);\n\n// Read the file as raw binary data\nconst fileContent = fs.readFileSync(filePath);\n\n// Set request headers\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"
"req": "const fs = require('fs');\nconst path = require('path');\n\n// File details\nconst filename = \"video_name.mp4\"; // CHANGE HERE\nconst filePath = \"video_file_path\"; // CHANGE HERE\nbru.setEnvVar(\"additional_file\", filename);\n\n// Read the file as raw binary data\nconst fileContent = fs.readFileSync(filePath);\n\n// Set request headers\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"
},
"vars": {},
"assertions": [],
Expand All @@ -221,8 +221,8 @@
},
{
"type": "http",
"name": "Step 6- Publish",
"seq": 7,
"name": "Step 7: Publish",
"seq": 8,
"request": {
"url": "{{baseURL}}/api/deposits/video/{{video_id}}/actions/publish",
"method": "POST",
Expand Down Expand Up @@ -250,7 +250,7 @@
}
}
],
"activeEnvironmentUid": "zqLEVCQ0eIhimP48VysTg",
"activeEnvironmentUid": "O01m8KLYsgrkGRjOSv443",
"environments": [
{
"variables": [
Expand Down
File renamed without changes.
64 changes: 39 additions & 25 deletions README.rst
Original file line number Diff line number Diff line change
@@ -1,12 +1,20 @@
===
CDS
===
..
Copyright (C) 2013-2024 CERN.
CDS Videos is free software; you can redistribute it and/or modify it
under the terms of the GNU General Public License; see LICENSE file for more details.
This is the CERN Document Server source code overlay.
==========
CDS Videos
==========

.. image:: https://img.shields.io/github/license/CERNDocumentServer/cds-videos.svg
:target: ./LICENSE

This is the CDS Videos source code overlay.

Powered by Invenio
===================
CDS is a small layer on top of `Invenio <http://invenio-software.org>`_, a ​free software suite enabling you to run your own ​digital library or document repository on the web.
CDS Videos is a small layer on top of `Invenio <http://invenio-software.org>`_, a ​free software suite enabling you to run your own ​digital library or document repository on the web.

Table of Contents
=================
Expand All @@ -29,7 +37,6 @@ Table of Contents
- `Optional: Update the Access of the Video <#optional-update-the-access-of-the-video>`_
- `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>`_


Prerequisites
Expand Down Expand Up @@ -170,13 +177,31 @@ To facilitate local development, open multiple terminal sessions and run the fol
Testing
=======
Running the tests are as simple as: ::

python setup.py test
To run the tests, follow these steps:

1. **Activate your Python environment:**

2. **Set up the test environment:**

.. code-block:: bash
./scripts/setup-tests
3. **Run the tests:**

.. code-block:: bash
./run-tests.sh
or (to also show test coverage) ::
source run-tests.sh
**Running Specific Tests**

To run a specific test file or function, use the following command:

.. code-block:: bash
./run-tests.sh tests/unit/test_example.py -k "test_specific_function"
Publish Video through REST API
Expand Down Expand Up @@ -204,7 +229,7 @@ If you'd like to use the pre-configured REST API collection in Bruno, ensure you
- Download this `Bruno collection <./Bruno%20Collection%20-%20CDS%20Videos%20Publish%20Video.json>`_.
- Open Bruno and import downloaded collection.
- Create an environment for the collection.
- Configure the environment by adding a variable named ``baseURl``. Set its value to your API base URL (e.g., ``http://localhost:5000``).
- Configure the environment by adding a variable named ``baseURL``. Set its value to your API base URL (e.g., ``http://localhost:5000``).

3. **Configure Authentication in Bruno:**

Expand Down Expand Up @@ -513,6 +538,7 @@ Step 3: Upload the Video
- body
- Video file.

- To include the file in the body, modify the `pre-request script` in Bruno.

**Response:**

Expand Down Expand Up @@ -601,6 +627,8 @@ Step 5: (Optional) Upload Additional File
- body
- The file to be uploaded.

- To include the file in the body, modify the `pre-request script` in Bruno.

**Response:**

Uploaded additional file JSON.
Expand Down Expand Up @@ -729,17 +757,3 @@ Before publishing the video, ensure that the workflow is complete.

Published video deposit JSON.


License
=======

Copyright (C) 2013-2024 CERN.

CDS is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.

CDS is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with CDS; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.

In applying this licence, CERN does not waive the privileges and immunities granted to it by virtue of its status as an Intergovernmental Organization or submit itself to any jurisdiction.

0 comments on commit d0f9765

Please sign in to comment.