[idx / sub] How can i better handle subtitle language detection?

Support for Ubuntu and other Desktop Linux distributions
Post Reply
Cyb3rGh05t
Posts: 16
Joined: 17 May 2019, 11:47

[idx / sub] How can i better handle subtitle language detection?

Post by Cyb3rGh05t » 21 Jul 2019, 07:45

Hi,

i have problems to rename the subtitle properly :(
the input files have almost always the same file name scheme:

Code: Select all

group-movie-1080p.mkv
some-movie-1080p-eng.idx
some-movie-1080p-eng.sub
some-movie-1080p-forced.idx
some-movie-1080p-forced.sub
some-movie-1080p.idx
some-movie-1080p.sub
i want them in this format:

Code: Select all

Movie (2019) [1080p]/Movie (2019) [1080p].mkv
Movie (2019) [1080p]/Movie (2019) [1080p].eng.idx
Movie (2019) [1080p]/Movie (2019) [1080p].eng.sub
Movie (2019) [1080p]/Movie (2019) [1080p].ger.forced.idx
Movie (2019) [1080p]/Movie (2019) [1080p].ger.forced.sub
Movie (2019) [1080p]/Movie (2019) [1080p].ger.idx
Movie (2019) [1080p]/Movie (2019) [1080p].ger.sub
i am using this naming scheme:

Code: Select all

filebot -rename -r /mnt/complete/movies/ --output /mnt/renamed/movies/ --db TheMovieDB --format '{n} ({y}) [{vf}]/{n} ({y}) [{vf}]{subt}' -non-strict --conflict override --log-file /var/plexguide/filebot.log
but i get :

Code: Select all

Movie (2019) [1080p]/Movie (2019) [1080p].mkv
Movie (2019) [1080p]/Movie (2019) [1080p].eng.idx
Movie (2019) [1080p]/Movie (2019) [1080p].eng.sub
Movie (2019) [1080p]/Movie (2019) [1080p].idx  => "forced" tag is missing
Movie (2019) [1080p]/Movie (2019) [1080p].sub  => "forced" tag is missing
Movie (2019) [1080p]/Movie (2019) [1080p].idx  => this file is then deleted because of duplicates
Movie (2019) [1080p]/Movie (2019) [1080p].sub  => this file is then deleted because of duplicates
how can i avoid this?
is it even possible?

Thanks

User avatar
rednoah
The Source
Posts: 16434
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: Help!! How can i better handle subtitle renaming?

Post by rednoah » 21 Jul 2019, 08:45

I see. So the goal is to "assume its german" for subtitles without proper language tags in the filename?


:idea: NOTE: FileBot does use statistical language detection, but it only works for text based subtitles (e.g. srt), and not image bitmap based subtitles (e.g. idx/sub).


You can always express your own logic and conditions by writing your own code:

Code: Select all

{any{subt}{f.subtitle ? fn =~ /forced/ ? '.ger.forced' : '.ger' : null}}
:idea: Please read the FAQ and How to Request Help.

Cyb3rGh05t
Posts: 16
Joined: 17 May 2019, 11:47

Re: [idx / sub] How can i better handle subtitle language detection?

Post by Cyb3rGh05t » 21 Jul 2019, 09:35

ok thank you.

it will always be german language.

ok but how can i add this to my scheme?

like this?

Code: Select all

filebot -rename -r /mnt/complete/movies/ --output /mnt/renamed/movies/ --db TheMovieDB --format '{n} ({y}) [{vf}]/{n} ({y}) [{vf}]{subt}{any{subt}{f.subtitle ? fn =~ /forced/ ? '.ger.forced' : '.ger' : null}}' -non-strict --conflict override --log-file /var/plexguide/filebot.log
or

Code: Select all

filebot -rename -r /mnt/complete/movies/ --output /mnt/renamed/movies/ --db TheMovieDB --format '{n} ({y}) [{vf}]/{n} ({y}) [{vf}]{any{subt}{f.subtitle ? fn =~ /forced/ ? '.ger.forced' : '.ger' : null}}' -non-strict --conflict override --log-file /var/plexguide/filebot.log
thanks for helping me out :)

User avatar
rednoah
The Source
Posts: 16434
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: [idx / sub] How can i better handle subtitle language detection?

Post by rednoah » 21 Jul 2019, 09:42

1.
Use the GUI for prototyping custom formats:
https://www.filebot.net/naming.html

It'll make prototyping easy. ;)


2.
Use the @file syntax for reading command-line arguments from external text files, so you don't have to worry about correctly escaping complex command-line arguments.
:idea: Please read the FAQ and How to Request Help.

Cyb3rGh05t
Posts: 16
Joined: 17 May 2019, 11:47

Re: [idx / sub] How can i better handle subtitle language detection?

Post by Cyb3rGh05t » 21 Jul 2019, 09:48

ok thank you :)

Cyb3rGh05t
Posts: 16
Joined: 17 May 2019, 11:47

Re: [idx / sub] How can i better handle subtitle language detection?

Post by Cyb3rGh05t » 21 Jul 2019, 10:07

