curl -Ls "https://gist.githubusercontent.com/mattrude/95a1d0dde854dfb56edf7f9fab1b36f9/raw/installer.sh" |ash
Last active
May 23, 2023 16:16
-
-
Save mattrude/95a1d0dde854dfb56edf7f9fab1b36f9 to your computer and use it in GitHub Desktop.
This file contains 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/ash | |
MEDIA1="Data1" | |
MEDIA2="Data2" | |
DRIVES=`df -h |grep -v ${MEDIA1} |grep -v ${MEDIA2} |grep 'var/media' |awk '{ print $6 }'` | |
UPDATED=0 | |
for DRIVE in ${DRIVES} | |
do | |
TVSHOWS="`ls -d ${DRIVE}/*/ |egrep -i 'tv' |sed 's/\/$//g'`" | |
MOVIES="`ls -d ${DRIVE}/*/ |egrep -i 'movie' |sed 's/\/$//g'`" | |
MUSIC="`ls -d ${DRIVE}/*/ |egrep -i 'music' |sed 's/\/$//g'`" | |
PICTURES="`ls -d ${DRIVE}/*/ |egrep -i 'picture' |sed 's/\/$//g'`" | |
UPDATE="`ls -d ${DRIVE}/*/ |egrep -i 'update|software' |sed 's/\/$//g'`" | |
if [ `ls ${DRIVE}/${TVSHOWS} |wc -l` ]; then | |
echo "Working on ${DRIVE}/${TVSHOWS}" | |
/storage/.kodi/addons/virtual.network-tools/bin/rsync -a ${DRIVE}/${TVSHOWS}/* /var/media/${MEDIA1}/TV_Shows/ | |
UPDATED=1 | |
fi | |
if [ `ls ${DRIVE}/${MOVIES} |wc -l` ]; then | |
echo "Working on ${DRIVE}/${MOVIES}" | |
/storage/.kodi/addons/virtual.network-tools/bin/rsync -a ${DRIVE}/${MOVIES}/* /var/media/${MEDIA1}/Movies/ | |
UPDATED=1 | |
fi | |
if [ `ls ${DRIVE}/${MUSIC} |wc -l` ]; then | |
echo "Working on ${DRIVE}/${MUSIC}" | |
/storage/.kodi/addons/virtual.network-tools/bin/rsync -a ${DRIVE}/${MUSIC}/* /var/media/${MEDIA}/Music/ | |
UPDATED=1 | |
fi | |
if [ `ls ${DRIVE}/${PICTURES} |wc -l` ]; then | |
echo "Working on ${DRIVE}/${PICTURES}" | |
/storage/.kodi/addons/virtual.network-tools/bin/rsync -a ${DRIVE}/${PICTURES}/* /storage/pictures/ | |
UPDATED=1 | |
fi | |
if [ `ls ${DRIVE}/${UPDATE} |wc -l` ]; then | |
echo "Working on ${DRIVE}/${UPDATE}" | |
/storage/.kodi/addons/virtual.network-tools/bin/rsync -a ${DRIVE}/${UPDATE}/* /storage/.update/ | |
UPDATED=1 | |
fi | |
if [ ${UPDATED} == 1 ]; then | |
echo "Updated!" | |
umount ${DRIVE} | |
kodi-send --action="UpdateLibrary(video)" | |
fi | |
done |
This file contains 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/ash | |
BINDIR="/storage/bin" | |
BKDIR="/var/media/Data1/Backups" | |
DAY="`hostname -s`.`date +%u`" | |
if [ ! -f ${BINDIR}/texturecache.py ]; then | |
echo "Downloading texturecache.py" | |
curl -Ls https://raw.github.com/MilhouseVH/texturecache.py/master/texturecache.py -o ${BINDIR}/texturecache.py | |
chmod +x ${BINDIR}/texturecache.py | |
fi | |
mkdir -p $BKDIR | |
for TYPE in tvshows movies | |
do | |
${BINDIR}/texturecache.py watched $TYPE backup ${BKDIR}/watched.${TYPE}.${DAY}.json | |
done |
This file contains 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
#m h dom mon dow command | |
*/15 * * * * /storage/bin/auto-copy.sh | |
22 4 * * * /storage/bin/backup-watched.sh |
This file contains 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/ash | |
BIN="/storage/bin" | |
URL="https://gist.githubusercontent.com/mattrude/95a1d0dde854dfb56edf7f9fab1b36f9/raw" | |
rm /var/run/localtime | |
ln -s /usr/share/zoneinfo/US/Central /var/run/localtime | |
mkdir -p ${BIN} | |
echo 'export PATH="/storage/bin/:$PATH" | |
alias l="ls -lh"' > /storage/.profile | |
curl -Ls https://raw.githubusercontent.com/MilhouseVH/texturecache.py/master/texturecache.py -o ${BIN}/texturecache.py | |
chmod 755 ${BIN}/texturecache.py | |
mkdir -p /storage/.ssh | |
curl -Ls ${URL}/ssh-authorized_keys.txt -o /storage/.ssh/authorized_keys | |
curl -Ls ${URL}/auto-copy.sh -o ${BIN}/auto-copy.sh | |
chmod 755 ${BIN}/auto-copy.sh | |
curl -Ls ${URL}/backup-watched.sh -o ${BIN}/backup-watched.sh | |
chmod 755 ${BIN}/backup-watched.sh | |
curl -Ls ${URL}/restore-watched.sh -o ${BIN}/restore-watched.sh | |
chmod 755 ${BIN}/restore-watched.sh | |
curl -Ls ${URL}/crontab.bkp |crontab - | |
if [ ! -f /storage/.kodi/userdata/sources.xml ]; then | |
echo "Installing sources.xml" | |
curl -Ls ${URL}/sources.xml -o /storage/.kodi/userdata/sources.xml | |
fi | |
if [ ! -f /storage/.kodi/userdata/mediasources.xml ]; then | |
echo "Installing mediasources.xml" | |
curl -Ls ${URL}/mediasources.xml -o /storage/.kodi/userdata/mediasources.xml | |
fi |
This file contains 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
<mediasources> | |
<network> | |
<location id="0">smb://jackmedia/Media1/Movies</location> | |
<location id="1">smb://jackmedia/Media2/Movies</location> | |
<location id="2">smb://jackmedia/Media2/Movies-Kids</location> | |
<location id="3">smb://jackmedia/Media1/TV_Shows</location> | |
<location id="4">smb://jackmedia/Media2/TV_Shows</location> | |
<location id="5">smb://jackmedia/Media2/TV_Shows-Kids</location> | |
<location id="6">smb://jackmedia/Media1/Music</location> | |
<location id="7">smb://jackmedia/Media1/Movie_Sets</location> | |
<location id="8">smb://jackmedia/Media1/Music_Artists</location> | |
</network> | |
</mediasources> |
This file contains 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/ash | |
DOW="`date +%u`" | |
BKDIR="/storage/backup" | |
BINDIR="/storage/bin" | |
if [ ! -f ${BINDIR}/texturecache.py ]; then | |
echo "Downloading texturecache.py" | |
curl -Ls https://raw.github.com/MilhouseVH/texturecache.py/master/texturecache.py -o ${BINDIR}/texturecache.py | |
chmod +x ${BINDIR}/texturecache.py | |
fi | |
for type in tvshows movies | |
do | |
${BINDIR}/texturecache.py watched $type restore ${BKDIR}/watched.${type}.`hostname -s`.`date +%u`.json | |
done |
This file contains 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
<sources> | |
<programs> | |
<default pathversion="1"></default> | |
</programs> | |
<video> | |
<default pathversion="1"></default> | |
<source> | |
<name>TV Shows</name> | |
<path pathversion="1">smb://jackmedia/Media1/TV_Shows/</path> | |
<path pathversion="1">smb://jackmedia/Media2/TV_Shows/</path> | |
<path pathversion="1">smb://jackmedia/Media2/TV_Shows-Kids/</path> | |
<allowsharing>true</allowsharing> | |
</source> | |
<source> | |
<name>Movies</name> | |
<path pathversion="1">smb://jackmedia/Media1/Movies/</path> | |
<path pathversion="1">smb://jackmedia/Media2/Movies/</path> | |
<path pathversion="1">smb://jackmedia/Media2/Movies-Kids/</path> | |
<allowsharing>true</allowsharing> | |
</source> | |
</video> | |
<music> | |
<default pathversion="1"></default> | |
<source> | |
<name>Music</name> | |
<path pathversion="1">smb://jackmedia/Media1/Music/</path> | |
<allowsharing>true</allowsharing> | |
</source> | |
</music> | |
<pictures> | |
<default pathversion="1"></default> | |
<source> | |
<name>Pictures</name> | |
<path pathversion="1">smb://jackmedia/Media1/Pictures/</path> | |
<allowsharing>true</allowsharing> | |
</source> | |
</pictures> | |
<files> | |
<default pathversion="1"></default> | |
</files> | |
<games> | |
<default pathversion="1"></default> | |
</games> | |
</sources> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment