Deprecated-Unsupported/Java Projects/Bookish/bookishScan.sh

71 lines
2.1 KiB
Bash
Executable File

#!/bin/bash
#
# By Maxim F. Stewart
# Contact: [maxim2131@gmail.com] OR [gamer1119@gmail.com]
#
# Copyright 2013 Maxim F. Stewart
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
#-------------------------------------------------------------------------#
# Possibly use in future releases
# wget http://www.google.com/s2/favicons?domain_url=${link} -O ./faveIcons/$i.png
main()
{
lynx -force_html -dump --listonly ./bookmarks.html | awk '/^ *[0-9]+\. / { print $2}' > ./links.txt
echo '<!doctype html>
<html lang="en">
<head>
<title>Bookish Home</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<link rel="stylesheet" href="./resources/css.css" type="text/css">
</head>
<body>
<div id="bg"><img src="./resources/imgs/matrix.gif"/></div>"
' > ./bookMarksHomePg.html
body;
}
body()
{
x=$(cat ./links.txt | wc -l) >> /dev/null ;
i="1"
while [ $i -le $x ]; do
line=$(sed -n "${i}p" ./links.txt);
link=$(echo "$line" | sed 's/*\///');
./resources/bin/wkhtmltoimage --crop-w 1280 \
--crop-h 900 \
--width 1920 \
--height 1080 \
--quality 75 \
--quiet ${link} \
./snapShots/$i.png
echo "<div class="\"section"\">
<a href="\"${link}"\">
<img src="\"./snapShots/$i.png"\">
<br>
"${link}"
</a>
</div>" >> bookMarksHomePg.html
i=$[$i++1] ;
done
echo '</body>
</html>' >> ./bookMarksHomePg.html
rm links.txt
}
main