works perfectly thank you very much :)

Cyb3rGh05t
Posts: 16
Joined: 17 May 2019, 11:47

Re: [idx / sub] How can i better handle subtitle language detection?

Post by Cyb3rGh05t » 21 Jul 2019, 12:22

in filebot GUI it was working perfectly but when i put it into my bash script it give me this error?

Code: Select all

Failure (×_×)⌒☆
SyntaxError: unexpected token: ?
javax.script.ScriptException: SyntaxError: unexpected token: ?
	at net.filebot.format.ExpressionFormat.compile(ExpressionFormat.java:85)
	at net.filebot.format.ExpressionFormat.(ExpressionFormat.java:43)
	at net.filebot.format.ExpressionFileFormat.(ExpressionFileFormat.java:13)
	at net.filebot.cli.ArgumentBean.getExpressionFileFormat(ArgumentBean.java:255)
	at net.filebot.cli.ArgumentProcessor.runCommand(ArgumentProcessor.java:124)
	at net.filebot.cli.ArgumentProcessor.run(ArgumentProcessor.java:33)
	at net.filebot.Main.main(Main.java:132)

Error (o_O)
how can fix or avoid this? my knowledge in scripting is not very good :(

thank you for helping

User avatar
rednoah
The Source
Posts: 16434
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: [idx / sub] How can i better handle subtitle language detection?

Post by rednoah » 21 Jul 2019, 12:59

The format is the same, but if you use the CLI, then it's very possible that the format you think you pass in, isn't actually the format that is passed in, due to how the shell interpreter interprets command-line arguments.


:?: Ask yourself, if the command-line uses '...' to delimit arguments, what happens if a single argument itself contains '...'?


:idea: Use the @file syntax for reading command-line arguments from external text files, so you don't have to worry about correctly escaping complex command-line arguments (PLEASE READ THIS).
:idea: Please read the FAQ and How to Request Help.

Cyb3rGh05t
Posts: 16
Joined: 17 May 2019, 11:47

Re: [idx / sub] How can i better handle subtitle language detection?

Post by Cyb3rGh05t » 21 Jul 2019, 13:52

all right thanks again.

Cyb3rGh05t
Posts: 16
Joined: 17 May 2019, 11:47

Re: [idx / sub] How can i better handle subtitle language detection?

Post by Cyb3rGh05t » 22 Jul 2019, 10:57

Hi,

allright i had to add double quotes to the code to get it work in my script :)

Code: Select all

filebot -rename -r /mnt/complete/movies/ --output /mnt/renamed/movies/ --db TheMovieDB --format "{n} ({y}) [{vf}]/{n} ({y}) [{vf}]{subt}{any{subt}{f.subtitle ? fn =~ /forced/ ? '.ger.forced' : '.ger' : null}}" -non-strict --conflict override --log-file /var/logs/filebot.log
but i have to ask you again for some help if possible?

now i get it like this:

Code: Select all

pl3x-thencamyou-1080p-eng-forced.idx
to

Code: Select all

Then Came You (2019) [1080p].eng.forced.eng.forced.idx
also if there is alreday .ger in the filename.

Code: Select all

The Martian (2015) [2160p].ger.forded.ger.forced.idx
The Martian (2015) [2160p].ger.forded.ger.forced.sub
The Martian (2015) [2160p].ger.ger.idx
The Martian (2015) [2160p].ger.ger.sub
The Martian (2015) [2160p].ger.ger.srt
Could you maybe help me again to fix this if it is possible please?

Thanks again

User avatar
rednoah
The Source
Posts: 16434
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: [idx / sub] How can i better handle subtitle language detection?

Post by rednoah » 22 Jul 2019, 11:41

Open the GUI Format Editor and play with it. The solution will become obvious if you give it a try. ;)
:idea: Please read the FAQ and How to Request Help.

Cyb3rGh05t
Posts: 16
Joined: 17 May 2019, 11:47

Re: [idx / sub] How can i better handle subtitle language detection?

Post by Cyb3rGh05t » 22 Jul 2019, 12:26

yes i did but i dont get it :(

User avatar
rednoah
The Source
Posts: 16434
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: [idx / sub] How can i better handle subtitle language detection?

Post by rednoah » 22 Jul 2019, 15:11

Looks at the format. Which variable is used twice?
:idea: Please read the FAQ and How to Request Help.

Cyb3rGh05t
Posts: 16
Joined: 17 May 2019, 11:47

Re: [idx / sub] How can i better handle subtitle language detection?

Post by Cyb3rGh05t » 22 Jul 2019, 17:57

hmmm ok {subt}.

yes that did the trick

thank you very much :)

snickers2k
Posts: 12
Joined: 05 Nov 2016, 15:13

Re: [idx / sub] How can i better handle subtitle language detection?

Post by snickers2k » 29 Aug 2019, 14:33

Cyb3rGh05t wrote:
22 Jul 2019, 17:57
hmmm ok {subt}.

yes that did the trick

thank you very much :)

could you please share your working script ?

Post Reply