sr229 / animegrep

extracts video clips in anime (anything that is mkv with subtitles) by parsing and grepping the subtitle file for a chosen word. Uses mkvextract and ffmpeg to both extract the subtitles and create the clips. This fork adds further fixes within the pipeline.
https://git.danieljon.es/animegrep
GNU General Public License v3.0
28 stars 4 forks source link

-m requires parameter #10

Closed daniel-Jones closed 5 years ago

daniel-Jones commented 5 years ago

as originally intended, -m is to be used in a separate run after -d is used. -m shouldn't need a parameter.

sr229 commented 5 years ago

Thanks for reporting, I found the bug. It seems that whenever you put m: in there it'd require an argument. I fixed it but I won't be able to push it till 20:00 +0900 JST because my campus network does not allow SSH.

sr229 commented 5 years ago

9d1795e0936fac83021e78adfd31d57933f0e730 should fix this, give it a go.

daniel-Jones commented 5 years ago

Seems to be further broken

daniel_j@cirno[~/programming/bash/animegrep-1]$ ./animegrep.sh -f anime.mkv -w "French toast" -t 2
./animegrep.sh: line 34: [: too many arguments
You have both -d and -f set.. choose one, not both..
sr229 commented 5 years ago

forgot auto-closure was a thing, but @daniel-Jones go ahead try using it now.

daniel-Jones commented 5 years ago

no, didn't help. still thinks both -d and -f are set and now lost the help output

sr229 commented 5 years ago

@daniel-Jones I can't commit the patch right now but try this diff out to see if this changes anything


diff --git a/animegrep.sh b/animegrep.sh
index 5f31dda..f3bee83 100755
--- a/animegrep.sh
+++ b/animegrep.sh
@@ -46,22 +46,11 @@ shift $(($OPTIND -1))

 set -- "{$POSITIONAL[@]}";

-# check for mkvextract
-command -v mkvextract >/dev/null 2>&1 || { echo >&2 "Requires mkvextract. Aborting."; exit 3; }
-# check for ffmpeg
-command -v ffmpeg >/dev/null 2>&1 || { echo >&2 "Requires ffmpeg. Aborting."; exit 3; }
-
 # check if out directory exists
 # TODO handle case out exists but other subdirs don't
 if [ -z "$MERGE" ]; then

-       if [ ! -d "out" ]; then
-               echo "making out directory..";
-               mkdir out;
-               mkdir out/clips;
-       fi
-
-       if ! [ -z "$FILE" ] || [ -z "$DIRECTORY" ]; then
+       if [ ! -z "$FILE" ] && [ ! -z "$DIRECTORY" ]; then
                echo "You have both -d and -f set.. choose one, not both..";
                exit 127;
        fi
@@ -94,6 +83,20 @@ if [ -z "$MERGE" ]; then
 fi
 # we're done the boring stuff

+
+# check for mkvextract
+command -v mkvextract >/dev/null 2>&1 || { echo >&2 "Requires mkvextract. Aborting."; exit 3; }
+# check for ffmpeg
+command -v ffmpeg >/dev/null 2>&1 || { echo >&2 "Requires ffmpeg. Aborting."; exit 3; }
+
+
+if [ ! -d "out" ]; then
+       echo "making out directory..";
+       mkdir out;
+       mkdir out/clips;
+fi
+
+
 x=0;
sr229 commented 5 years ago

should be fixed by 10cd1a3.