Page 1 of 1

Synology NAS full auto

Posted: 21 Mar 2013, 16:45
by robwiel
Hi, is there a way to have this: (watcher script or any substitute like amc) running single-handedly on Synology NAS (DS212+) without having to ssh and put it into console window (i.e. accessing it through Win7)?
Once I close ssh window in Win7, script stops.

Code: Select all

filebot -script fn:watcher -extract -get-subtitles -rename --db TVRage "/volume1/Files/Downloads/bit/TV Shows" --format "{n}/Season {s.pad(2)}/{n}.{s00e00}.{t}" --lang EN --log all --encoding UTF-8 --conflict skip -non-strict --output "/volume1/Files/Media/Video/TV Shows"
regards

Re: Synology NAS full auto

Posted: 21 Mar 2013, 16:57
by rednoah
Linux 101: nohup
http://en.wikipedia.org/wiki/Nohup

Also here's how to control remote machines via ssh and FileBot scripting:

Code: Select all

include('fn:lib/ant')
sshexec(host:'example.com', username:'duke', password:'duke', command:'''whoami && hostname''')
Though full-auto would be more something like connecting your torrent client and whatnot to run amc on completed downloads or schedule a cronjob.

Re: Synology NAS full auto

Posted: 21 Mar 2013, 20:30
by robwiel
Synology does have download station which is enough for me (when it works).
Thanks for help I tried those 2 solutions (first I just run from "/volume1/Files/Media/Video/TV Shows" folder)

Code: Select all

nohup filebot -script fn:watcher -extract -get-subtitles -rename --db TVRage "/volume1/Files/Downloads/bit/TV Shows" --format "{n}/Season {s.pad(2)}/{n}.{s00e00}.{t}" --lang EN --log all --encoding UTF-8 --conflict skip -non-strict --output "/volume1/Files/Media/Video/TV Shows"

Code: Select all

nohup filebot -script fn:watcher -extract -get-subtitles -rename --db TVRage "/volume1/Files/Downloads/bit/TV Shows" --format "{n}/Season {s.pad(2)}/{n}.{s00e00}.{t}" --lang EN --log all --encoding UTF-8 --conflict skip -non-strict --output "/volume1/Files/Media/Video/TV Shows" > /volume1/Files/filebot/output.txt
contents of nohup.out in both cases

Code: Select all

Waiting for events
NullPointerException: Cannot invoke method readLine() on null object
java.lang.NullPointerException: Cannot invoke method readLine() on null object
	at Script3.run(Script3.groovy:22)
	at net.sourceforge.filebot.cli.ScriptShell.evaluate(Unknown Source)
	at net.sourceforge.filebot.cli.ScriptShell.runScript(Unknown Source)
	at net.sourceforge.filebot.cli.ArgumentProcessor.process(Unknown Source)
	at net.sourceforge.filebot.Main.main(Unknown Source)
Failure (°_°)

Re: Synology NAS full auto

Posted: 22 Mar 2013, 03:10
by rednoah
Ah, it doesn't get a console. Well, by default it's console interactive.

Replace the last line:

Code: Select all

console.readLine() // keep running and watch for changes
Replace with:

Code: Select all

sleep(Long.MAX_VALUE)

Re: Synology NAS full auto

Posted: 22 Mar 2013, 17:30
by robwiel
Thanks for quick reply

I placed changed watcher_imp.groovy in correct folder and used that code

Code: Select all

nohup filebot -script "/volume1/Files/filebot/watcher_imp.groovy" -extract -get-subtitles -rename --db TVRage "/volume1/Files/Downloads/bit/TV Shows" --format "{n}/Season {s.pad(2)}/{n}.{s00e00}.{t}" --lang EN --log all --encoding UTF-8 --conflict skip -non-strict --output "/volume1/Files/Media/Video/TV Shows" > /volume1/Files/filebot/output.txt
My 3 episodes test sample did not work for Park Avenue at first time, but did work for remainder of files. And on 2nd attempt on first file.

BUT when I close putty window this just stops working. Any further ideas?

Code: Select all

