filebot will only run with the basic amc script

Support for Ubuntu and other Desktop Linux distributions
Post Reply
XeelosDK
Posts: 15
Joined: 28 Dec 2019, 18:34

filebot will only run with the basic amc script

Post by XeelosDK »

Hi,
Im trying to setup filebot for rtorrent since qbittorrent is way to unstable, ive managed to get it to work with the basic rtorrent-postprecess.sh script where i only changed the output folder and the logfile folder. Then i was trying to get it to work with my setup from qbittorrent but then filebot aint running on completed downloads.

filebot version: 4.9.0
rtorrent version: 0.9.8

this is my postprocess script:

Code: Select all

#!/bin/sh -xu

# Input Parameters
ARG_PATH="$1"
ARG_NAME="$2"
ARG_LABEL="$3"

# Configuration
CONFIG_OUTPUT="$HOME/Media"

filebot -script fn:amc --lang da --output "$CONFIG_OUTPUT" --action duplicate --conflict auto -non-strict --log-file "/home/c0de/scripts/logs/amc.log" --def unsorted=y music=y artwork=y excludeList=".excludes"  plex="https://localhost:32400${PLEXTOKEN}" ut_dir="$ARG_PATH" ut_kind="multi" ut_title="$ARG_NAME" ut_label="$ARG_LABEL" --def movieFormat="{vf =~ /1080p|720p/ ? 'movies' : 'movies'}/{Languages.toString().contains('da') || audioLanguages.toString().contains('da')? 'Dansk' : 'Engelsk'}/{n}/{n.space('.')}.{y}{'.'+source}.{vc}{'.'+lang}" seriesFormat="{vf =~ /1080p|720p/ ? 'tv' : 'tv'}/{Languages.toString().contains('da') || audioLanguages.toString().contains('da')? 'Dansk' : 'Engelsk'}/{n}/{'Season '+s}/{n} - {s00e00} - {t}{'.'+lang}"

but when i run the script manually it works fine, i just dont get it
User avatar
rednoah
The Source
Posts: 23095
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: filebot will only run with the basic amc script

Post by rednoah »

The first step is to confirm your script is actually called, and to collect all the logs. The second step is reading the logs to see what's happening and why.


:idea: Please read Shell Script Debugging for Beginners for details.
:idea: Please read the FAQ and How to Request Help.
XeelosDK
Posts: 15
Joined: 28 Dec 2019, 18:34

Re: filebot will only run with the basic amc script

Post by XeelosDK »

here are the logfile, https://pastebin.com/dRkQKthf
the entrys there with media has been made by running the script like this

Code: Select all

bash ./rtorrent-postprocess.sh /path/of/media
User avatar
rednoah
The Source
Posts: 23095
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: filebot will only run with the basic amc script

Post by rednoah »

Looks like FileBot is called and worked correctly:

Code: Select all

[DUPLICATE] from [/home/c0de/rtorrent/download/Godfather.of.Harlem.S01E06.Custom.DKsubs.720p.WEB-DL.H.264-SUBSTANCE/Godfather.of.Harlem.S01E06.Custom.DKsubs.720p.WEB-DL.H.264-SUBSTANCE.mkv] to [/home/c0de/Media/tv/Dansk/Godfather of Harlem/Season 1/Godfather of Harlem - S01E06 - Il Canto de Malavita.mkv]

:?: Is there any line in particular that you'd like to point out?


There is one error however, caused by --def plex being used incorrectly:

Code: Select all

