docker filebot-watcher filebot-node

Running FileBot from the console, Groovy scripting, shell scripts, etc
Post Reply
User avatar
mrbucket101
Power User
Posts: 36
Joined: 02 Jul 2014, 00:25

docker filebot-watcher filebot-node

Post by mrbucket101 »

I have rTorrent+ruTorrent+autodl-irssi setup in a docker container. Until I can figure out a way to create my own container, or modify the existing container. I figured I would setup filebot-watcher to watch a specific folder when downloads were completed. I have ruTorrent unpacking into a filebot monitor folder. The problem I seem to be running into is that if I am extracting a large file, filebot does not pickup the change, and marks the file as modified in the log.

Here is the command I used to create my docker container

Code: Select all

docker run -it --name=filebot -v /home/xxxx/Downloads/filebot:/watch -v /home/xxxx/Share/:/Share -v /home/xxxx/.filebot:/data rednoah/filebot:watcher /watch --output /Share --log-file /data/logs/amc.log --action move --conflict auto -non-strict --def @/data/args.txt
Here is the output from the containers log.

Code: Select all

Setting up watches.
Watches established.
Modified: /watch/the.dark.tower.2017.1080p.bluray.x264-drones.mkv
I have tested this method using smaller files, and they don't seem to have an issue. It's when I have large files that take a minute or so to extract.

args.txt

Code: Select all

music=n
excludeList=/data/amc_exclude.txt
clean=y
artwork=n
extras=n
unsorted=y
pushover=XXXXXXXX
subtitles=en
musicFormat=Music/{n}/{album+'/'}{pi.pad(2)+' - '}{artist} - {t}
seriesFormat=TV/{plex.tail}
movieFormat={plex}
Last edited by mrbucket101 on 23 Oct 2017, 17:14, edited 1 time in total.
User avatar
mrbucket101
Power User
Posts: 36
Joined: 02 Jul 2014, 00:25

Re: docker filebot-watcher filebot-node

Post by mrbucket101 »

I decided to switch up my tactics a bit.

I noticed that the rTorrent docker container I am using contained curl. So I setup filebot-node and I am trying to test generating requests from rTorrent docker to the filebot docker via curl

Code: Select all

docker run -it --name=filebot-node -e PUID=1000 -e PGID=1000 -v /home/XXXX/Downloads:/Downloads -v /home/XXXX/Share:/Share -v /home/XXXX/.filebot:/data -p 5452:5452 rednoah/filebot:node
I executed a request from the webui and saw this in the log

Code: Select all

Mon Oct 23 2017 16:41:54 GMT+0000 (UTC)
GET: /tasks
------------------------------------------
Mon Oct 23 2017 16:41:55 GMT+0000 (UTC)
GET: /execute?_dc=1508776915700&fn=amc&input=%2FDownloads%2FTV%2FVice.Principals.S02E06.720p.WEB.H264-STRiFE&label=tv&action=copy&output=%2FShare&filter=&subtitles=eng&lang=en&conflict=auto&music=no&unsorted=no&ignore=&minLengthMS=&minFileSize=&excludeList=%2Fdata%2Famc_exclude.txt&movieFormat=%7Bplex%7D&seriesFormat=TV%2F%7Bplex.tail%7D&animeFormat=%7Bplex%7D&musicFormat=%7Bplex%7D&unsortedFormat=&exec=&plex=&kodi=&pushover=XXXXXX&pushbullet=&channel=fn&log=all
------------------------------------------
Mon Oct 23 2017 16:41:55 GMT+0000 (UTC)
GET: /tasks
------------------------------------------
I know that _dc is the unix time stamp, but I figured that was an optional parameter.

In order to test if my plan would work I ran this command in a regular terminal window

Code: Select all

curl "127.0.0.1:5452/filebot/execute?fn=amc&input=%2FDownloads%2FTV%2FVice.Principals.S02E06.720p.WEB.H264-STRiFE&label=tv&action=copy&output=%2FShare&filter=&subtitles=eng&lang=en&conflict=auto&music=no&unsorted=no&ignore=&minLengthMS=&minFileSize=&excludeList=%2Fdata%2Famc_exclude.txt&movieFormat=%7Bplex%7D&seriesFormat=TV%2F%7Bplex.tail%7D&animeFormat=%7Bplex%7D&musicFormat=%7Bplex%7D&unsortedFormat=&exec=&plex=&kodi=&pushover=XXXXXX&pushbullet=&channel=fn&log=all"
When looking at the log afterwards , this is what I see, however nothing seems to happen. My excludes file is empty, so I'm not sure what is happening. The webui also doesn't update when doing this, but I didn't expect it to really.

Code: Select all