Waiting for events
Get [English] subtitles for 1 files
No matching subtitles found: /volume1/Files/Downloads/bit/TV Shows/666 Park Avenue.S01E12 dasdas.avi
Rename episodes using [TVRage]
Auto-detected query: [666 Park Avenue, Park Avenue]
[Fatal Error] :1:1: Content is not allowed in prolog.
Fetching episode data for [666 Park Avenue]
Mar 22, 2013 6:17:23 PM net.sourceforge.filebot.web.Date parse
WARNING: Unparseable date: "0000-00-00"
Mar 22, 2013 6:17:23 PM net.sourceforge.filebot.web.Date parse
WARNING: Unparseable date: "0000-00-00"
Mar 22, 2013 6:17:23 PM net.sourceforge.filebot.web.Date parse
WARNING: Unparseable date: "0000-00-00"
Mar 22, 2013 6:17:23 PM net.sourceforge.filebot.web.Date parse
WARNING: Unparseable date: "0000-00-00"
Fetching episode data for [79 Park Avenue]
ExecutionException: org.xml.sax.SAXParseException; lineNumber: 1; columnNumber: 1; Content is not allowed in prolog.
Get [English] subtitles for 1 files
No matching subtitles found: /volume1/Files/Downloads/bit/TV Shows/Anger Management.S01E01.mp4
Rename episodes using [TVRage]
Auto-detected query: [Anger Management]
Fetching episode data for [Anger Management]
[MOVE] Rename [/volume1/Files/Downloads/bit/TV Shows/Anger Management.S01E01.mp4] to [/volume1/Files/Media/Video/TV Shows/Anger Management/Season 01/Anger Management.S01E01.Charlie Goes Back to Therapy.mp4]
Processed 1 files
Get [English] subtitles for 1 files
No matching subtitles found: /volume1/Files/Downloads/bit/TV Shows/American Horror Story.S02E02.mkv
Rename episodes using [TVRage]
Auto-detected query: [American Horror Story]
Fetching episode data for [American Horror Story]
[MOVE] Rename [/volume1/Files/Downloads/bit/TV Shows/American Horror Story.S02E02.mkv] to [/volume1/Files/Media/Video/TV Shows/American Horror Story/Season 02/American Horror Story.S02E02.Tricks And Treats.mkv]
Processed 1 files
Get [English] subtitles for 1 files
No matching subtitles found: /volume1/Files/Downloads/bit/TV Shows/666 Park Avenue.S01E12.avi
Rename episodes using [TVRage]
Auto-detected query: [666 Park Avenue, Park Avenue]
Fetching episode data for [666 Park Avenue]
Fetching episode data for [79 Park Avenue]
Fetching episode data for [79 Park Avenue]
Fetching episode data for [666 Park Avenue]
[MOVE] Rename [/volume1/Files/Downloads/bit/TV Shows/666 Park Avenue.S01E12.avi] to [/volume1/Files/Media/Video/TV Shows/666 Park Avenue/Season 01/666 Park Avenue.S01E12.The Elysian Fields.avi]
Processed 1 files

Re: Synology NAS full auto

Posted: 22 Mar 2013, 17:44
by rednoah
Maybe by using a screen session it'll keep the process alive even after the parent terminal has terminated?
http://www.thegeekstuff.com/2010/07/scr ... -examples/

Re: Synology NAS full auto

Posted: 22 Mar 2013, 18:01
by robwiel
Will try that, used "&" at and of my line to put process in background

Code: Select all

nohup filebot -script "/volume1/Files/filebot/watcher_imp.groovy" -extract -get-subtitles -rename --db TVRage "/volume1/Files/Downloads/bit/TV Shows" --format "{n}/Season {s.pad(2)}/{n}.{s00e00}.{t}" --lang EN --log all --encoding UTF-8 --conflict skip -non-strict --output "/volume1/Files/Media/Video/TV Shows" > /volume1/Files/filebot/output.txt &
Tried to "disown -h" but unfortunately this command does not exist.

Tried screen, command does not exist.

Maybe thats case of putty issues, will try different terminal.

Re: Synology NAS full auto

Posted: 22 Mar 2013, 18:04
by rednoah
Yeah, the termianl seems to send a kill signal to all process it spawned on disconnect... check with they synology people, i'm sure there's an easy solution for getting this working.

Re: Synology NAS full auto

Posted: 22 Mar 2013, 18:26
by rednoah
Still why not have your download programs call filebot? Like amc with the utorrent/deluge/transmission integration. It's just cmdline. You can probably set it up with any download manager / bt client / etc

Re: Synology NAS full auto

Posted: 23 Mar 2013, 13:16
by robwiel
I have fully automated windows machine that can do all that.
It just doesnt make sense to have it running at all when I am not home, when 20watt diskstation can do all that for me.

Re: Synology NAS full auto

Posted: 23 Mar 2013, 13:23
by rednoah
Makes sense. I'm sure transmission or deluge or rtorrent run well on synology, and you can configure it to run filebot/amc.

Re: Synology NAS full auto

Posted: 24 Mar 2013, 15:07
by robwiel
Installed "screen", all works!! tyvm. screen => command => ctrl-A, d=>close putty

I'll put that screen command somewhere in "autoexec" after each server reboot. (when I find it).

Fantastic :)