[docker] Get FileBot great AGAIN!

Support for Synology NAS, QNAP NAS and other Embedded Linux systems
Post Reply
droidbot
Posts: 4
Joined: 20 Dec 2021, 12:19

[docker] Get FileBot great AGAIN!

Post by droidbot »

Hi folks,

I'm sitting for HOURS to get filebot working with JDownloader and I'm really upset. I need help, please!

JDownloader works + Eventscript works (docker)
FileBot works (Synology package file)

JDownloader runs script --> File not found error for "/var/packages/filebot/target/bin/filebot". Is this because docker container can't run scripts/programms from outside???

My script:

Code: Select all

#!/bin/sh
##FileBot benötigt diese Variablen
# mkdir /opt/JDownloader/Downloads/videos/
LOG="/volume1/docker/jdownloader/scripts/amc.log"
EXC="/volume1/docker/jdownloader/scripts/amc.txt"
ANIME="/volume1/Downloads/UNSORTIERT/{n}/{s00}/{n} {s00e00} - {t}"
SERIEN="/volume1/TV-Serien/{n}/Staffel {s}/{n} {s00e00} - {t}"
FILME="/volume1/Filme/{n}/{n} ({y}) [{rating}]"

### Wenn Filebot mal etwas nicht zuordnen kann, 
##  dann kannst du es in einen seperaten Ordner verschieben lassen, 
##  dann bleibt es im Downloadordner übersichtlich.
UNSORTIERT="/volume1/Downloads/UNSORTIERT/{file.structurePathTail}" 

## FileBot ausführen
/var/packages/filebot/target/bin/filebot -script /volume1/docker/jdownloader/scripts/amc.groovy --lang de --log-file $LOG --action move "$1" --def "seriesFormat=$SERIEN" "movieFormat=$FILME" "animeFormat=$ANIME" "unsortedFormat=$UNSORTIERT" -non-strict --def unsorted=y "artwork=n" --def clean=y --output "/volume1/docker/jdownloader/Sonstiges"


## Aufräumen, --def root löscht den Unterordner mit
/var/packages/filebot/target/bin/filebot -script fn:cleaner "$1" --def root=y
Next thing:
I assume what I tried above won't work because of some docker container bullsh**. Therefore I read about this FileBot-Watcher container which should also solve my problem of having automated sorted media files.

I tried:
sudo docker run --rm --name FileBot-Watcher -it -v /volume1/Downloads/COMPLETE:/volume1 -v /volume1/docker/FileBot-Watcher/:/data rednoah/filebot:watcher /volume1/Downloads --output /volume1/output

and get

Couldn't watch /volume1/Downloads: Permission denied ?? even with sudo

What I'm doing wrong :?:
User avatar
rednoah
The Source
Posts: 22923
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: Get FileBot great AGAIN!

Post by rednoah »

droidbot wrote: 20 Dec 2021, 12:51 Is this because docker container can't run scripts/programms from outside???
That is indeed how docker works. You can imagine a docker container as if it was a separate physical machine. They can only communicate via network connections.

TL;DR what you're trying to do here isn't possible by design; so you're gonna hit a hard wall there.



droidbot wrote: 20 Dec 2021, 12:51 sudo docker run --rm --name FileBot-Watcher -it -v /volume1/Downloads/COMPLETE:/volume1 -v /volume1/docker/FileBot-Watcher/:/data rednoah/filebot:watcher /volume1/Downloads --output /volume1/output
You're running the docker command with sudo. But the command running inside the docker container is running in a completely separate (think separate physical machine) environment, with it's own users, groups, etc.

:arrow: You can use the PUID and PGID environment variables to run the process inside the docker container as a different user. Please read the filebot docker container documentation for details.

:arrow: FAQ :: How to do I run the process inside the container as a different user?
:idea: Please read the FAQ and How to Request Help.
droidbot
Posts: 4
Joined: 20 Dec 2021, 12:19

Re: Get FileBot great AGAIN!

Post by droidbot »

@rednoah thank you for helping :D . PUID and PGID are already set to 1000 nothing changed.
But could you help me to understand what the variables are used for in the filebot-watcher?

Code: Select all

docker run --rm -it -v $PWD:/volume1 -v data:/data rednoah/filebot:watcher /volume1/input --output /volume1/output
I don't quite understand where to put my paths/variables.

My download path is: /volume1/Downloads
My "look there is something new here" path is: /volume1/Downloads/COMPLETE
My FileBot-Watcher docker path is: /volume1/docker/FileBot-Watcher
My Media paths are: /volume1/Movies and /volume1/Series

So in that case my docker run command should look like this:

Code: Select all

