Page 1 of 1

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

Posted: 21 Jul 2019, 07:45
by Cyb3rGh05t
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

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

Posted: 21 Jul 2019, 08:45
by rednoah
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}}

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

Posted: 21 Jul 2019, 09:35
by Cyb3rGh05t
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 :)

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

Posted: 21 Jul 2019, 09:42
by rednoah
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.

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

Posted: 21 Jul 2019, 09:48
by Cyb3rGh05t
ok thank you :)

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

Posted: 21 Jul 2019, 10:07
by Cyb3rGh05t
works perfectly thank you very much :)

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

Posted: 21 Jul 2019, 12:22
by Cyb3rGh05t
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

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

Posted: 21 Jul 2019, 12:59
by rednoah
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).

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

Posted: 21 Jul 2019, 13:52
by Cyb3rGh05t
all right thanks again.

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

Posted: 22 Jul 2019, 10:57
by Cyb3rGh05t
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

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

Posted: 22 Jul 2019, 11:41
by rednoah
Open the GUI Format Editor and play with it. The solution will become obvious if you give it a try. ;)

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

Posted: 22 Jul 2019, 12:26
by Cyb3rGh05t
yes i did but i dont get it :(

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

Posted: 22 Jul 2019, 15:11
by rednoah
Looks at the format. Which variable is used twice?

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

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

yes that did the trick

thank you very much :)

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

Posted: 29 Aug 2019, 14:33
by snickers2k
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 ?