55 lines
1.3 KiB
Bash
Executable File
55 lines
1.3 KiB
Bash
Executable File
#!/bin/sh
|
|
# Wrapper for Feishin to auto start/stop jellyfin-rpc
|
|
|
|
j_ver="1.1.0"
|
|
f_ver="0.7.1"
|
|
|
|
if [ ! -f "$HOME/.local/bin/jellyfin-rpc" ]; then
|
|
echo "jellyfin-rpc not found, downloading..."
|
|
curl -L https://github.com/radiicall/jellyfin-rpc/releases/download/$j_ver/jellyfin-rpc-x86_64-linux \
|
|
-o $HOME/.local/bin/jellyfin-rpc
|
|
chmod +x $HOME/.local/bin/jellyfin-rpc
|
|
echo "jellyfin-rpc downloaded"
|
|
fi
|
|
|
|
if [ ! -f "$HOME/.config/jellyfin-rpc/main.json" ]; then
|
|
cat > $HOME/.config/jellyfin-rpc/main.json <<EOF
|
|
{
|
|
"jellyfin": {
|
|
"url": "$JELLYFIN_URL",
|
|
"api_key": "$JELLYFIN_API_KEY",
|
|
"username": ["$(whoami)"],
|
|
"music": {
|
|
"display": ["album"]
|
|
}
|
|
},
|
|
"discord": {
|
|
"application_id": "$DISCORD_APP_ID",
|
|
"buttons": []
|
|
},
|
|
"imgur": {
|
|
"client_id": "$IMGUR_CLIENT_ID"
|
|
},
|
|
"images": {
|
|
"enable_images": true,
|
|
"imgur_images": true
|
|
}
|
|
}
|
|
EOF
|
|
fi
|
|
|
|
if [ ! -d "/opt/feishin" ]; then
|
|
echo "feishin not found, downloading..."
|
|
doas mkdir /opt/feishin
|
|
doas curl -L https://github.com/jeffvli/feishin/releases/download/v$f_ver/Feishin-$f_ver-linux-x86_64.AppImage \
|
|
-o /opt/feishin/feishin
|
|
doas chmod +x /opt/feishin/feishin
|
|
echo "feishin installed"
|
|
fi
|
|
|
|
$HOME/.local/bin/jellyfin-rpc &
|
|
/opt/feishin/feishin
|
|
kill -9 $(pgrep -f jellyfin-rpc)
|
|
exit
|
|
|