introduce media script

This commit is contained in:
NetMan 2025-12-17 17:39:45 +01:00
commit d534e30e62
2 changed files with 44 additions and 0 deletions

18
README.md Normal file
View file

@ -0,0 +1,18 @@
# media-prawo-jazdy
## Requirements
- bash
- ffmpeg
## Usage
`bash script.sh <media_path>`
- 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)

26
script.sh Normal file
View file

@ -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