Mon Oct 23 2017 16:56:04 GMT+0000 (UTC)
GET: /filebot/execute?fn=amc&input=%2FDownloads%2FTV%2FVice.Principals.S02E06.720p.WEB.H264-STRiFE&label=tv&action=copy&output=%2FShare&filter=&subtitles=eng&lang=en&conflict=auto&music=no&unsorted=no&ignore=&minLengthMS=&minFileSize=&excludeList=%2Fdata%2Famc_exclude.txt&movieFormat=%7Bplex%7D&seriesFormat=TV%2F%7Bplex.tail%7D&animeFormat=%7Bplex%7D&musicFormat=%7Bplex%7D&unsortedFormat=&exec=&plex=&kodi=&pushover=XXXXXX&pushbullet=&channel=fn&log=all
User avatar
rednoah
The Source
Posts: 22923
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: docker filebot-watcher filebot-node

Post by rednoah »

The filebot-node web application is sending HTTP requests to the filebot-node service. By using curl, you can pretend to be the web application sending requests and the filebot-node service wouldn't know the difference.

So why is it not working? I have no idea. You can use the developer console in your browser to check exactly what requests are sent, and then recreate them with curl. If you manage to send a request to filebot-node service, then you will get a response. Reading the response will help you find out what's not working.

Presumably, you'll need to send username/password via the Authorization HTTP header with your request, otherwise filebot-node service would just send back 401 Unauthorized.
:idea: Please read the FAQ and How to Request Help.
User avatar
mrbucket101
Power User
Posts: 36
Joined: 02 Jul 2014, 00:25

Re: docker filebot-watcher filebot-node

Post by mrbucket101 »

rednoah wrote: 23 Oct 2017, 19:45 The filebot-node web application is sending HTTP requests to the filebot-node service. By using curl, you can pretend to be the web application sending requests and the filebot-node service wouldn't know the difference.

So why is it not working? I have no idea. You can use the developer console in your browser to check exactly what requests are sent, and then recreate them with curl. If you manage to send a request to filebot-node service, then you will get a response. Reading the response will help you find out what's not working.

Presumably, you'll need to send username/password via the Authorization HTTP header with your request, otherwise filebot-node service would just send back 401 Unauthorized.
In order to keep this as simple as possible, I opted to not use any of the security options for filebot-node

I was successful in getting it to work. instead of using 127.0.0.1, I used the local IP address of my system.

However, filebot is deleting the archives after extraction

I have tried passing the argument &deleteAfterExtract=n but that doesn't seem to work

Code: Select all

http://xxx.xxx.xxx.xxx:5452/execute?fn=amc&input=%2FDownloads%2FTV%2FSouth.Park.S21E05.UNCENSORED.720p.WEB.H264-TURBO&label=tv&action=copy&output=%2FShare&clean=off&filter=&subtitles=eng&lang=en&conflict=auto&music=no&unsorted=no&ignore=&minLengthMS=&minFileSize=&excludeList=%2Fdata%2Famc_exclude.txt&movieFormat=%7Bplex%7D&seriesFormat=TV%2F%7Bplex.tail%7D&animeFormat=%7Bplex%7D&musicFormat=%7Bplex%7D&unsortedFormat=&exec=&plex=&kodi=&pushover=XXXX&pushbullet=&channel=fn&log=all

Code: Select all

filebot -script 'fn:amc' '/Downloads/TV/South.Park.S21E05.UNCENSORED.720p.WEB.H264-TURBO' --output /Share --action copy -non-strict --conflict auto --lang en --def 'ut_label=tv' 'subtitles=eng' 'deleteAfterExtract=y' 'pushover=XXXX' 'seriesFormat=TV/{plex.tail}' 'animeFormat={plex}' 'movieFormat={plex}' 'musicFormat={plex}' 'excludeList=/data/amc_exclude.txt' --log all --log-file '/usr/local/filebot-node/data/filebot.log'

------------------------------------------

