mirror of
https://github.com/sigmasternchen/Anineko
synced 2025-03-15 19:48:54 +00:00
added log file; error detection
This commit is contained in:
parent
1483565739
commit
1ee0627f15
1 changed files with 28 additions and 7 deletions
35
anineko
35
anineko
|
@ -44,6 +44,9 @@ elif test "$mode" = "search"; then
|
||||||
text=$(echo $2 | tr " " "+")
|
text=$(echo $2 | tr " " "+")
|
||||||
dir=$3
|
dir=$3
|
||||||
|
|
||||||
|
tmp="/tmp/anineko.$$.log"
|
||||||
|
echo "" > $tmp
|
||||||
|
|
||||||
if test -z "$text"; then
|
if test -z "$text"; then
|
||||||
help $0 search
|
help $0 search
|
||||||
exit 2
|
exit 2
|
||||||
|
@ -63,10 +66,10 @@ elif test "$mode" = "search"; then
|
||||||
done
|
done
|
||||||
total=$i
|
total=$i
|
||||||
|
|
||||||
echo "Found $total episodes:"
|
echo "Found $total episodes:" | tee -a $tmp
|
||||||
|
|
||||||
for link in $links; do
|
for link in $links; do
|
||||||
echo " - " $link
|
echo " - " $link | tee -a $tmp
|
||||||
done
|
done
|
||||||
|
|
||||||
if test -z "$dir"; then
|
if test -z "$dir"; then
|
||||||
|
@ -75,7 +78,7 @@ elif test "$mode" = "search"; then
|
||||||
|
|
||||||
echo -ne "\nPress [Enter] to continue, [Ctrl] + [C] to cancel. "
|
echo -ne "\nPress [Enter] to continue, [Ctrl] + [C] to cancel. "
|
||||||
read
|
read
|
||||||
echo
|
echo | tee -a $tmp
|
||||||
|
|
||||||
echo -n "Creating directory ... "
|
echo -n "Creating directory ... "
|
||||||
if test ! -d $dir; then
|
if test ! -d $dir; then
|
||||||
|
@ -83,16 +86,34 @@ elif test "$mode" = "search"; then
|
||||||
fi
|
fi
|
||||||
echo -e "[ \033[32mdone\033[0m ]"
|
echo -e "[ \033[32mdone\033[0m ]"
|
||||||
|
|
||||||
|
fails=""
|
||||||
|
|
||||||
i=0
|
i=0
|
||||||
for link in $links; do
|
for link in $links; do
|
||||||
i=$(echo $i + 1 | bc)
|
i=$(echo $i + 1 | bc)
|
||||||
file=$(echo $link | awk -F'/' '{ print $4}')
|
file=$(echo $link | awk -F'/' '{ print $4}')
|
||||||
echo "Fetching file $i of $total: $file ..."
|
echo "Fetching file $i of $total: $file ..." | tee -a $tmp
|
||||||
$0 file $link ${dir}/${file}.mp4
|
$0 file $link ${dir}/${file}.mp4 | tee -a $tmp
|
||||||
echo "done."
|
if test ${PIPESTATUS[0]} = 0; then
|
||||||
|
echo "done." | tee -a $tmp
|
||||||
|
else
|
||||||
|
echo -e "\033[31msomething went wrong.\033[0m" | tee -a $tmp
|
||||||
|
fails="$fails $file"
|
||||||
|
fi
|
||||||
done
|
done
|
||||||
|
|
||||||
echo "All done."
|
if test -z "$fails"; then
|
||||||
|
echo "All done."
|
||||||
|
else
|
||||||
|
echo
|
||||||
|
echo "Some episodes couldn't be downloaded:"
|
||||||
|
for name in $fails; do
|
||||||
|
echo " - " $name
|
||||||
|
done
|
||||||
|
|
||||||
|
echo
|
||||||
|
echo "For more information check $tmp ..."
|
||||||
|
fi
|
||||||
|
|
||||||
elif test "$mode" = "file"; then
|
elif test "$mode" = "file"; then
|
||||||
url=$2
|
url=$2
|
||||||
|
|
Loading…
Reference in a new issue