--lang: command not found

Running FileBot from the console, Groovy scripting, shell scripts, etc
Post Reply
User avatar
feuerwasser
Posts: 13
Joined: 04 Mar 2015, 18:38

--lang: command not found

Post by feuerwasser »

Hi there, i know there are a few topics around there that discuss my problems but i'm not quite sure how to start. My problem is that first the log output said there is no --output parameter so i configured that. Now my problem is that every parameter gets ignored as well as my naming sceme and gets only standard renamed and moved to the output dir. Filebot is installed natively on a Synology DS920+ on DSM 7.0.1. I would love to have my script as readable as possible but i think there are some problems now in quoting or new line in the filebot section. Can someone help me to fix this script?
Here my script:

Code: Select all

#!/bin/sh

export JAVA_OPTS="-Xmx512m"
export PATH=$PATH:/var/packages/java-installer/target/bin
export LANG="de_DE.utf8"
export LC_ALL="de_DE.utf8"

#Pfade
QUELLE='/volume1/download'
ZIEL='/volume1/video'
SERIEN='/Serien'
FILME='/Filme'

#Filebot
FILEBOT=/usr/local/bin/filebot
KONFLIKT=override
AKTION=move
EXCLUDELIST=/volume1/backup/logs/filebot/filebot-ignore.txt
LOGFILE=/volume1/backup/logs/filebot/filebot.log
TOKEN="192.168.0.2:XXXXXXXXXXXXXXX"

#Formate
SERIE='{n.upperInitial()}/Staffel {s}/{n.upperInitial()} - S{s.pad(2)}E{e.pad(2)} - {t.upperInitial()}'
FILM='{dim[0] > 1920 ? "4K" : ""}/{n.upperInitial()} {fn =~ /3D/ ? '\''3D'\'' : fn =~ /3d/ ? '\''3D'\'' : fn =~ /3-D/ ? '\''3-D'\'' : fn =~ /HOU/ ? '\''3-D'\'' : fn =~ /HSBS/ ? '\''3D'\'' : '\'\''} ({y})'
ANIME='Animation/{n.upperInitial()} {fn =~ /3D/ ? '\''3D'\'' : fn =~ /3d/ ? '\''3D'\'' : fn =~ /3-D/ ? '\''3-D'\'' : fn =~ /HOU/ ? '\''3-D'\'' : fn =~ /HSBS/ ? '\''3D'\'' : '\'\''} ({y})'

#Pushover
PUSHOVER="
curl -s \
--form-string token=XXXXXXXXXXXXXXXXXXXXXXXXXXXX \
--form-string user=XXXXXXXXXXXXXXXXXXXXXXXXXXXX \
--form-string \"message={movie; 'Der Film'}{episode; 'Die Episode'} {fn} wurde der Bibliothek hinzugefügt.\" \
https://api.pushover.net/1/messages.json
"

#Neuverrechtung
chown -R Michael:users "$1"
#chmod -R 755 "$1"
find "$1" -type d -exec chmod 755 {} \;
find "$1" -type f -exec chmod 644 {} \;

#Filebot-Kommando
$FILEBOT -script \
 fn:amc \
 --conflict $KONFLIKT \
 --action $AKTION "$1" \
 -no-xattr \
 -non-strict \
 --output $ZIEL
 --lang de \
 --log-file $LOGFILE \
 --def excludeList=$EXCLUDELIST \
 --def plex=$TOKEN \
 --def seriesFormat=$SERIEN/$SERIE \
 --def movieFormat=$FILME/$FILM \
 --def animeFormat=$FILME/$ANIME \
 --def "exec=synoindex -a \"{file}\";$PUSHOVER"

#Filebot-Clean
$FILEBOT -script \
 fn:cleaner \
 $QUELLE \
 --def root=y
User avatar
rednoah
The Source
Posts: 22923
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: Bash Script not working anymore

Post by rednoah »

What does the console output say?


At a glance, your argument sequence ends at the line you modified because you forgot to \ at the end:

Code: Select all

 -non-strict \
 --output $ZIEL
 --lang de \
You probably meant to escape the newline:

Code: Select all

 -non-strict \
 --output $ZIEL \
 --lang de \

In this case, the console output would say this, leading you the to the typo above:

Code: Select all

--lang: command not found
:idea: Please read the FAQ and How to Request Help.
User avatar
feuerwasser
Posts: 13
Joined: 04 Mar 2015, 18:38

Re: Bash Script not working anymore

Post by feuerwasser »

Here are some Log outputs from my last attempts:

Code: Select all

