Custom code on folder action

Here ist what i have so far. Nextlcoud and minidlna are installed on the same machine. minidlna is scanning some Nextcloud directories which are defined in /etc/minidlna.conf.
I am about to write a python program which lets me add and remove folders from /etc/minidlna.conf. How would it be possible to extend the context menu of a nextcloud folder by an entry “remove/add to minidlna” and run this custom script. Ist there an app for somthing like this.
Any hints are highly appreciated.
Jan Niklas