Add helper scripts
This commit is contained in:
parent
64c13e2974
commit
9a3cff1cfa
|
@ -0,0 +1,25 @@
|
|||
#!/bin/sh
|
||||
|
||||
LANG=pob
|
||||
|
||||
usage() {
|
||||
echo "usage: dlsubs <files>"
|
||||
exit 1
|
||||
}
|
||||
|
||||
[ -z "$1" ] && usage
|
||||
|
||||
for arg in "$@"; do
|
||||
case "$arg" in
|
||||
*.mkv|*.mp4 )
|
||||
if [ ! -f "$arg" ]; then
|
||||
echo "$arg is not a file"
|
||||
usage
|
||||
fi ;;
|
||||
*) echo "$arg is neither a .mkv nor a .mp4 file"; usage ;;
|
||||
esac
|
||||
done
|
||||
|
||||
for input in "$@"; do
|
||||
subdl --lang=$LANG "$input"
|
||||
done
|
|
@ -4,17 +4,27 @@ set -e
|
|||
FSUBRC=~/.config/fsubrc
|
||||
|
||||
usage() {
|
||||
echo "usage: fsub <file>"
|
||||
echo "usage: fsub <files>"
|
||||
echo "fsub expects $FSUBRC to have a blacklist of words"
|
||||
exit 1
|
||||
}
|
||||
|
||||
[ -z $1 ] && usage
|
||||
[ -f $1 ] || usage
|
||||
[ -z $2 ] || usage
|
||||
[ -f $FSUBRC ] || touch $FSUBRC
|
||||
[ -z "$1" ] && usage
|
||||
|
||||
cp $1 $1.bak
|
||||
for arg in "$@"; do
|
||||
case "$arg" in
|
||||
*.srt )
|
||||
if [ ! -f "$arg" ]; then
|
||||
echo "$arg is not a file"
|
||||
usage
|
||||
fi ;;
|
||||
*) echo "$arg is not a .srt file"; usage ;;
|
||||
esac
|
||||
done
|
||||
|
||||
[ -f "$FSUBRC" ] || touch $FSUBRC
|
||||
|
||||
for arg in "$@"; do
|
||||
awk '
|
||||
BEGIN {
|
||||
n = 1
|
||||
|
@ -44,6 +54,6 @@ BEGIN {
|
|||
print time
|
||||
for(j = 0; j < linen; j++)
|
||||
print lines[j]
|
||||
}' $1 | sed 's/\r//' > /tmp/fsub
|
||||
mv /tmp/fsub $1
|
||||
rm $1.bak
|
||||
}' "$arg" | sed 's/\r//' > /tmp/fsub
|
||||
mv /tmp/fsub "$arg"
|
||||
done
|
||||
|
|
|
@ -0,0 +1,39 @@
|
|||
#!/bin/sh
|
||||
set -e
|
||||
|
||||
usage() {
|
||||
echo "usage: tomp4 <files>"
|
||||
exit 1
|
||||
}
|
||||
|
||||
[ -z "$1" ] && usage
|
||||
|
||||
for arg in "$@"; do
|
||||
case "$arg" in
|
||||
*.mkv )
|
||||
if [ ! -f "$arg" ]; then
|
||||
echo "$arg is not a file"
|
||||
usage
|
||||
fi ;;
|
||||
*) echo "$arg is not a .mkv file"; usage ;;
|
||||
esac
|
||||
done
|
||||
|
||||
for input in "$@"; do
|
||||
base=${input%.mkv}
|
||||
output="$base.mp4"
|
||||
tmp="$base.tmp.mp4"
|
||||
|
||||
if [ ! -f "$output" ]; then
|
||||
ffmpeg -i "$input" "$tmp"
|
||||
|
||||
if [ $? -ne 0 ]; then
|
||||
rm "$tmp"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
mv "$tmp" "$output"
|
||||
else
|
||||
"Skipping $input"
|
||||
fi
|
||||
done
|
Loading…
Reference in New Issue