-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathlowo
executable file
·70 lines (65 loc) · 1.54 KB
/
lowo
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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
#!/bin/bash
# 2018-01-13
# Lots Of Webpages Opener (lowo)
# Use as: lowo <filename> , where <filename> can be without extension. Opens webpages in the file or, if that doesn't exist, in ~/.lowo/<filename>.txt .
# Accepts the -p option for only opening with a probability read from hrut.
# Lines starting with # are ignored.
# Url's to open must start the line with "http" in the file; any comments to display can come after a space.
# Any other line is displayed and paused.
# Added hrut integration [2021-06-20 Sun]
if [[ $# == 1 ]]
then
rawfname="$1"
elif [[ $# == 2 ]]
then
if [[ "$1" == "-p" ]]
then
rawfname="$2"
else
echo "Usage: lowo <filename> or lowo -p <filename>"
exit 1
fi
else
echo "Usage: lowo <filename>"
exit 1
fi
if [[ -f "$rawfname" ]]
then
file="$rawfname"
else
ffront=${rawfname%.*}
file=$HOME/.lowo/$ffront.txt
fi
if [ ! -f $file ] ; then
echo "Can't find the file $file."
exit
fi
nol=$(cat $file | wc -l)
for i in `seq 1 $nol`;
do
if [[ -f ~/.hrut/hrut.pkl ]] && [[ "$1" == "-p" ]]
then
yesno=$(hrut -p)
if [[ "$yesno" == "0" ]]
then
continue
fi
fi
line=$(sed -n "$i p" $file)
url=${line%% *}
cmt=${line#* }
#echo "url: $url"
#echo "cmt: $cmt"
if [[ "$url" != "" ]] && [[ "$url" != "#"* ]] && [[ "$url" != "#" ]] ; then
if [[ "$url" == "http://"* ]] || [[ "$url" == "https://"* ]] ; then
# Notice: this uses lo2e the slo queue feeder, but you could uncomment cpucsekk and use your favourite browser here.
# cpucsekk
lo2e "$url"
echo $cmt
else
echo "$line"
read -n1 -s
fi
fi
done
# cpucsekk