2013-05-25, 06:54
@Ghostdivision - do you have cron?
There's probably other scripts that can automate add-on execution but I've added such support to Texture Cache Maintenance utility:
and subsequently pre-loading your cache won't hurt either:
Alternatively, you can write a script that is able to detect when each AD run has finished so that calls to AD can be run serialised without any delay.
Here's an example bash script that I use which initiates a video library scan, followed by calls to AD for movies then tvshows, and finally the texture cache is pre-loaded if any new items have been added (either a full library pre-load or just incremental depending on whether AD has added any new items).
/mnt/share/bin/texturecache.cfg:
I run this script automatically on a remote FreeNAS system that I rsync new media to, so it only runs once the new media has hit the remote server - a Raspberry Pi running OpenELEC with its /storage partition mounted on NFS is connected to the NAS.
There's probably other scripts that can automate add-on execution but I've added such support to Texture Cache Maintenance utility:
Code:
cron@12:00: ./texturecache.py exec script.artwork.downloader silent=true mediatype=movie
cron@12:30: ./texturecache.py exec script.artwork.downloader silent=true mediatype=tvshow
Code:
cron@01:00:./texturecache.py c video
Alternatively, you can write a script that is able to detect when each AD run has finished so that calls to AD can be run serialised without any delay.
Here's an example bash script that I use which initiates a video library scan, followed by calls to AD for movies then tvshows, and finally the texture cache is pre-loaded if any new items have been added (either a full library pre-load or just incremental depending on whether AD has added any new items).
Code:
#!/bin/bash
LOGFILE=/var/log/xbmcscan.log
function _log {
[ -z "$1" ] && echo >> $LOGFILE || $PRINTF "$(date +"%Y-%m-%d %H:%M:%S"): $1\n" >> $LOGFILE
}
function waitForAD {
XBMC="/mnt/share/xbmc/rpi1/Storage/.xbmc"
XBMC_LOG="${XBMC}/temp/xbmc.log"
AD_REPORT="${XBMC}/userdata/addon_data/script.artwork.downloader/downloadreport.txt"
tail -fn0 "${XBMC_LOG}" | \
while read line; do
if [ -n "$(echo "$line" | grep "Artwork Downloader: script stopped")" ]; then
kill $(ps -o pid,args | grep -v grep | grep "tail -fn0 ${XBMC_LOG}" | awk '{ print $1 }') 2>/dev/null
break
fi
done
echo $(grep -e '^ - Total Artwork: 0$' "${AD_REPORT}" | awk '{ print $4 }')
}
NEWITEMS=0
_log "$(/mnt/share/bin/texturecache.py update 2>/dev/null)"
VSCAN="$(/mnt/share/bin/texturecache.py vscan 2>/dev/null)"
RESULT=$?
_log "$(echo "${VSCAN}")"
/mnt/share/bin/texturecache.py exec script.artwork.downloader silent=true mediatype=movie
NEWITEMS=$(($NEWITEMS + $(waitForAD "movies")))
/mnt/share/bin/texturecache.py exec script.artwork.downloader silent=true mediatype=tvshow
NEWITEMS=$(($NEWITEMS + $(waitForAD "tvshows")))
if [ ${NEWITEMS} -ne 0 ]; then
_log "New AD items downloaded - performing a full cache pre-load"
_log "\n$(/mnt/share/bin/texturecache.py c movies 2>/dev/null)"
_log "\n$(/mnt/share/bin/texturecache.py c tvshows 2>/dev/null)"
elif [ ${RESULT} -ne 0 ]; then
_log "No new AD items - performing a partial cache pre-load"
_log "\n$(/mnt/share/bin/texturecache.py lc movies 2>/dev/null)"
_log "\n$(/mnt/share/bin/texturecache.py lc tvshows 2>/dev/null)"
else
_log "Skipping cache pre-load - no new artwork items added"
fi
touch /tmp/texturecache.lastrun
/mnt/share/bin/texturecache.cfg:
Code:
xbmc.host=192.168.0.202
userdata=/mnt/share/xbmc/rpi1/Storage/.xbmc/userdata
cache.castthumb = yes
logfile=+/tmp/texturecache.log
lastrunfile=/tmp/texturecache.lastrun
I run this script automatically on a remote FreeNAS system that I rsync new media to, so it only runs once the new media has hit the remote server - a Raspberry Pi running OpenELEC with its /storage partition mounted on NFS is connected to the NAS.