forked from bernard57/qBittorrent_search_engine
-
Notifications
You must be signed in to change notification settings - Fork 0
/
update.sh
executable file
·62 lines (49 loc) · 1.44 KB
/
update.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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
#!/bin/bash
# A simple script to update the plugins of Qbittorent
url='https://github.com/qbittorrent/search-plugins.wiki.git'
tmp_dir=$(mktemp -d)
public_tmp=$(mktemp)
private_tmp=$(mktemp)
# backup old scripts
rm -rf bak 1>/dev/null 2>&1
mkdir -p bak
mv public* bak 1>/dev/null 2>&1
mv private* bak 1>/dev/null 2>&1
mv Plugin* bak 1>/dev/null 2>&1
git clone $url $tmp_dir
split_line=$(grep -n "Private" $tmp_dir/Unofficial-search-plugins.mediawiki | awk -F: '{print $1}')
sed -n "1,$split_line p" $tmp_dir/Unofficial-search-plugins.mediawiki > $public_tmp
sed -n "$split_line,\$ p" $tmp_dir/Unofficial-search-plugins.mediawiki > $private_tmp
echo ""
echo ":: Public site lists"
echo ""
grep -o -e "http.*\.py" $public_tmp > public_list
cat public_list
echo ""
echo ":: private site lists"
echo ""
grep -o -e "http.*\.py" $private_tmp > private_list
cat private_list
mkdir -p Plugins_for_Public_sites
mkdir -p Plugins_for_Private_sites
echo ""
echo ":: Download Plugins for Public sites"
echo ""
cd Plugins_for_Public_sites
#COUNTER=1
for file in $(cat ../public_list)
do
wget $file #-O "$COUNTER""_""$(echo $file|awk -F\/ '{print $NF}')"
#((COUNTER=COUNTER+1))
done
echo ""
echo ":: Download Plugins for Private sites"
echo ""
cd ../Plugins_for_Private_sites
#COUNTER=1
for file in $(cat ../private_list)
do
wget $file #-O "$COUNTER""_""$(echo $file|awk -F\/ '{print $NF}')"
#((COUNTER=COUNTER+1))
done
rm -rf $tmp_dir $private_tmp $public_tmp