Page 1 of 1

AutoStart when new file in folder with Synology

Posted: 28 May 2024, 13:02
by killmort
Hello,

I would lile to know how to make filebot fully automatic on my DS218+
Actually i need to go to my DSM, open filebot, clic on "execute" when a new file is available in my "completed" folder.
I can create a task with "schedule" but it's not logic and can wait many hours.
I have found many topics about it but nothing works for me or it's too complicated for my low coding skills.

What i would like to do with your help ?

When a new file is added on my "completed" folder, autoStart Filebot. (it look easy)

Huge thanks for your future help.

Re: AutoStart when new file in folder with Synology

Posted: 28 May 2024, 13:44
by rednoah
A.
You can create a Schedule Task and then schedule that task to run every 10 minutes. That's the low-code easy solution.


:idea: A slight improvement (at the cost of basic coding) would be running light-weight find first to check if there are new files and only run heavy-weigth filebot when there actually are new files. See Run filebot command only if there are new files for details.




B.
How do I monitor a folder and call filebot on newly added files? › docker on all platforms on Linux will get you started with actually monitoring a folder for new files. Some docker and command-line expertise would be beneficial here though.

Re: AutoStart when new file in folder with Synology

Posted: 28 May 2024, 13:53
by killmort
Hello rednoah,

Thank you for the answer.

Start a task every 10min make me crazy, files are added 3 times / week, is it useful to stress my DS218+ for this ?

Does Docker need less resources to watch a folder ?

Many thanks

Re: AutoStart when new file in folder with Synology

Posted: 28 May 2024, 14:04
by rednoah
killmort wrote: 28 May 2024, 13:53 Start a task every 10min make me crazy, files are added 3 times / week, is it useful to stress my DS218+ for this ?
Yep. That's why I am suggesting to Run filebot command only if there are new files. Check every 10 min / 60 min / 360 min / etc until you find the desired trade-off between responsiveness and resource usage.


killmort wrote: 28 May 2024, 13:53 Does Docker need less resources to watch a folder ?
You'll want to run your own tests. Do keep in mind that "monitoring a folder for new files" does require something to do something at all times. The process that is mostly not doing anything will still use memory at the very least. If you use the find command once an hour to check for new files then I can guarantee that it won't use any CPU or memory most of the time as nothing is running most of the time. That said, run tests and report back. :ugeek:

Re: AutoStart when new file in folder with Synology

Posted: 28 May 2024, 14:34
by killmort
Thank you.

I'm sorry but i don't understand where to add the scripts from viewtopic.php?t=13550

I have tried to add it in Schudler but my skills are limited, can you explain for a lvl0 ? Many thanks

Re: AutoStart when new file in folder with Synology

Posted: 28 May 2024, 15:20
by rednoah
Your scheduled task currently uses this code:

Shell: Select all

filebot-node-task 0
Paste this code instead:

Shell: Select all

if find /volume1/complete -type f -size +100M -mmin -60 -print -quit | read
then
	filebot-node-task 0
fi

:idea: The 0 in filebot-node-task 0 may be a different number in your scheduled task.

:idea: /volume1/complete is the file path to to where you add files. You will have to change this to a file path that makes sense for your setup.

:idea: -mmin -60 assumes that your scheduled task is set to run once per hour. If you use a different interval then you must modify the -mmin value accordingly, otherwise the "new files" check may not always work as expected.

Re: AutoStart when new file in folder with Synology

Posted: 28 May 2024, 16:13
by killmort
Thank you for the answer.

I have applied the modifications in the schedule task but nothing happened, I have forced the execution but still nothing happened too.

Any ideas?

The script :

Shell: Select all

if find /volume1/downloads/torrentengine/completed -type f -size +100M -mmin -60 -print -quit | read
then
	filebot-node-task 3
fi
Image

Re: AutoStart when new file in folder with Synology

Posted: 28 May 2024, 16:20
by rednoah
:?: What is your test case? File path? File size? File last-modified date?


:?: What do you expect to happen?


:?: What does the output say? For debugging purposes, you can reduce your script to this, so you can see the output of the find command:

Shell: Select all

find /volume1/downloads/torrentengine/completed -type f -size +100M -mmin -60 -print

Re: AutoStart when new file in folder with Synology

Posted: 28 May 2024, 16:25
by killmort
I used Filebot to move and rename ({Plex}) for Emby.
I know it's not working because nothing is added to Emby.
I don't see any output.

Sorry if it's not very clear and my English too.

Re: AutoStart when new file in folder with Synology

Posted: 28 May 2024, 16:46
by killmort
État actuel : 1 (Interrompu)
Sortie/erreur standard :
find: `/volume1/downloads/torrentengine/completed': No such file or directory

Re: AutoStart when new file in folder with Synology

Posted: 28 May 2024, 16:56
by rednoah
No such file or directory means that the file path /volume1/downloads/torrentengine/completed does not exist.


:idea: You can do this to find all the large files and see the file paths:

Shell: Select all

find /volume1 -type f -size +100M

Re: AutoStart when new file in folder with Synology

Posted: 28 May 2024, 19:17
by killmort
Great job, the script find all files in the right folder "completed". The path wasn't correct but it's fixed now.
Can you tell me what I need to add now ?

"then
filebot-node-task 3
fi" ?


Actual script:
find /volume/TorrentEngine/downloads/completed/ -type f -size +100M
Many thanks

Re: AutoStart when new file in folder with Synology

Posted: 28 May 2024, 19:24
by killmort
Seem to be perfect with this script :

if find /volume1/TorrentEngine/downloads/completed/ -type f -size +100M |
read
then
filebot-node-task 4
fi

Answer:

Parameter: excludeLink = y
Parameter: artwork = y
Parameter: clean = y
Parameter: deleteAfterExtract = y
Parameter: minLengthMS = 0
Parameter: emby = *****
Parameter: seriesFormat = {plex}
Parameter: animeFormat = {plex}
Parameter: movieFormat = {plex}
Parameter: musicFormat = {plex}
Parameter: excludeList = .excludes
Argument[0]: /volume1/TorrentEngine/downloads/completed
Use excludes: /volume1/VideoClub/.excludes (28)
No files selected for processing
Done ¯\_(ツ)_/¯

Re: AutoStart when new file in folder with Synology

Posted: 28 May 2024, 19:27
by killmort
I suppose the folder need to be empty to perfectly working?

Thanks

Re: AutoStart when new file in folder with Synology

Posted: 28 May 2024, 20:21
by rednoah
e.g.

Shell: Select all

if find /volume1/TorrentEngine/downloads/completed -type f -size +100M -mmin -60 -print -quit | read
then
	filebot-node-task 4
fi
The -mmin -60 bit is the whole point of the exercise. Check if there's a recently modified file, within the last 60 minutes, and then call filebot if so. Run this task every 60 minutes. Every 60 minutes we find that there is no file modified in the last 60 minutes, and thus skip the filebot call.

Re: AutoStart when new file in folder with Synology

Posted: 29 May 2024, 16:59
by killmort
Dear Rednoah,
I would like to thank you, it working well.
Many thanks