Automation Issue on Synology

Running FileBot from the console, Groovy scripting, shell scripts, etc
Post Reply
User avatar
rednoah
The Source
Posts: 23953
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: Automation Issue on Synology

Post by rednoah »

1.
Running heavy programs like FileBot every 10 minutes is a very bad idea. A single run will probably take more than 10 minutes already. I recommend once per day at 4am.


2.
Where are the logs that show filebot failing to copy files?
viewtopic.php?f=6&t=1868


3.
FileBot cannot tell what other processes are doing, but as long as the files don't have a video extension they won't be processed. Most tools use a temporary name (e.g. xyz.upload) when uploading files and only move/rename to the final destination when upload is complete. In this case files will be ignore by merit of file extension, but you could also use a --def ignore pattern.
:idea: Please read the FAQ and How to Request Help.
User avatar
rednoah
The Source
Posts: 23953
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: Automation Issue on Synology

Post by rednoah »

Best to do a find | xargs | filebot amc and have find only pass along files that haven't been modified for x hours.
:idea: Please read the FAQ and How to Request Help.
User avatar
rednoah
The Source
Posts: 23953
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: Automation Issue on Synology

Post by rednoah »

Haha, don't they teach shell fu anymore? :D


List files last-modified more than one hour ago, and less than 7 days ago:

Code: Select all

find /path/to/files -type f -mmin +60 -mtime -7
Take all these files and pass them on to another command-line tool:

Code: Select all

find /path/to/files -type f -mmin +60 -mtime -7 -print0 | xargs -0 filebot -script fn:sysenv

@see http://stackoverflow.com/questions/5439 ... our/543951
:idea: Please read the FAQ and How to Request Help.
User avatar
rednoah
The Source
Posts: 23953
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: Automation Issue on Synology

Post by rednoah »

Didn't I already give you a complete solution?

You'll just need to slightly modify it for your input folder and your amc command:

Code: Select all

find /volume1/EpisodesTEMP -type f -mmin +60 -mtime -7 -print0 | xargs -0 filebot -script 'fn:amc' --output /volume1/Episodes --action copy -non-strict --conflict auto --lang en --def 'ut_label=tv' 'music=y' 'unsorted=y' 'clean=y' 'deleteAfterExtract=y' 'minFileSize=100000000' 'seriesFormat={n}/Season {s.pad(2)}/{n} - {s.pad(2)+'\''x'\''}{episodes*.episode*.pad(2).join("-")} - {t}' --log info --log-file '/volume1/@appstore/filebot-node/filebot.log' >> '/volume1/@appstore/filebot-node/log/1456364210329.log' 2>&1
(copy & paste, untested)
:idea: Please read the FAQ and How to Request Help.
User avatar
rednoah
The Source
Posts: 23953
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: Automation Issue on Synology

Post by rednoah »

This line tells me with absolute certainty that that you fail at copy & paste:

Code: Select all

Argument: /volume1/EpisodesTEMP
If xargs was used, then you'd get lots of arguments for each input file:

Code: Select all

find /volume1/EpisodesTEMP -type f -mmin +60 -mtime -7 -print0 | xargs -0 filebot -script fn:amc
The output above tells me that you still use your old command that looks like this:

Code: Select all

filebot -script fn:amc /volume1/EpisodesTEMP
:idea: Please read the FAQ and How to Request Help.
User avatar
rednoah
The Source
Posts: 23953
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: Automation Issue on Synology

Post by rednoah »

Alternatively, you can click the Donate button and donate your way out of purgatory. ;)
:idea: Please read the FAQ and How to Request Help.
User avatar
rednoah
The Source
Posts: 23953
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: Automation Issue on Synology

Post by rednoah »

This command can lead 0 files:

Code: Select all

find /volume1/EpisodesTEMP -type f -mmin +60 -mtime -7
So the amc script will complain about not getting any arguments. The amc script doesn't know that 0 files is exactly what you want in this case, so it'll give you a noob warning anyway. You may ignore that warning. It'll work if there are files to be processed.

You can probably fine-tune your command-line to only call filebot if there are in fact any files to be processed. That will be your homework:

Code: Select all

BusyBox v1.16.1 (2015-10-28 13:24:11 CST) multi-call binary.

Usage: xargs [OPTIONS] [PROG ARGS]

Run PROG on every item given by stdin

Options:
	-p	Ask user whether to run each command
	-r	Don't run command if input is empty
	-0	Input is separated by NUL characters
	-t	Print the command on stderr before execution
	-e[STR]	STR stops input processing
	-n N	Pass no more than N args to PROG
	-s N	Pass command line of no more than N bytes
	-x	Exit if size is exceeded
:idea: Please read the FAQ and How to Request Help.
User avatar
rednoah
The Source
Posts: 23953
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: Automation Issue on Synology

Post by rednoah »

Well, by doing xargs -0 -r filebot ... you could save your NAS a lot of time and energy booting up java/filebot/groovy/amc for just doing nothing. ;)


EDIT:


filebot script doing nothing:

Code: Select all

time find /nothing -print0 | xargs -0 filebot -script "g:println now"
find: /nothing: No such file or directory
Sun Feb 28 00:08:29 GMT+08:00 2016
Done ヾ(@⌒ー⌒@)ノ


real	0m13.250s
user	0m11.170s
sys	0m1.820s

sh doing nothing:

Code: Select all

time find /nothing -print0 | xargs -0 -r filebot -script "g:println now"
find: /nothing: No such file or directory

real	0m0.009s
user	0m0.000s
sys	0m0.000s
Since this way of doing nothing is 1472x faster I think it's worth spending 5 seconds on adding the -r option. :lol:
:idea: Please read the FAQ and How to Request Help.
User avatar
rednoah
The Source
Posts: 23953
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: Automation Issue on Synology

Post by rednoah »

1.
what if I wanted to leave it in the EpisodesTEMP folder?
Why would you?


2.
Note that if you call this script in intervals every hour or every day you must set --def excludeList or you will get banned.
If you would, then this becomes a much more pressing concern. Although, you should set excludeList either way just in case you didn't think of everything
:idea: Please read the FAQ and How to Request Help.
User avatar
rednoah
The Source
Posts: 23953
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: Automation Issue on Synology

Post by rednoah »

1.
That's what the unsorted folder is for. Whatever is in the unsorted folder is for you to handle yourself.


2.
Banned from whatever data source is hit repeatedly with the same queries over and over. FileBot API, TheTVDB API, TheMovieDB API, etc.


Just add it and don't worry about it:

Code: Select all

--def excludeList=amc.txt
:idea: Please read the FAQ and How to Request Help.
Post Reply