-
Notifications
You must be signed in to change notification settings - Fork 0
/
7ed.sh
executable file
·46 lines (43 loc) · 1.46 KB
/
7ed.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
#!/bin/bash
# For each video file in the execution directory, tries to find matching subtitle
# on Addic7ed. Asks for confirmation before download.
# It uses Michael Baudino's addic7ed-ruby gem.
# For convinience I HIGHLY suggest you to use my own for of this gem.
# https://github.com/Jesus-21/addic7ed-ruby/tree/FilenameContentDisposition
# The difference is that the later use Addic7ed's content-disposition top set
# files names (subtitles and video files).
GREEN="\\033[1;32m"
DEFAULT="\\033[0;39m"
RED="\\033[1;31m"
BLUE="\\033[1;34m"
# By default seek FRENCH subtitles, you might want to change that.
# Add -l, --language [LANGUAGE] argument to addic7ed commands.
for f in *.{mp4,avi}
do
if [ -f "$f" ]
then
echo -e "$BLUE""$f""$DEFAULT"
# set language here
a=`addic7ed "$f" -na`
skip=`echo "$a" | grep -o "Skipping.$\|later.$"`
echo "$a"
if [ "$skip" == "" ]
then
read -p "Download subtitle? " yn
case $yn in
[Yy]* )
# set language here
dl=`addic7ed "$f"`
res=`echo "$dl" | grep -o "Enjoy your show :-)$"`
if [ "$res" == "Enjoy your show :-)" ]
then
echo -e "$GREEN""$dl""$DEFAULT"
else
echo -e "$RED""$dl""$DEFAULT"
fi
;;
esac
fi
echo
fi
done