{y}: No Such File: /volume1/etc/filebot/{y}
Run script [fn:amc] at [Sat Sep 18 15:21:15 CEST 2021]
Parameter: excludeList = /volume1/backup/logs/filebot/filebot-ignore.txt
Parameter: plex = *****
Parameter: seriesFormat = {n}
Parameter: movieFormat = /volume1/video/Filme/{n}
Parameter: exec = synoindex -a "{file}";curl -s --form-string token=XXXXXXXXXXXXXXXXXXX --form-string user=XXXXXXXXXXXXXXXXXXX --form-string "message={movie; 'Der Film'}{episode; 'Die Episode'} {fn} wurde der Bibliothek hinzugefügt." https://api.pushover.net/1/messages.json
Argument[0]: /volume1/video/Movies/Luca (2021)/Luca (2021).mkv
Use excludes: /volume1/backup/logs/filebot/filebot-ignore.txt (0)
Input: /volume1/video/Movies/Luca (2021)/Luca (2021).mkv
Group: {Movie=Luca (2021)} => [Luca (2021).mkv]
Rename movies using [TheMovieDB]
Auto-detect movie from context [/volume1/video/Movies/Luca (2021)/Luca (2021).mkv]
[MOVE] from [/volume1/video/Movies/Luca (2021)/Luca (2021).mkv] to [/volume1/video/Filme/Luca.mkv]
Processed 1 file
Execute: synoindex -a "/volume1/video/Filme/Luca.mkv";curl -s --form-string token=XXXXXXXXXXXXXXXXXXX --form-string user=XXXXXXXXXXXXXXXXXXX --form-string "message=Der Film Luca wurde der Bibliothek hinzugefügt." https://api.pushover.net/1/messages.json
Notify Plex: [host:192.168.0.2, token:XXXXXXXXXXXXXXXXXXX ]
GET: http://192.168.0.2:32400/library/sections/all/refresh?X-Plex-Token=nDMdzdGyHhiBHfSHBjBX
Done ヾ(@⌒ー⌒@)ノ

{y}: No Such File: /volume1/etc/filebot/{y}
Run script [fn:amc] at [Sat Sep 18 15:23:04 CEST 2021]
Parameter: excludeList = /volume1/backup/logs/filebot/filebot-ignore.txt
Parameter: plex = *****
Parameter: seriesFormat = {n}
Parameter: movieFormat = /volume1/video/Filme/{n}
Parameter: exec = synoindex -a "{file}";curl -s --form-string token=XXXXXXXXXXXXXXXXXXX  --form-string user=XXXXXXXXXXXXXXXXXXX --form-string "message={movie; 'Der Film'}{episode; 'Die Episode'} {fn} wurde der Bibliothek hinzugefügt." https://api.pushover.net/1/messages.json
Argument[0]: /volume1/video/Filme/Luca.mkv
Use excludes: /volume1/backup/logs/filebot/filebot-ignore.txt (0)
Input: /volume1/video/Filme/Luca.mkv
Group: {Movie=Luca (2021)} => [Luca.mkv]
Rename movies using [TheMovieDB]
Auto-detect movie from context [/volume1/video/Filme/Luca.mkv]
Skipped [/volume1/video/Filme/Luca.mkv] because [/volume1/video/Filme/Luca.mkv] already exists
Processed 0 files
Finished without processing any files
Abort (×_×)

{y}: No Such File: /volume1/etc/filebot/{y}
Run script [fn:amc] at [Sat Sep 18 15:24:46 CEST 2021]
Parameter: excludeList = /volume1/backup/logs/filebot/filebot-ignore.txt
Parameter: plex = *****
Parameter: seriesFormat = {n}
Parameter: movieFormat = /volume1/video/Filme/{n}
Parameter: exec = synoindex -a "{file}";curl -s --form-string token=XXXXXXXXXXXXXXXXXXX --form-string user=XXXXXXXXXXXXXXXXXXX --form-string "message={movie; 'Der Film'}{episode; 'Die Episode'} {fn} wurde der Bibliothek hinzugefügt." https://api.pushover.net/1/messages.json
Argument[0]: /volume1/video/Filme/Luca.mkv
Use excludes: /volume1/backup/logs/filebot/filebot-ignore.txt (1)
No files selected for processing
Done ¯\_(ツ)_/¯

{y}: No Such File: /volume1/etc/filebot/{y}
Run script [fn:amc] at [Sat Sep 18 15:26:10 CEST 2021]
Parameter: excludeList = /volume1/backup/logs/filebot/filebot-ignore.txt
Parameter: plex = *****
Parameter: seriesFormat = {n}
Parameter: movieFormat = /volume1/video/Filme/{n}
Parameter: exec = synoindex -a "{file}";curl -s --form-string token=XXXXXXXXXXXXXXXXXXX --form-string user=XXXXXXXXXXXXXXXXXXX --form-string "message={movie; 'Der Film'}{episode; 'Die Episode'} {fn} wurde der Bibliothek hinzugefügt." https://api.pushover.net/1/messages.json
Invalid usage: no input
Abort (×_×)
User avatar
feuerwasser
Posts: 13
Joined: 04 Mar 2015, 18:38

Re: --lang: command not found

Post by feuerwasser »

And you were right! There was a \ missing after output. Now my script output is like this:

