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


 

DNSCrypt op de Synology ?

Gestart door hetregentbuitenBoard Overige software

Reacties: 0
Gelezen: 2624
Laatste bericht 01 februari 2012, 09:29:06
door hetregentbuiten
WDTV live en synology

Gestart door frontcodeBoard FTP, NFS and Samba Server

Reacties: 8
Gelezen: 6399
Laatste bericht 15 april 2012, 14:42:19
door Goner
Synology Photos

Gestart door HansZBoard Photo Station / Photos

Reacties: 5
Gelezen: 2282
Laatste bericht 28 november 2021, 15:06:15
door Bobo
VERPLAATST: Hoe verkeerde accountnaam verwijderen bij inlogschem synology

Gestart door BirdyBoard Synology DSM 7.0

Reacties: 0
Gelezen: 997
Laatste bericht 26 januari 2022, 15:28:52
door Birdy
Sub map maken in een gedeelde album map synology photo

Gestart door Albert BrouwBoard Photo Station / Photos

Reacties: 1
Gelezen: 1002
Laatste bericht 16 juni 2022, 13:24:05
door Bobo