Notify Plex: [host:https, token://localhost]
GET: https://https:32400/library/sections/all/refresh?X-Plex-Token=//localhost
UnknownHostException: https
Here's an example for correct usage:

Code: Select all

--def plex=127.0.0.1:YOURTOKENVALUEHERE
:arrow: https://support.plex.tv/hc/en-us/articl ... Plex-Token
:idea: Please read the FAQ and How to Request Help.
XeelosDK
Posts: 15
Joined: 28 Dec 2019, 18:34

Re: filebot will only run with the basic amc script

Post by XeelosDK »

Oh thats one error i could change but as i said the lines that have been made is by me calling the script manually
User avatar
rednoah
The Source
Posts: 23095
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: filebot will only run with the basic amc script

Post by rednoah »

1.
So you can confirm that rT is never calling FileBot?

Kinda not much we can do about that here, if FileBot is never called. The rT forums might be better for questions specific about rT.

Though other FileBot users may be able to chime in.


2.
The link in my first reply is the general help I can provide in this case.

What have you tried so far?
:idea: Please read the FAQ and How to Request Help.
XeelosDK
Posts: 15
Joined: 28 Dec 2019, 18:34

Re: filebot will only run with the basic amc script

Post by XeelosDK »

Its just odd that if i take the script from github and only change to output dir it works, but when i start to get it to sort my media into english and danish rtorrent wont call filebot
User avatar
rednoah
The Source
Posts: 23095
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: filebot will only run with the basic amc script

Post by rednoah »

Well, either filebot is called, or filebot is not called. If filebot is called, then there is logs that tell us what it's doing.

My best guess would be that your changes make the command syntactically incorrect, which means the shell will error out. There's still gonna be errors in the console error output, though filebot logs will of course not be created if filebot is never called:
viewtopic.php?t=3067
:idea: Please read the FAQ and How to Request Help.
XeelosDK
Posts: 15
Joined: 28 Dec 2019, 18:34

Re: filebot will only run with the basic amc script

Post by XeelosDK »

Now ive just tested with the default script again and it works, is there some of the settings that can't be processed by rtorrent ?

filebot script to run:

Code: Select all

#!/bin/sh -xu

# Input Parameters
ARG_PATH="$1"
ARG_NAME="$2"
ARG_LABEL="$3"

# Configuration
CONFIG_OUTPUT="$HOME/Media"

filebot -script fn:amc --output "$CONFIG_OUTPUT" --action test --conflict skip -non-strict --log-file "/home/c0de/scripts/logs/rtorrent.log" --def unsorted=y music=y artwork=y excludeList=".excludes" ut_dir="$ARG_PATH" ut_kind="multi" ut_title="$ARG_NAME" ut_label="$ARG_LABEL" &
log outout:

Code: Select all

Run script [fn:amc] at [Mon Dec 30 10:17:55 GMT 2019]
Parameter: unsorted = y
Parameter: music = y
Parameter: artwork = y
Parameter: excludeList = .excludes
Parameter: ut_dir = /home/c0de/rtorrent/download/tv/Tell.Me.A.Story.S02E04.NORDiC.720p.WEB-DL.H.264-CREW
Parameter: ut_kind = multi
Parameter: ut_title = Tell.Me.A.Story.S02E04.NORDiC.720p.WEB-DL.H.264-CREW
Parameter: ut_label =
Use excludes: /home/c0de/Media/.excludes
Input: /home/c0de/rtorrent/download/tv/Tell.Me.A.Story.S02E04.NORDiC.720p.WEB-DL.H.264-CREW/Tell.Me.A.Story.S02E04.NORDiC.720p.WEB-DL.H.264-CREW.mkv
Group: {Series=tell me a story us} => [Tell.Me.A.Story.S02E04.NORDiC.720p.WEB-DL.H.264-CREW.mkv]
Rename episodes using [TheTVDB] with [Airdate Order]
Auto-detected query: [Tell Me a Story (US), Tell Me a Story]
Fetching episode data for [Tell Me a Story (US)]
Fetching episode data for [Tell Me a Story]
Fetching episode data for [Tell Me a Story]
[TEST] from [/home/c0de/rtorrent/download/tv/Tell.Me.A.Story.S02E04.NORDiC.720p.WEB-DL.H.264-CREW/Tell.Me.A.Story.S02E04.NORDiC.720p.WEB-DL.H.264-CREW.mkv] to [/home/c0de/Media/TV Shows/Tell Me a Story (US)/Season 02/Tell Me a Story (US) - S02E04 - Number One Fan.mkv]
Processed 1 files
Done ヾ(@⌒ー⌒@)ノ
User avatar
rednoah
The Source
Posts: 23095
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: filebot will only run with the basic amc script

Post by rednoah »

1.
Alright, so we have confirmed that our *.sh script is called.


2.
As previously alluded to numerous times, we want to capture complete shell console output, which will tell us what's wrong with our filebot command. ;)

i.e. We could create a new script rtorrent-postprocess-with-io-redirection.sh (so simple that it can't not work), which we configure rT to run. This script does nothing but call our real rtorrent-postprocess.sh but also capture complete console output, which will then tell us about things going awry on the shell level:

rtorrent-postprocess-with-io-redirection.sh

Code: Select all

#!/bin/sh -xu
/path/to/rtorrent-postprocess.sh "$@" > "/path/to/console.log" 2>&1
:!: Make sure to replace /path/to with real paths, and make sure that the *.log file location is world-writable.
:idea: Please read the FAQ and How to Request Help.
XeelosDK
Posts: 15
Joined: 28 Dec 2019, 18:34

Re: filebot will only run with the basic amc script

Post by XeelosDK »

Okay so now ive got this setup but i got this error output from the console.log

Code: Select all

+ ARG_PATH=/home/c0de/rtorrent/download/Maanelyst.i.Flaaklypa.2018.NORDiC.ENG.1080p.BluRay.x264-RAPiDCOWS
+ ARG_NAME=Maanelyst.i.Flaaklypa.2018.NORDiC.ENG.1080p.BluRay.x264-RAPiDCOWS
+ ARG_LABEL=
+ CONFIG_OUTPUT=/home/c0de/mnt/media
/home/c0de/scripts/filebot.sh: 12: /home/c0de/scripts/filebot.sh: Syntax error: Unterminated quoted string
script rtorrent is running:

Code: Select all

#!/bin/sh -xu

# Input Parameters
ARG_PATH="$1"
ARG_NAME="$2"
ARG_LABEL="$3"

#CONFIG OUTPUT
CONFIG_OUTPUT="/home/c0de/mnt/media"

filebot -script fn:amc --lang da --output $CONFIG_OUTPUT --action test --conflict auto -non-strict --log-file "/home/c0de/scripts/logs/filebot-amc.log" --def unsorted=y music=y artwork=n plex=127.0.0.1:PLEXTOKEN" ut_dir="$ARG_PATH" ut_kind="multi" ut_title="$ARG_NAME" ut_label="$ARG_LABEL" --def @/home/c0de/scripts/format.txt
format.txt

Code: Select all

movieFormat="{vf =~ /1080p|720p/ ? 'movies' : 'movies'}/{info.spokenLanguages.toString().contains('da') || audioLanguages.toString().contains('da')? 'Dansk' : 'Engelsk'}/{n}/{n.space('.')}.{y}{'.'+source}.{vc}"
seriesFormat="{vf =~ /1080p|720p/ ? 'tv' : 'tv'}/{Languages.toString().contains('da') || audioLanguages.toString().contains('da')? 'Dansk' : 'Engelsk'}/{n}/{'Season '+s}/{n} - {s00e00} - {t}"
I found out that there was a " in end of the plextoken, but my problem now is that it takes all tv on move it to Danish, it sorts fine for movies.
User avatar
rednoah
The Source
Posts: 23095
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: filebot will only run with the basic amc script

Post by rednoah »

1.
YES

Code: Select all

movieFormat={plex}
NO (in the context of argument files)

Code: Select all

movieFormat="{plex}"
Because we use "..." to quote argument values for the shell interpreter, but here we use argument files to avoid the shell interpreter, and read argument values literally line by line from a text file. ;)



EDIT:

2.
On second thought, this is a shell error, not a Groovy error, so while (1.) would likely break things later on, we don't even get that far, since the command-line call is already broken due to incorrect used of quotes:

Code: Select all

Syntax error: Unterminated quoted string
e.g. 2 fixes for immediately obvious issues:

Code: Select all

--output "$CONFIG_OUTPUT"

Code: Select all

--def plex="127.0.0.1:PLEXTOKEN"
:idea: The --def plex option could be moved to the argument file, in which case "..." won't be necessary as explained in (1.).


:idea: :idea: :idea: Please read Cmdline and Argument Passing for details. It's absolutely essential reading material if you do any work on the command-line. It's a few minutes read that will save you days. ;)
:idea: Please read the FAQ and How to Request Help.
XeelosDK
Posts: 15
Joined: 28 Dec 2019, 18:34

