-
Notifications
You must be signed in to change notification settings - Fork 0
/
install.sh
executable file
·75 lines (58 loc) · 1.53 KB
/
install.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
63
64
65
66
67
68
69
70
71
72
73
74
75
#!/bin/bash
# cd to the directory of this script
cd "$(dirname "$0")"
# check if the user is root
if [ $(id -u) != "0" ]; then
echo "Error: You must be root to run this script"
exit 1
fi
# check if bmpv is installed
if [ -f /usr/bin/bmpv ]; then
echo "Error: bmpv is already installed at /usr/bin/bmpv"
exit 1
fi
# check dependencies
# mpv
if ! command -v mpv >/dev/null 2>&1; then
echo "Error: mpv is not installed"
exit 1
fi
# python3
if ! command -v python3 >/dev/null 2>&1; then
echo "Error: python3 is not installed"
exit 1
fi
# requests
if ! python3 -c "import requests" >/dev/null 2>&1; then
echo "Error: [python]requests is not installed"
exit 1
fi
# urllib
if ! python3 -c "import urllib" >/dev/null 2>&1; then
echo "Error: [python]urllib is not installed"
exit 1
fi
# BBDown
if ! command -v BBDown >/dev/null 2>&1; then
echo "Error: BBDown is not installed"
exit 1
fi
# danmaku2ass
if ! command -v danmaku2ass >/dev/null 2>&1; then
echo "Error: danmaku2ass is not installed"
exit 1
fi
# copy desktop entry
cp ./bmpv.desktop /usr/share/applications/
# insert to [Added Associations] in mimeapps.list
sed -i '/\[Added Associations\]/a x-scheme-handler/bmpv=bmpv.desktop' ~/.config/mimeapps.list
# copy bmpv.py to /usr/bin
cp ./bmpv.py /usr/bin/bmpv
# make it executable
chmod +x /usr/bin/bmpv
# echo success
echo "bmpv installed successfully"
# remind user to add script to tampermonkey
echo "Please add bmpv.user.js to tampermonkey"
# print biliplay.user.js
cat ./bmpv.user.js