Watches directory to trigger handbrake container.
391
Written in GoLang.
This script is my first attempt at writing anything in Go. It simply monitors a directory for new files to be added.
When a new file is added it is added to a queue. The Code does it's own polling based on the filesize to know when it has finished being added to the folder.
There is no error correction on the file types added to the directory.
The container relies on /watch and /queue to be mounted in order to work. The /queue directory must be the same one the handbrake container has mounted.
The container is expected to be ran on a docker swarm cluster. Jaas will launch a one-time use container for each file that gets uploaded to the directory.
At start up, a list of current files in /watch will be added to the queue
Command to Execute:
docker service create -e QUEUE=/mnt/Queue/ -e PROCESSED=/mnt/Movies/Processed/ -e OUTPUT=/mnt/Movies/Output/ --mount type=bind,src=/mnt/Movies/Watch/,dst=/watch --mount type=bind,src=/mnt/Queue/,dst=/queue --mount type=bind,src=/var/run/docker.sock,dst=/var/run/docker.sock --name WATCHER --constraint 'node.role == manager' niget2002/handbrakewatcher
Content type
Image
Digest
Size
338.2 MB
Last updated
almost 7 years ago
docker pull niget2002/handbrakewatcher