Code: Select all

root@mediaserver:/volume1/etc/filebot# ./fb2jd.sh /volume1/video/Movies/Nightbooks\ \(2021\)/Nightbooks\ \(2021\).mkv
/usr/local/bin/filebot must NOT run as root

Did you read the manual?
└ https://www.filebot.net/manpage.html

Did you quote and escape your arguments correctly?
└ https://www.filebot.net/help/args.html

args[1] = -script
args[2] = fn:amc
args[3] = --conflict
args[4] = override
args[5] = --action
args[6] = move
args[7] = /volume1/video/Movies/Nightbooks (2021)/Nightbooks (2021).mkv
args[8] = -no-xattr
args[9] = -non-strict
args[10] = --output
args[11] = /volume1/video
args[12] = --lang
args[13] = de
args[14] = --log-file
args[15] = /volume1/backup/logs/filebot/filebot.log
args[16] = --def
args[17] = excludeList=/volume1/backup/logs/filebot/filebot-ignore.txt
args[18] = --def
args[19] = plex=192.168.0.2:XXXXXXXXXXXXXXXXXX
args[20] = --def
args[21] = seriesFormat=/Serien/{n.upperInitial()}/Staffel
args[22] = {s}/{n.upperInitial()}
args[23] = -
args[24] = S{s.pad(2)}E{e.pad(2)}
args[25] = -
args[26] = {t.upperInitial()}
args[27] = --def
args[28] = movieFormat=/Filme/{dim[0]
args[29] = >
args[30] = 1920
args[31] = ?
args[32] = "4K"
args[33] = :
args[34] = ""}/{n.upperInitial()}
args[35] = {fn
args[36] = =~
args[37] = /3D/
args[38] = ?
args[39] = '3D'
args[40] = :
args[41] = fn
args[42] = =~
args[43] = /3d/
args[44] = ?
args[45] = '3D'
args[46] = :
args[47] = fn
args[48] = =~
args[49] = /3-D/
args[50] = ?
args[51] = '3-D'
args[52] = :
args[53] = fn
args[54] = =~
args[55] = /HOU/
args[56] = ?
args[57] = '3-D'
args[58] = :
args[59] = fn
args[60] = =~
args[61] = /HSBS/
args[62] = ?
args[63] = '3D'
args[64] = :
args[65] = ''}
args[66] = ({y})
args[67] = --def
args[68] = animeFormat=/Filme/Animation/{n.upperInitial()}
args[69] = {fn
args[70] = =~
args[71] = /3D/
args[72] = ?
args[73] = '3D'
args[74] = :
args[75] = fn
args[76] = =~
args[77] = /3d/
args[78] = ?
args[79] = '3D'
args[80] = :
args[81] = fn
args[82] = =~
args[83] = /3-D/
args[84] = ?
args[85] = '3-D'
args[86] = :
args[87] = fn
args[88] = =~
args[89] = /HOU/
args[90] = ?
args[91] = '3-D'
args[92] = :
args[93] = fn
args[94] = =~
args[95] = /HSBS/
args[96] = ?
args[97] = '3D'
args[98] = :
args[99] = ''}
args[100] = ({y})
args[101] = --def
args[102] = exec=synoindex -a "{file}";
curl -s --form-string token=XXXXXXXXXXXXXXXXXX--form-string user=XXXXXXXXXXXXXXXXXX--form-string "message={movie; 'Der Film'}{episode; 'Die Episode'} {fn} wurde der Bibliothek hinzugefügt." https://api.pushover.net/1/messages.json


"-" is not a valid option
/usr/local/bin/filebot must NOT run as root
Done ヾ(@⌒ー⌒@)ノ
User avatar
rednoah
The Source
Posts: 22923
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: --lang: command not found

Post by rednoah »

In addition to the missing \ in the filebot argument sequence, your --def seriesFormat isn't quoted correctly, and so your format isn't passed in as a single argument:

Code: Select all

...
{y}: No Such File: /volume1/etc/filebot/{y}
...
Parameter: seriesFormat = {n}
...
args[27] = --def
args[28] = movieFormat=/Filme/{dim[0]
args[29] = >
args[30] = 1920
args[31] = ?
args[32] = "4K"
args[33] = :
...

Please read the Cmdline and Argument Passing tutorials for details:
https://www.filebot.net/help/args.html


:arrow: You'll want to quote the argument value like so if your bash variables contain spaces:

Code: Select all

 --def seriesFormat="$SERIEN/$SERIE" \
 --def movieFormat="$FILME/$FILM" \
 --def animeFormat="$FILME/$ANIME" \
:idea: Please read the FAQ and How to Request Help.
User avatar
feuerwasser
Posts: 13
Joined: 04 Mar 2015, 18:38

Re: --lang: command not found

Post by feuerwasser »

This helped a lot! Thank you so much for your quick response!
It seems the best way is to double Quote every Parameter then the variable itself. Lerned again
Post Reply