-
Notifications
You must be signed in to change notification settings - Fork 1
/
install.sh
executable file
·75 lines (68 loc) · 1.78 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 "$(dirname "$0")"
case "$(uname -sr)" in
Darwin*)
PLATFORM='darwin'
;;
Linux*icrosoft*)
PLATFORM='wsl'
;;
Linux*)
PLATFORM='linux'
;;
CYGWIN*|MINGW*|MINGW32*|MSYS*)
PLATFORM='windows'
;;
esac
# If your machine has NVIDIA GPU installed, run `./install.sh nvidia`.
if [ "$PLATFORM" = "windows" ] || [ "$PLATFORM" = "wsl" ]; then
if [ "$PLATFORM" = "wsl" ]; then
MY_HOME=`wslpath -a "$(cmd.exe /c "<nul set /p=%UserProfile%" 2>/dev/null)"`
else
MY_HOME=$HOME
fi
if [ "$MPV_CONF_PATH" = "" ]; then
MPV_CONF_PATH="$MY_HOME/AppData/Roaming/mpv"
fi
if [ "$1" = "nvidia" ]; then
my_filter() {
grep -v "^#osx:" | grep -v '^#linux:' | sed -e "s/^#nvidia://"
}
else
my_filter() {
grep -v '^#osx:' | grep -v '^#nvidia:' | grep -v '^#linux:'
}
fi
elif [ "$PLATFORM" = "darwin" ]; then
if [ "$MPV_CONF_PATH" = "" ]; then
MPV_CONF_PATH="$HOME/.config/mpv"
fi
my_filter() {
grep -v '^#nvidia:' | grep -v '^#linux:' | sed -e 's/^#osx://'
}
else
if [ "$MPV_CONF_PATH" = "" ]; then
if [ "$HOSTNAME" = "steamdeck" ]; then
MPV_CONF_PATH="$HOME/.var/app/io.mpv.Mpv/config/mpv"
else
MPV_CONF_PATH="$HOME/.config/mpv"
fi
fi
if [ "$1" = "nvidia" ]; then
my_filter() {
grep -v "^#osx:" | grep -v vulkan | sed -e "s/^#linux://" -e "s/^#nvidia://" -e "s/vo=gpu-next/vo=gpu/"
}
else
my_filter() {
grep -v '^#osx:' | grep -v '^#nvidia:'
}
fi
fi
BACKUP_DIR="$HOME/Downloads/mpv-$(date "+%m%d%H%M%Y.%S")"
mv "$MPV_CONF_PATH" "$BACKUP_DIR" 2> /dev/null \
&& echo "old mpv config to \"$BACKUP_DIR\""
mkdir -p "$MPV_CONF_PATH"
cp -R fonts script-opts scripts input.conf "$MPV_CONF_PATH"
cat mpv.conf | my_filter > "$MPV_CONF_PATH"/mpv.conf
mv "$BACKUP_DIR/watch_later" "$MPV_CONF_PATH" 2> /dev/null
echo "new mpv config to \"$MPV_CONF_PATH\""