Page 1 of 1

Synology Reindex script UPNP (synoindex)

Posted: May 22nd, 2012, 6:28 am
by thunder1979
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

Code: Select all

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

index.sh

Code: Select all

#!/bin/sh
set -x on
date
rm /volume1/SABNZBD/SABnzbd/scripts/logs/new
find /volume1/video/ -ctime -7 -iname "*.mpg" >> /volume1/SABNZBD/SABnzbd/scripts/logs/new
find /volume1/video/ -ctime -7 -iname "*.mp4" >> /volume1/SABNZBD/SABnzbd/scripts/logs/new
find /volume1/video/ -ctime -7 -iname "*.mkv" >> /volume1/SABNZBD/SABnzbd/scripts/logs/new
find /volume1/video/ -ctime -7 -iname "*.avi" >> /volume1/SABNZBD/SABnzbd/scripts/logs/new
find /volume1/video/ -ctime -7 -iname "*.mov" >> /volume1/SABNZBD/SABnzbd/scripts/logs/new
find /volume1/music/ -ctime -7 -iname "*.mp3" >> /volume1/SABNZBD/SABnzbd/scripts/logs/new
find /volume1/music/ -ctime -7 -iname "*.wav" >> /volume1/SABNZBD/SABnzbd/scripts/logs/new
find /volume1/photo/ -ctime -7 -iname "*.jpg" >> /volume1/SABNZBD/SABnzbd/scripts/logs/new
find /volume1/photo/ -ctime -7 -iname "*.gif" >> /volume1/SABNZBD/SABnzbd/scripts/logs/new
find /volume1/photo/ -ctime -7 -iname "*.bmp" >> /volume1/SABNZBD/SABnzbd/scripts/logs/new
chmod 777 -R /volume1/SABNZBD/SABnzbd/scripts/logs
chown sabnzbd:users -R /volume1/SABNZBD/SABnzbd/scripts/logs
while read line; do echo -e synoindex -a "'$line'"; done < /volume1/SABNZBD/SABnzbd/scripts/logs/new >> /volume1/SABNZBD/SABnzbd/scripts/process.sh
chmod 777 /volume1/SABNZBD/SABnzbd/scripts/process.sh
chown sabnzbd:users /volume1/SABNZBD/SABnzbd/scripts/process.sh
sh -x /volume1/SABNZBD/SABnzbd/scripts/process.sh
sleep 5
mv /volume1/SABNZBD/SABnzbd/scripts/logs/logje /volume1/SABNZBD/SABnzbd/scripts/logs/backup/logje_`date +"%Y-%m-%d--%H%M%S"`
cp /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/process.sh /volume1/SABNZBD/SABnzbd/scripts/logs/backup/process_`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!

Re: Synology Reindex script UPNP (synoindex)

Posted: August 25th, 2012, 1:42 am
by wsoet
I use this index script on my synology

Code: Select all

#!/bin/ash
fullpath=$1

## change owner and usergroep
/bin/chown -R admin:users "$fullpath"

## Remove index if already exist
/usr/syno/bin/synoindex -D "$fullpath"

## Add index to targetfolder
/usr/syno/bin/synoindex -A "$fullpath"

echo Mediaindex successfull at "$fullpath"

Re: Synology Reindex script UPNP (synoindex)

Posted: September 27th, 2012, 5:01 pm
by Aspergillus
1. Create a script
containing the following code:

Code: Select all

#!/bin/sh
#
/usr/syno/bin/synoindex -A "$1"
This script will tell the synology indexing that a new Directory "$1" has to be indexed. $1 contains the directory that sabnzbd stored your downoad in.
So instead of indexin all it only indexes the last added folder.
Save it under for example postdownload.sh

2. Put script somewere where sabnzbd can find it

and tell sabnzbd where you put the script.
Config->folders->Post-Processing Scripts Folder
if you put the script somwhere in your volume1 use absolute path to point to the script directory like for example /volume1/downloads/scripts

3. Make sure sabnzbd knows wich script to run after download
Go to
Config->Categories
and at Default- Script you should see your script (postdownload.sh) in the dropdown. Choose it.

This works as a charm.

Tipp: Make sure you crerated the script in a Unix/Linux enabeled Editor (like PS Pad) and you use Unix Linefeed.

Regards & Good Luck
Aspi

Re: Synology Reindex script UPNP (synoindex)

Posted: February 9th, 2014, 9:53 am
by spacewagon
Aspergillus wrote:1. Create a script
containing the following code:

Code: Select all

#!/bin/sh
#
/usr/syno/bin/synoindex -A "$1"
This script will tell the synology indexing that a new Directory "$1" has to be indexed. $1 contains the directory that sabnzbd stored your downoad in.
So instead of indexin all it only indexes the last added folder.
Save it under for example postdownload.sh

2. Put script somewere where sabnzbd can find it

and tell sabnzbd where you put the script.
Config->folders->Post-Processing Scripts Folder
if you put the script somwhere in your volume1 use absolute path to point to the script directory like for example /volume1/downloads/scripts

3. Make sure sabnzbd knows wich script to run after download
Go to
Config->Categories
and at Default- Script you should see your script (postdownload.sh) in the dropdown. Choose it.

This works as a charm.

Tipp: Make sure you crerated the script in a Unix/Linux enabeled Editor (like PS Pad) and you use Unix Linefeed.

Regards & Good Luck
Aspi
Thanks! It worked... but now: it doesn't. No errors or something, but the index won't update.

I guess this is since I run the new DSM 4.3 version a few weeks.

Someone any idea?

Re: Synology Reindex script UPNP (synoindex)

Posted: February 12th, 2014, 9:19 am
by LapinFou
Maybe You could try to use my scripts ? See my signature.
Even you don't care about character issues, there is an option to move the download files to a destination folder, then to index it.