Re: filebot will only run with the basic amc script

Post by XeelosDK »

My problem aint plex its that it moves english tv shows to tv but danish tv shows to danish

Log output

Code: Select all

[TEST] from [/home/c0de/rtorrent/download/Power.S06E11.NORDiC.720p.WEB-DL.DDP5.1.H.264-DBRETAiL/Power.S06E11.NORDiC.720p.WEB-DL.DDP5.1.H.264-DBRETAiL.mkv] to [/home/c0de/mnt/media/tv/Power/Season 6/Power - S06E11 - Still DRE.mkv]
[TEST] from [/home/c0de/rtorrent/download/Power.S06E11.NORDiC.720p.WEB-DL.DDP5.1.H.264-DBRETAiL/Power.S06E11.NORDiC.720p.WEB-DL.DDP5.1.H.264-DBRETAiL.da.srt] to [/home/c0de/mnt/media/tv/Power/Season 6/Power - S06E11 - Still DRE.srt]
[TEST] from [/home/c0de/rtorrent/download/Power.S06E11.NORDiC.720p.WEB-DL.DDP5.1.H.264-DBRETAiL/Power.S06E11.NORDiC.720p.WEB-DL.DDP5.1.H.264-DBRETAiL.sv.srt] to [/home/c0de/mnt/media/tv/Power/Season 6/Power - S06E11 - Still DRE.srt]
[TEST] from [/home/c0de/rtorrent/download/Power.S06E11.NORDiC.720p.WEB-DL.DDP5.1.H.264-DBRETAiL/Power.S06E11.NORDiC.720p.WEB-DL.DDP5.1.H.264-DBRETAiL.no.srt] to [/home/c0de/mnt/media/tv/Power/Season 6/Power - S06E11 - Still DRE.srt]
Processed 4 files
Done ヾ(@⌒ー⌒@)ノ
User avatar
rednoah
The Source
Posts: 23095
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: filebot will only run with the basic amc script

Post by rednoah »

XeelosDK wrote: 06 Jan 2020, 19:32 My problem aint plex its that it moves english tv shows to tv but danish tv shows to danish
As specified by your custom format. If the code you wrote doesn't do what you want, then let's just create a new thread and have a look at it in detail. You'll want to start with the Format Editor GUI and a few representative sample files. Fix the code until it works correctly for all you sample files. And then as a last step you can copy the format back into your script to run a few final tests.


EDIT:

:idea: Looking at the log, you'll want to add {subt} to your format, so that subtitles files to keep their respective language suffix.
:idea: Please read the FAQ and How to Request Help.
Post Reply