Skip to content

Commit

Permalink
Opening support for both Mac and Linux in downloader.sh
Browse files Browse the repository at this point in the history
Closes issue NITDgpOS#21
  • Loading branch information
Compro-Prasad committed Jan 26, 2017
1 parent 7d39008 commit 54895ee
Showing 1 changed file with 11 additions and 3 deletions.
14 changes: 11 additions & 3 deletions BASH/downloader.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,14 @@
index(){
index() {
echo "$(echo $@ | grep -aob '"' | grep -oE '[0-9]+' | sed "${!#};d")"
}

os=$(uname)
if [ "$os" = "Linux" -o "$os" = "FreeBSD" ]; then
openWith="xdg-open"
elif [ "$os" = "Darwin" ]; then
openWith="open"
fi

a="$#"
declare -i chaps=0,chape=0,t=0,c=0,end_loop=0,d1=0,d2=0
#checking for existence of -t , --chap in argument
Expand Down Expand Up @@ -65,7 +73,7 @@ do
fi
rm index.html
declare -i i=1
while true #an infinte while loop
while true #an infinite while loop
do
echo "Downloading page $i of chapter $chap....."
wget -o log.txt -O $i.html -c www.mangareader.net/$manga/$chap/$i # Downloads the main webpage
Expand Down Expand Up @@ -96,6 +104,6 @@ do
path=$(pwd)
echo -e "Your downloaded file is in this path:\n" $path
cd ..
xdg-open chap$chapno.pdf
$openWith chap$chapno.pdf
rm -rf $chap
done

0 comments on commit 54895ee

Please sign in to comment.