2013-04-02, 18:14
I created a script that whenever I plug my HDD It runs a library update.
I run this script always when XBMC starts (I'm using this addon that run scripts after xbmc starts http://forum.xbmc.org/showthread.php?tid=151011).
Its a infinite loop script so everytime I plug my HDD it runs a library update
Is it possible to include this script at Library watchdog and instead of running a library update, starts Library Watchdog and then checks if there's new media and THEN run the library update?
OR add a line on my script to start Library Watchdog service?
Can I change the line "curl --data-binary...." to "bash /home/pi/.xmbc/addons/service.watchdog/service.py" ?
Does library watchdog saves the data (folder/files structure) so If I reboot, it will know that I added new media?
Otherwise my suggestion to include this line above won't work.
I run this script always when XBMC starts (I'm using this addon that run scripts after xbmc starts http://forum.xbmc.org/showthread.php?tid=151011).
Its a infinite loop script so everytime I plug my HDD it runs a library update
Is it possible to include this script at Library watchdog and instead of running a library update, starts Library Watchdog and then checks if there's new media and THEN run the library update?
OR add a line on my script to start Library Watchdog service?
Code:
#!/bin/bash
clear
echo "Tailing kern.log: searching for new HDD"
tail -fn0 /tmp/kern.log | while read line ; do
echo "$line" | grep "kernel: sda: sda1"
if [ $? = 0 ]
then
# Actions
sleep 3
curl --data-binary '{ "jsonrpc": "2.0", "method": "VideoLibrary.Scan", "id": "mybash"}' -H 'content-type: application/json;' http://localhost/jsonrpc
fi
done
Can I change the line "curl --data-binary...." to "bash /home/pi/.xmbc/addons/service.watchdog/service.py" ?
Does library watchdog saves the data (folder/files structure) so If I reboot, it will know that I added new media?
Otherwise my suggestion to include this line above won't work.