mirror of
https://github.com/arnaucube/configs.git
synced 2026-02-10 04:26:41 +01:00
add parse-blueray sh script, and backup server-dockers config
This commit is contained in:
49
bin/parse-blueray
Executable file
49
bin/parse-blueray
Executable file
@@ -0,0 +1,49 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
# NOTE: needs mkvtoolnix installed, ie. `apt install mkvtoolnix`.
|
||||
|
||||
set -e
|
||||
|
||||
OUT="$PWD"
|
||||
echo "processing current directory: $OUT"
|
||||
|
||||
for dir in */ ; do
|
||||
[ -d "$dir" ] || continue
|
||||
echo "processing $dir"
|
||||
|
||||
cd "$dir"
|
||||
|
||||
# prefer .rar if present
|
||||
rarfile=$(ls *.rar 2>/dev/null | head -n1)
|
||||
if [ -z "$rarfile" ]; then
|
||||
rarfile=$(ls *.r00 2>/dev/null | head -n1)
|
||||
fi
|
||||
|
||||
if [ -z "$rarfile" ]; then
|
||||
echo " no .rar/.r00 in $dir, skipping"
|
||||
cd ..
|
||||
continue
|
||||
fi
|
||||
|
||||
unrar x -o+ "$rarfile" . || { echo " extraction failed in $dir"; cd ..; continue; }
|
||||
|
||||
# find first video file
|
||||
video=$(find . -maxdepth 1 -type f \
|
||||
\( -iname '*.mkv' -o -iname '*.mp4' -o -iname '*.avi' -o -iname '*.m2ts' \) \
|
||||
! -iname '*sample*' | head -n1)
|
||||
|
||||
if [ -z "$video" ]; then
|
||||
echo " no video found after extraction in $dir"
|
||||
cd ..
|
||||
continue
|
||||
fi
|
||||
|
||||
base=$(basename "$dir" /)
|
||||
out="$OUT/${base}.mkv"
|
||||
|
||||
echo " muxing '$video' -> '$out'"
|
||||
mkvmerge -o "$out" "$video"
|
||||
|
||||
cd ..
|
||||
done
|
||||
|
||||
Reference in New Issue
Block a user