AutoStart when new file in folder with Synology

Support for Synology NAS, QNAP NAS and other Embedded Linux systems
Post Reply
killmort
Posts: 12
Joined: 09 Sep 2020, 09:28

AutoStart when new file in folder with Synology

Post 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.
User avatar
rednoah
The Source
Posts: 23962
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: AutoStart when new file in folder with Synology

Post 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.
:idea: Please read the FAQ and How to Request Help.
killmort
Posts: 12
Joined: 09 Sep 2020, 09:28

Re: AutoStart when new file in folder with Synology

Post 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
User avatar
rednoah
The Source
Posts: 23962
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: AutoStart when new file in folder with Synology

Post 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:
:idea: Please read the FAQ and How to Request Help.
killmort
Posts: 12
Joined: 09 Sep 2020, 09:28

Re: AutoStart when new file in folder with Synology

Post 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
User avatar
rednoah
The Source
Posts: 23962
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: AutoStart when new file in folder with Synology

Post 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.
:idea: Please read the FAQ and How to Request Help.
killmort
Posts: 12
Joined: 09 Sep 2020, 09:28

Re: AutoStart when new file in folder with Synology

Post 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
User avatar
rednoah
The Source
Posts: 23962
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: AutoStart when new file in folder with Synology

Post 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
:idea: Please read the FAQ and How to Request Help.
killmort
Posts: 12
Joined: 09 Sep 2020, 09:28

Re: AutoStart when new file in folder with Synology

Post 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.
killmort
Posts: 12
Joined: 09 Sep 2020, 09:28

Re: AutoStart when new file in folder with Synology

Post by killmort »

État actuel : 1 (Interrompu)
Sortie/erreur standard :
find: `/volume1/downloads/torrentengine/completed': No such file or directory
User avatar
rednoah
The Source
Posts: 23962
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: AutoStart when new file in folder with Synology

Post 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
:idea: Please read the FAQ and How to Request Help.
killmort
Posts: 12
Joined: 09 Sep 2020, 09:28

Re: AutoStart when new file in folder with Synology

Post 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
killmort
Posts: 12
Joined: 09 Sep 2020, 09:28

Re: AutoStart when new file in folder with Synology

Post 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 ¯\_(ツ)_/¯
killmort
Posts: 12
Joined: 09 Sep 2020, 09:28

Re: AutoStart when new file in folder with Synology

Post by killmort »

I suppose the folder need to be empty to perfectly working?

Thanks
User avatar
rednoah
The Source
Posts: 23962
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: AutoStart when new file in folder with Synology

Post 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.
:idea: Please read the FAQ and How to Request Help.
killmort
Posts: 12
Joined: 09 Sep 2020, 09:28

Re: AutoStart when new file in folder with Synology

Post by killmort »

Dear Rednoah,
I would like to thank you, it working well.
Many thanks
Post Reply