Page 1 of 1

Post process scripting on Synology

Posted: September 4th, 2009, 3:50 pm
by TheW0ndaKid
Hi All,

I have SABnzbd running on a Synology Diskstation and am looking for a little help with a post processing script. On a diskstation there is a binary file (synoindex) that can be used to update the uPnP database, if I copied the files to the NAS normally this process would run and update the uPnP database. However because the SABnzbd process moves them directly to the disk the process doesn't run.

The usage for synoindex is described below:

    Add:    synoindex -a filename
    Delete: synoindex -d filename
    Add folder:    synoindex -A folder
    Delete folder: synoindex -D folder
    Rename/move file/folder:  synoindex -N newfullpath oldfullpath
    Update Photo Images:  synoindex -U photo
    Get from DB:        synoindex -g filename -t [video|music|photo|playlist]

So I guess what I'm after is something to run /user/syno/bin/synoindex -a

I have plenty of experience with vbscript in windows but have no idea where to start with a post processing script running on linux

Re: Post process scripting on Synology

Posted: September 5th, 2009, 10:37 am
by TheW0ndaKid
Hey all,

think I've got a bit further with this. If I create a script with the below

/user/syno/bin/synoindex -A $1

This should add the directory to the uPnP database

Does anyone have any idea if this would actually work?

Re: Post process scripting on Synology

Posted: September 6th, 2009, 4:40 am
by TheW0ndaKid
Thanks PoD,

I did run it on its own, just to check it worked. Unfortunatly I left the "%1" in rather than replacing it with a folder name. My DiskStation is now trying to index everything it can see (including all the sys and usr stuff)!! Its been running for about 12 hours and hasn't finished yet, have a call logged with Synology. Just a word of warning to anyone else who is looking for this.

I notice your script doesn't include double quotes around the variable, if I remove mine what will happen if the folder path includes spaces? Also what does the bin/bash bit at the top do? I know its a probably got a really simple answer but I'm just trying to avoid breaking the NAS box (again!) ;)

Re: Post process scripting on Synology

Posted: September 6th, 2009, 4:25 pm
by shypike
On Windows, the parameters are passed with the quotes (so you don't need to add them in your script).
On Linux and OSX, the parameters do not have quotes, so your script needs to add them.

This difference is caused by the Python run-time library, we cannot fix this issue.
(Python is the programming language we use).

Re: Post process scripting on Synology

Posted: September 7th, 2009, 2:39 pm
by TheW0ndaKid
Thanks shypike,

If my NAS ever manages to finish indexing itself I'll use the below.

-----------------------------------------
#!/bin/bash

/user/syno/bin/synoindex -A "$1"
-----------------------------------------

thanks everyone.

Re: Post process scripting on Synology

Posted: October 1st, 2009, 10:42 am
by yosh
Hello,

i've the same problem. Does your last script is working ? Can you tel me the exact procedure to set it on my NAS ? (where i should copy it, how etc...) Thank you !!

Re: Post process scripting on Synology

Posted: July 26th, 2011, 4:20 pm
by starsys
Hello. I really need this cool script. Can anyone help me to make it work with the last version of sabnzbd ?
What is the syntax ? How should I rename the script file ? Thanks a lot in advance.