Created
May 6, 2016 17:07
-
-
Save bonelifer/35400ae59f7ece706d062a5172b7bd1b to your computer and use it in GitHub Desktop.
Script to control Kodi
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# xbmc | |
# Parameters: | |
# UL - update library | |
# CL - clean library | |
# UAL - update audio library | |
# CAL - clean audio libary | |
# QUIT - Quit XBMC | |
input="$1" | |
# 138 | |
ip="192.168.1.141" | |
user="kodi" | |
pass="kodi" | |
port="8081" | |
if [ $(echo "$input" |tr [:upper:] [:lower:]) == "ul" ]; then | |
#Scan New Videos to the Library | |
curl -i -X POST -d "{\"jsonrpc\": \"2.0\", \"method\": \"VideoLibrary.Scan\", \"id\": \"mybash\"}" -H "content-type:application/json" http://$user:$pass@$ip:$port/jsonrpc | |
elif [ $(echo "$input" |tr [:upper:] [:lower:]) == "cl" ]; then | |
#Cleanup the library and remove old missing content | |
curl -i -X POST -d "{\"jsonrpc\": \"2.0\", \"method\": \"VideoLibrary.Clean\", \"id\": \"mybash\"}" -H "content-type:application/json" http://$user:$pass@$ip:$port/jsonrpc | |
elif [ $(echo "$input" |tr [:upper:] [:lower:]) == "ual" ]; then | |
#Scan in New music Albums | |
curl -i -X POST -d "{\"jsonrpc\": \"2.0\", \"method\": \"AudioLibrary.Scan\", \"id\": \"mybash\"}" -H "content-type:application/json" http://$user:$pass@$ip:$port/jsonrpc | |
elif [ $(echo "$input" |tr [:upper:] [:lower:]) == "cal" ]; then | |
#Cleanup and remove missing albums | |
curl -i -X POST -d "{\"jsonrpc\": \"2.0\", \"method\": \"AudioLibrary.Clean\", \"id\": \"mybash\"}" -H "content-type:application/json" http://$user:$pass@$ip:$port/jsonrpc | |
elif [ $(echo "$input" |tr [:upper:] [:lower:]) == "quit" ]; then | |
#Quit XBMC | |
curl -i -X POST -d "{\"jsonrpc\": \"2.0\", \"method\": \"Application.Quit\", \"id\": \"1\"}" -H "content-type:application/json" http://$user:$pass@$ip:$port/jsonrpc | |
elif [ $(echo "$input" |tr [:upper:] [:lower:]) == "q" ]; then | |
#Quit XBMC | |
curl -i -X POST -d "{\"jsonrpc\": \"2.0\", \"method\": \"Application.Quit\", \"id\": \"1\"}" -H "content-type:application/json" http://$user:$pass@$ip:$port/jsonrpc | |
else | |
clear | |
echo "" | |
echo "Please enter a parameter from below to update/clean the video/audio library." | |
echo "" | |
echo "xbmc-update.sh PARAMATER" | |
echo "" | |
echo "Parameters:" | |
echo " UL - update library" | |
echo " CL - clean library" | |
echo " UAL - update audio library" | |
echo " CAL - clean audio library" | |
echo " QUIT or Q - quit XBMC" | |
echo "" | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment