-
Notifications
You must be signed in to change notification settings - Fork 0
/
install.sh
executable file
·54 lines (42 loc) · 1.17 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
#!/bin/sh
LOCAL=~/.local/bin
DIRECTORY="$(dirname "$(readlink -f "$0")")"
LAUNCHER="#!/usr/bin/env python3
import sys
sys.path.insert(1, '$DIRECTORY')
from ypsync import main
if __name__ == '__main__':
sys.exit(main())"
if [ "$1" = "-v" ]
then
echo "[INFO] Setting up launcher scripts..."
fi
mkdir -p $LOCAL
echo "$LAUNCHER" > $LOCAL/ypsync
chmod +x $LOCAL/ypsync
if [ "$1" = "-v" ]
then
echo "[INFO] Setting up config folders..."
fi
mkdir -p ~/.config/ypsync
if command -v pip > /dev/null 2>&1
then
echo "[INFO] Installing requirements... (requires pip)"
if [ "$1" = "-v" ]
then
pip install -r "$DIRECTORY/requirements.txt"
else
pip install -r "$DIRECTORY/requirements.txt" > /dev/null 2>&1
fi
else
echo "[ERROR] Please install pip and add it to PATH"
exit 1
fi
# Greeting
cat << EOF
ypsync successfully installed. Please ensure ffmpeg is installed for youtube-dl to work.
Next steps:
1. Make sure ~/.local/bin is in PATH environment variable.
2. Add playlists in '~/.config/ypsync/config.ini' to start syncing.
3. If you ever move the folder where this script resides then you have to re-run this script.
EOF