-
-
Save flyser/9692824 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
if [[ "x$1" = "x" ]]; then | |
echo "Usage:" | |
echo " $0 <searchpath>" | |
exit 1 | |
fi | |
find "$(readlink -f "$1")" -type d -name STREAM | while read M ; do | |
cd "$M" | |
# Determine name of the Movie | |
NAME="$(echo "$M" | sed "s_.*/\([^/]*\)/STREAM_\1_")" | |
# Find all parts that will be merged | |
FILES="$(echo *.m2ts | sed "s_ \([^ ]*\)_ +\1_g")" | |
# Define output filename | |
OUTPUT="../$NAME.mkv" | |
# Ignore preexisting files | |
if [[ -e "$OUTPUT" ]]; then | |
echo "File '$OUTPUT' exists. ignoring ..." | |
continue | |
fi | |
# Print what would be executed, uncomment the second line to execute | |
echo "mkvmerge $FILES -o $OUTPUT" | |
#mkvmerge $FILES -o "$OUTPUT" | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment