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


 

Sub map maken in een gedeelde album map synology photo

Gestart door Albert BrouwBoard Photo Station / Photos

Reacties: 1
Gelezen: 1071
Laatste bericht 16 juni 2022, 13:24:05
door Bobo
DDNS web Synology.me aangemaakt, buiten huis bereiken

Gestart door cooltennisBoard Web Station

Reacties: 2
Gelezen: 906
Laatste bericht 10 oktober 2022, 22:24:50
door cooltennis
VERPLAATST: iemand ervaring Nedis cams op synology Nas

Gestart door BirdyBoard The lounge

Reacties: 0
Gelezen: 959
Laatste bericht 19 januari 2023, 22:55:01
door Birdy
VERPLAATST: formatteren in de synology of initialisatie

Gestart door BrioletBoard NAS hardware vragen

Reacties: 0
Gelezen: 599
Laatste bericht 29 april 2023, 11:05:47
door Briolet
Openen Synology-office bestand vanaf een Windows Explorer

Gestart door Paul1202Board Windows

Reacties: 13
Gelezen: 1286
Laatste bericht 22 augustus 2023, 21:27:10
door Birdy