docker run --rm -it -v $PWD:/volume1 -v /volume1/docker/FileBot-Watcher/data:/data rednoah/filebot:watcher /volume1/Downloads/COMPLETE --output /volume1/output
I don't understand how to handle with "$PWD:/volume1" and with "--output /volume1/output" since I have two outputs.
User avatar
rednoah
The Source
Posts: 22923
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: Get FileBot great AGAIN!

Post by rednoah »

You'll want to do -v /volume1:/volume1 so that the /volume1 folder inside your docker container maps to the /volume1 folder on your host. You'll want to have a dedicated output folder, e.g. /volume1/Media, and then stick with the default naming from there.


:idea: Note that you are effectively using the amc script, within a docker container, called by the watcher shell script. Reading the manual may be helpful.


:idea: $PWD is a shell variable for the current working directory. Call echo "$PWD" so see what you've been passing along up until now.
:idea: Please read the FAQ and How to Request Help.
droidbot
Posts: 4
Joined: 20 Dec 2021, 12:19

Re: Get FileBot great AGAIN!

Post by droidbot »

I've just bought filebot yesterday. I never thought that this is that hard to get filebot-watch running. I've got running filebot at all on docker and many other softwares, but this is way too minimalistic in its instruction which variable how to use etc.

Is there a way to get my money back? I would save a lot more time by doing this by hand instead of trying to get this automated for over 10 hours.
User avatar
rednoah
The Source
Posts: 22923
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: Get FileBot great AGAIN!

Post by rednoah »

Well, sounds like you're primarily struggling with docker, combining functionality from different docker containers, which is understandable since docker by nature makes this kind of use case hard to impossible.

You seem to be set on using docker, but docker really isn't a good fit for what you're trying to do, unless you build your own container with both JD and FileBot baked into the same image...


Here's how I'd go about it:

1. Install FileBot and FileBot Node normally on the host:
viewtopic.php?t=1802

2. Use FileBot Node WebUI to set up an automated task and have Synology Task Scheduler call it every now and then:
viewtopic.php?t=2733


:arrow: Takes 2 min. Maybe 20 min the first time around, if you do a few test runs to play with the various options.
:idea: Please read the FAQ and How to Request Help.
droidbot
Posts: 4
Joined: 20 Dec 2021, 12:19

Re: Get FileBot great AGAIN!

Post by droidbot »

File node works, everything tested. But my media files are separated:
Movies: /volume1/Movies
Series: /volume1/Series

But I can only choose one output folder? Do I have to put my media files into /volume1/Media/ (Movies and Series)
Or can I run a specific script?
User avatar
rednoah
The Source
Posts: 22923
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: Get FileBot great AGAIN!

Post by rednoah »

A.
The easy solution is to stick to the defaults. Have a /volume1/Media share and then stick to the default folders FileBot creates for you there.




B.
If you're very attached to your /volume1/Series folder, then you can use a custom naming scheme:
https://www.filebot.net/naming.html


Since you're using the amc script script, there are different naming schemes for different types of content, and the {plex} format is used for all of them by default:
rednoah wrote: 01 Aug 2012, 13:04 Change how files will be organized and renamed:
This script uses multiple format expressions, so the simple --format option is not supported. You can override the default naming schemes via the --def movieFormat, seriesFormat, animeFormat and musicFormat options. Relative paths will be resolved against --output and you can use absolute paths if you want to use multiple drives.

Code: Select all

--def movieFormat="M:/{plex}" seriesFormat="S:/{plex}" animeFormat="T:/{plex}" musicFormat="U:/{plex}"
  • Start with the {plex} format and then modify your custom format bit by bit to fit your needs.
  • Use @file syntax to read complex arguments from a text file.
rednoah wrote: 12 Sep 2016, 10:03 Since the {plex} binding will give you a File object, it's easy to reuse some path components and omit others. {plex.name} and {plex.tail} are particularly useful if you want to rename files in place or if you want the {plex} path without the top-level Movies or TV Shows folder.

e.g. Avatar (2009)

Code: Select all

{ plex.name }
e.g. Firefly/Season 01/Firefly - S01E01 - Serenity

Code: Select all

{ plex.tail }

e.g.

Code: Select all

--def movieFormat="/volume1/Movies/{ plex.tail }" seriesFormat="/volume1/Series/{ plex.tail }"
:arrow: The FileBot Node WebUI has corresponding input fields named Movie Format and Series Format that you can fill out to pass your custom formats along to the amc script call.

:!: Note that --output must still point to a valid writable folder somewhere, even if you happen not to use it as relative base for custom formats.
:idea: Please read the FAQ and How to Request Help.
Post Reply