Auteur Topic: Synology Reindex script UPNP (synoindex)  (gelezen 5521 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


 

Standaard Synology photo's

Gestart door burdie_123Board Photo Station / Photos

Reacties: 5
Gelezen: 1290
Laatste bericht 01 juni 2024, 19:51:55
door Bobo
New Synology BST170-8T Intel Powered NAS Revealed

Gestart door BirdyBoard Synology BeeStation

Reacties: 1
Gelezen: 8067
Laatste bericht 23 oktober 2024, 22:05:43
door m4v3r1ck
Synology DS925+, DS1525+, DS225+, DS1825+, DS425+ NAS and MORE REVEALED

Gestart door BirdyBoard Synology Awards & Reviews (NL)

Reacties: 19
Gelezen: 10153
Laatste bericht 21 april 2025, 20:38:05
door Sylvester
Foto's downloaden vanuit gedeeld album Synology Photos

Gestart door Ruben01Board Photo Station / Photos

Reacties: 6
Gelezen: 370
Laatste bericht 12 augustus 2025, 17:51:08
door Ruben01
Cardsharing on Synology DS109

Gestart door flexman1976Board Overige mods

Reacties: 3
Gelezen: 6759
Laatste bericht 13 december 2010, 08:38:37
door thecell