local-bin/apsalar/feishin

55 lines
1.3 KiB
Text
Raw Normal View History

2023-07-24 09:27:57 +03:00
#!/bin/sh
# Wrapper for Feishin to auto start/stop jellyfin-rpc
2023-07-24 09:27:57 +03:00
j_ver="1.1.0"
f_ver="0.7.1"
2023-07-24 09:27:57 +03:00
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": "http://192.169.1.2:8096",
"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"
2023-07-24 09:27:57 +03:00
fi
$HOME/.local/bin/jellyfin-rpc &
/opt/feishin/feishin
2023-07-24 09:27:57 +03:00
kill -9 $(pgrep -f jellyfin-rpc)
exit