commit d534e30e625a38d0812a59c23764a10a40da60ac Author: NetMan <13informatyka14@gmail.com> Date: Wed Dec 17 17:39:45 2025 +0100 introduce media script diff --git a/README.md b/README.md new file mode 100644 index 0000000..219b5ef --- /dev/null +++ b/README.md @@ -0,0 +1,18 @@ +# media-prawo-jazdy + +## Requirements + +- bash +- ffmpeg + +## Usage + +`bash script.sh ` + +- media_path - folder with media files from the (Ministry of Infrasture)[https://www.gov.pl/web/infrastruktura/prawo-jazdy], the newest at the moment of me writing this (December 17th 2025) are the (visualisations for questions from November 2025)[https://www.gov.pl/pliki/mi/pytania_egzaminacyjne_na_prawo_jazdy_11_2025.zip], extract the media files themselves to this folder + +## What does it do? + +It converts (copies) all `.wmv` files to `.mp4` and copies all `.jpeg` files to `.jpg`. + +When you have all media and the script completed successfully with `Seems fine`, host these files on a webserver of your choice (e.g. apache, nginx), further steps on [nuxt-prawo-jazdy](https://git.mandarynki.eu/netman/nuxt-prawo-jazdy) diff --git a/script.sh b/script.sh new file mode 100644 index 0000000..1fd5850 --- /dev/null +++ b/script.sh @@ -0,0 +1,26 @@ +#!/bin/bash + +for file in "$@/.wmv"; +do + ffmpeg -i "$@/$file" -c:v libx264 -crf 23 -c:a aac -q:a 100 "$@/${file/%wmv/mp4}" +done + +TRIGGER_ERROR=0 +COUNT=0 + +for file in "$@"/*.wmv; +do + if [ ! -f "./${file/%wmv/mp4}" ]; then + echo "E: File '${file/%wmv/mp4}' not found!" + TRIGGER_ERROR=1 + COUNT=$((COUNT+1)) + fi +done + +if [ "$TRIGGER_ERROR" -eq 0 ]; then + echo "Seems fine" +fi + +if [ "$TRIGGER_ERROR" -eq 1 ]; then + echo "$COUNT errors" +fi