From bf016d77b99b6f7ceed7211ebedba0700add2550 Mon Sep 17 00:00:00 2001 From: Gildas <1122076+djhi@users.noreply.github.com> Date: Fri, 10 Jan 2025 10:45:59 +0100 Subject: [PATCH 1/4] Add a check for videos format in CI --- .github/workflows/test.yml | 9 +++++++++ Makefile | 3 +++ scripts/check-documentation-videos-format.sh | 12 ++++++++++++ 3 files changed, 24 insertions(+) create mode 100755 scripts/check-documentation-videos-format.sh diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 3b279539803..664183a39d8 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -57,6 +57,15 @@ jobs: - name: Type check simple example run: cd examples/simple && yarn type-check + doc-videos-format-check: + runs-on: ubuntu-latest + if: github.ref_type != 'tag' + steps: + - name: Checkout + uses: actions/checkout@v4 + - name: Videos format check + run: make check-documentation-videos-format + doc-check: runs-on: ubuntu-latest if: github.ref_type != 'tag' diff --git a/Makefile b/Makefile index adde21c3ac9..90bc1ba070b 100644 --- a/Makefile +++ b/Makefile @@ -175,3 +175,6 @@ build-storybook: ## Build the storybook update-sandbox: ## Push the local version of the simple example to the sandbox repository ./scripts/update-sandbox.sh + +check-documentation-videos-format: ## Check the documentation format + ./scripts/check-documentation-videos-format.sh diff --git a/scripts/check-documentation-videos-format.sh b/scripts/check-documentation-videos-format.sh new file mode 100755 index 00000000000..bdbb558d70d --- /dev/null +++ b/scripts/check-documentation-videos-format.sh @@ -0,0 +1,12 @@ +for file in ./docs/img/*; do + codec=$(mediainfo --Inform="Video;%CodecID%" "$file") + if [ "$codec" = "hvc1" ]; then + # Construct the output file name + output_file="${file%.*}_avc1.${file##*.}" + # Convert the file to avc1 (H.264) + ffmpeg -i "$file" -c:v libx264 -c:a copy "$output_file" + rm $file + mv $output_file $file + echo "Fixed codec for $file" + fi +done \ No newline at end of file From 446a42d7ff00747891963b0ea0db9557aba9721f Mon Sep 17 00:00:00 2001 From: Gildas <1122076+djhi@users.noreply.github.com> Date: Fri, 10 Jan 2025 11:14:38 +0100 Subject: [PATCH 2/4] Only output the warning --- scripts/check-documentation-videos-format.sh | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/scripts/check-documentation-videos-format.sh b/scripts/check-documentation-videos-format.sh index bdbb558d70d..6dd92506a8b 100755 --- a/scripts/check-documentation-videos-format.sh +++ b/scripts/check-documentation-videos-format.sh @@ -1,12 +1,10 @@ -for file in ./docs/img/*; do +for file in ./docs/img/**; do codec=$(mediainfo --Inform="Video;%CodecID%" "$file") if [ "$codec" = "hvc1" ]; then - # Construct the output file name - output_file="${file%.*}_avc1.${file##*.}" - # Convert the file to avc1 (H.264) - ffmpeg -i "$file" -c:v libx264 -c:a copy "$output_file" - rm $file - mv $output_file $file - echo "Fixed codec for $file" + echo "Invalid codec for $file" + echo "Convert it to avc1 with:" + echo "ffmpeg -i $file -c:v libx264 -c:a copy ${file%.*}_avc1.${file##*.}" + echo "rm $file" + echo "mv $output_file $file" fi done \ No newline at end of file From 64c306b0db97fbe11955b7c1929daf6342dc58a6 Mon Sep 17 00:00:00 2001 From: Gildas <1122076+djhi@users.noreply.github.com> Date: Fri, 10 Jan 2025 11:16:07 +0100 Subject: [PATCH 3/4] Add exit code when invalid video is detected --- scripts/check-documentation-videos-format.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/scripts/check-documentation-videos-format.sh b/scripts/check-documentation-videos-format.sh index 6dd92506a8b..1953d9993fb 100755 --- a/scripts/check-documentation-videos-format.sh +++ b/scripts/check-documentation-videos-format.sh @@ -6,5 +6,6 @@ for file in ./docs/img/**; do echo "ffmpeg -i $file -c:v libx264 -c:a copy ${file%.*}_avc1.${file##*.}" echo "rm $file" echo "mv $output_file $file" + exit 1; fi done \ No newline at end of file From 3727b5990423fa02a09672b38efd448abc54ce50 Mon Sep 17 00:00:00 2001 From: Gildas <1122076+djhi@users.noreply.github.com> Date: Fri, 10 Jan 2025 12:09:54 +0100 Subject: [PATCH 4/4] Fix output --- scripts/check-documentation-videos-format.sh | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/scripts/check-documentation-videos-format.sh b/scripts/check-documentation-videos-format.sh index 1953d9993fb..0285b98213f 100755 --- a/scripts/check-documentation-videos-format.sh +++ b/scripts/check-documentation-videos-format.sh @@ -1,9 +1,11 @@ for file in ./docs/img/**; do codec=$(mediainfo --Inform="Video;%CodecID%" "$file") if [ "$codec" = "hvc1" ]; then + # Construct the output file name + output_file="${file%.*}_avc1.${file##*.}" echo "Invalid codec for $file" echo "Convert it to avc1 with:" - echo "ffmpeg -i $file -c:v libx264 -c:a copy ${file%.*}_avc1.${file##*.}" + echo "ffmpeg -i $file -c:v libx264 -c:a copy ${output_file}" echo "rm $file" echo "mv $output_file $file" exit 1;