Locking /usr/local/filebot-node/data/filebot.log
Run script [fn:amc] at [Mon Oct 23 19:57:33 UTC 2017]
Parameter: ut_label = tv
Parameter: subtitles = eng
Parameter: deleteAfterExtract = y
Parameter: pushover = *****
Parameter: seriesFormat = TV/{plex.tail}
Parameter: animeFormat = {plex}
Parameter: movieFormat = {plex}
Parameter: musicFormat = {plex}
Parameter: excludeList = /data/amc_exclude.txt
Argument[0]: /Downloads/TV/South.Park.S21E05.UNCENSORED.720p.WEB.H264-TURBO
Use excludes: /data/amc_exclude.txt (12)
Ignore extra: /Downloads/TV/South.Park.S21E05.UNCENSORED.720p.WEB.H264-TURBO/Sample
Read archive [south.park.s21e05.720p.web.h264-turbo.rar] and extract to [/Downloads/TV/South.Park.S21E05.UNCENSORED.720p.WEB.H264-TURBO/south.park.s21e05.720p.web.h264-turbo/South.Park.S21E05.UNCENSORED.720p.WEB.H264-TURBO]
Extracting files [/Downloads/TV/South.Park.S21E05.UNCENSORED.720p.WEB.H264-TURBO/south.park.s21e05.720p.web.h264-turbo/South.Park.S21E05.UNCENSORED.720p.WEB.H264-TURBO/South.Park.S21E05.UNCENSORED.720p.WEB.H264-TURBO.mkv]
Input: /Downloads/TV/South.Park.S21E05.UNCENSORED.720p.WEB.H264-TURBO/south.park.s21e05.720p.web.h264-turbo/South.Park.S21E05.UNCENSORED.720p.WEB.H264-TURBO/South.Park.S21E05.UNCENSORED.720p.WEB.H264-TURBO.mkv
Group: [tvs:south park] => [South.Park.S21E05.UNCENSORED.720p.WEB.H264-TURBO.mkv]
Get [English] subtitles for 1 files
Looking up subtitles by hash via OpenSubtitles
No matching subtitles found: /Downloads/TV/South.Park.S21E05.UNCENSORED.720p.WEB.H264-TURBO/south.park.s21e05.720p.web.h264-turbo/South.Park.S21E05.UNCENSORED.720p.WEB.H264-TURBO/South.Park.S21E05.UNCENSORED.720p.WEB.H264-TURBO.mkv
Rename episodes using [TheTVDB]
Auto-detected query: [South Park]
Fetching episode data for [South Park]
Fetching episode data for [South Pacific]
[AUTO] Delete [/Share/TV/South Park/Season 21/South Park - S21E05 - Hummels & Heroin.mkv]
[COPY] From [/Downloads/TV/South.Park.S21E05.UNCENSORED.720p.WEB.H264-TURBO/south.park.s21e05.720p.web.h264-turbo/South.Park.S21E05.UNCENSORED.720p.WEB.H264-TURBO/South.Park.S21E05.UNCENSORED.720p.WEB.H264-TURBO.mkv] to [/Share/TV/South Park/Season 21/South Park - S21E05 - Hummels & Heroin.mkv]
Processed 1 files
Sending Pushover notification
Delete archive /Downloads/TV/South.Park.S21E05.UNCENSORED.720p.WEB.H264-TURBO/south.park.s21e05.720p.web.h264-turbo.rar
Delete archive volume /Downloads/TV/South.Park.S21E05.UNCENSORED.720p.WEB.H264-TURBO/south.park.s21e05.720p.web.h264-turbo.r01
Delete archive volume /Downloads/TV/South.Park.S21E05.UNCENSORED.720p.WEB.H264-TURBO/south.park.s21e05.720p.web.h264-turbo.r00
Delete archive volume /Downloads/TV/South.Park.S21E05.UNCENSORED.720p.WEB.H264-TURBO/south.park.s21e05.720p.web.h264-turbo.r02
Done ヾ(@⌒ー⌒@)ノ
------------------------------------------
User avatar
rednoah
The Source
Posts: 22923
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: docker filebot-watcher filebot-node

Post by rednoah »

Does the FileBot Node WebUI have a corresponding option?

If yes, then just execute a command and see what request is sent.

If no, then you're out of lucky and it's simply possible to have it run an amc command with that option.
:idea: Please read the FAQ and How to Request Help.
User avatar
mrbucket101
Power User
Posts: 36
Joined: 02 Jul 2014, 00:25

Re: docker filebot-watcher filebot-node

Post by mrbucket101 »

rednoah wrote: 23 Oct 2017, 20:10 Does the FileBot Node WebUI have a corresponding option?

If yes, then just execute a command and see what request is sent.

If no, then you're out of lucky and it's simply possible to have it run an amc command with that option.
no, the webui didn't have a corresponding option to not delete archives.

It looks like I found a bug in the filebot-node source

https://github.com/filebot/filebot-node ... ejs/app.js
app.js
Lines 112-116

Code: Select all

        if (options.skipExtract == 'on') {
            args.push('skipExtract=y')
        } else {
            args.push('deleteAfterExtract=y')
        }
In my use case, I want filebot to extract the archives, and then do not delete them after extract

Code: Select all

if (options.skipExtract == 'on') {
            args.push('skipExtract=y')
        } else {
	    args.push('skipExtract=n')
	}
	if (options.deleteAfterExtract == 'on') {
            args.push('deleteAfterExtract=y')
        } else {
	    args.push('deleteAfterExtract=n')
	} 
After making these changes, I'm getting the expected behavior out of filebot. Should I make a pull request to push these changes in?
Post Reply