Auteur Topic: Synology Reindex script UPNP (synoindex)  (gelezen 4408 keer)

Offline thunder1979

  • Bedankjes
  • -Gegeven: 0
  • -Ontvangen: 0
  • Berichten: 4
Synology Reindex script UPNP (synoindex)
« Gepost op: 22 mei 2012, 13:33:08 »
I had some problems with my Synology diskstation. When I downloaded new files I had to do a manual re-index and that costed me over an hour everytime because of the amount of mediafiles that had to reindex.

I created a post process script for SABNZBD that scans for the files that are created 7 days ago and add's only those files to the index.

To use -ctime you have to instal findutils on your diskstation. -mtime is already there, but -mtime is not handy when downloading older mediafiles.

start.sh
#!/bin/sh
/volume1/SABNZBD/SABnzbd/scripts/index.sh 2>&1 | tee /volume1/SABNZBD/SABnzbd/scripts/logs/logje


index.sh

#!/bin/sh
set -x on
date
#SCAN DIRS
/opt/bin/find /volume1/video/Series -type d -print >> /volume1/SABNZBD/SABnzbd/scripts/logs/newdirs
/opt/bin/find /volumeUSB2/usbshare/Series -type d -print >> /volume1/SABNZBD/SABnzbd/scripts/logs/newdirs

#CREATE SCRIPTS FOR ADDING FOLDERS
while read line; do echo -e synoindex -A "'$line'"; done < /volume1/SABNZBD/SABnzbd/scripts/logs/newdirs >> /volume1/SABNZBD/SABnzbd/scripts/seriesdirprocess.sh

#SCAN NEW FILES
/opt/bin/find /volume1/video/Series -ctime -1 -iname "*.mpg" >> /volume1/SABNZBD/SABnzbd/scripts/logs/new
/opt/bin/find /volume1/video/Series -ctime -1 -iname "*.mp4" >> /volume1/SABNZBD/SABnzbd/scripts/logs/new
/opt/bin/find /volume1/video/Series -ctime -1 -iname "*.mkv" >> /volume1/SABNZBD/SABnzbd/scripts/logs/new
/opt/bin/find /volume1/video/Series -ctime -1 -iname "*.avi" >> /volume1/SABNZBD/SABnzbd/scripts/logs/new
/opt/bin/find /volume1/video/Series -ctime -1 -iname "*.mov" >> /volume1/SABNZBD/SABnzbd/scripts/logs/new
/opt/bin/find /volumeUSB2/usbshare/Series -ctime -1 -iname "*.mpg" >> /volume1/SABNZBD/SABnzbd/scripts/logs/new
/opt/bin/find /volumeUSB2/usbshare/Series -ctime -1 -iname "*.mp4" >> /volume1/SABNZBD/SABnzbd/scripts/logs/new
/opt/bin/find /volumeUSB2/usbshare/Series -ctime -1 -iname "*.mkv" >> /volume1/SABNZBD/SABnzbd/scripts/logs/new
/opt/bin/find /volumeUSB2/usbshare/Series -ctime -1 -iname "*.avi" >> /volume1/SABNZBD/SABnzbd/scripts/logs/new
/opt/bin/find /volumeUSB2/usbshare/Series -ctime -1 -iname "*.mov" >> /volume1/SABNZBD/SABnzbd/scripts/logs/new

#CREATE SCRIPT FOR ADDING NEW FILES
while read line; do echo -e synoindex -a "'$line'"; done < /volume1/SABNZBD/SABnzbd/scripts/logs/new >> /volume1/SABNZBD/SABnzbd/scripts/seriesprocess.sh

#SET PERMISSIONS
/opt/bin/chmod 777 /volume1/SABNZBD/SABnzbd/scripts/seriesprocess.sh
/opt/bin/chown sabnzbd:users /volume1/SABNZBD/SABnzbd/scripts/seriesprocess.sh
/opt/bin/chmod 777 /volume1/SABNZBD/SABnzbd/scripts/seriesdirprocess.sh
/opt/bin/chown sabnzbd:users /volume1/SABNZBD/SABnzbd/scripts/seriesdirprocess.sh

#EXECUTE SCRIPT FOR ADDING NEW FOLDERS
sh -x /volume1/SABNZBD/SABnzbd/scripts/seriesdirprocess.sh
sleep 5

#EXECUTE SCRIPT FOR ADDING NEW FILES
sh -x /volume1/SABNZBD/SABnzbd/scripts/seriesprocess.sh
sleep 5

#CLEAN UP
mv /volume1/SABNZBD/SABnzbd/scripts/logs/logje /volume1/SABNZBD/SABnzbd/scripts/logs/backup/logje_`date +"%Y-%m-%d--%H%M%S"`
mv /volume1/SABNZBD/SABnzbd/scripts/logs/new /volume1/SABNZBD/SABnzbd/scripts/logs/backup/new_`date +"%Y-%m-%d--%H%M%S"`
mv /volume1/SABNZBD/SABnzbd/scripts/seriesprocess.sh /volume1/SABNZBD/SABnzbd/scripts/logs/backup/process_`date +"%Y-%m-%d--%H%M%S"`
mv /volume1/SABNZBD/SABnzbd/scripts/seriesdirprocess.sh /volume1/SABNZBD/SABnzbd/scripts/logs/backup/seriesdirprocess_`date +"%Y-%m-%d--%H%M%S"`
mv /volume1/SABNZBD/SABnzbd/scripts/logs/newdirs /volume1/SABNZBD/SABnzbd/scripts/logs/backup/newdirs_`date +"%Y-%m-%d--%H%M%S"`
set -x off



You have to create the follow folders on your diskstation:
/volume1/SABNZBD/SABnzbd/scripts/
/volume1/SABNZBD/SABnzbd/scripts/logs/
/volume1/SABNZBD/SABnzbd/scripts/logs/backup/

If anyone have some corrections or add-ons don't hesitate!

Offline DFlower

  • Bedankjes
  • -Gegeven: 0
  • -Ontvangen: 0
  • Berichten: 1
Re: Synology Reindex script UPNP (synoindex)
« Reactie #1 Gepost op: 08 oktober 2013, 23:24:54 »
Can you tell more about how to get the files on the Synology Diskstation?
  • Mijn Synology: DS411j
  • HDD's: 4 x 2 TB
  • Extra's: standaard


 

Synology DS 106e

Gestart door AnonymousBoard NAS hardware vragen

Reacties: 1
Gelezen: 2860
Laatste bericht 24 oktober 2006, 00:21:42
door Anonymous
Synology Chat met guest functionaliteit

Gestart door LeonardBoard Officiƫle Packages

Reacties: 4
Gelezen: 1295
Laatste bericht 10 november 2020, 23:18:51
door Birdy
NFS op mijn MacPro en Synology NAS

Gestart door GreyedUserBoard FTP, NFS and Samba Server

Reacties: 9
Gelezen: 2082
Laatste bericht 11 januari 2021, 19:44:05
door Birdy
VERPLAATST: Synology Drive Back-uptaak of Rsync

Gestart door BirdyBoard Data replicator & overige backupsoftware

Reacties: 0
Gelezen: 659
Laatste bericht 21 maart 2021, 15:38:33
door Birdy
Synology niet zichtbaar in thuisnetwerk (bij gebruik van WIFI)

Gestart door Wouter0546Board Netwerk algemeen

Reacties: 3
Gelezen: 1865
Laatste bericht 21 juni 2021, 16:56:47
door Plerry