{subt} not working for idx/sub files

Any questions? Need some help?
Post Reply
Elamania
Posts: 22
Joined: 07 Sep 2015, 23:00

{subt} not working for idx/sub files

Post by Elamania » 05 Nov 2019, 02:02

Hi, I am renewing my Naming scheme and I have a few questions.

Here is my scheme for Movies:

Code: Select all

 {file.path[0]}:/Movies/ {collection+'/'} 
 {ny} / 
 {f.subtitle ? "Subs/" : null} 
 {if(ext=~ /nfo/ || ext=~ /sfv/ ||ext=~ /jpg/) {"FileInformation/"}}   
 {ny}
 {' - ' + fn.matchAll(/extended|uncensored|remastered|unrated|uncut|Theatrical|Theatrical.Cut|Theatrical.edition|directors.cut|special.edition|imax/)*.toUpperCase().sort().join(', ').replaceAll(/[._]/, " ")}  
 [{allOf{audio.language.contains("de") ? "Ger" : null}{audio.language.contains("en") ? "Eng" : null}{audio.language.contains("ja") ? "Jap" : null} join ""}]
 [{allOf{source.replace(/BluRay/,"BD")}{vf}{vc}{video.bitdepth=='10' ? '10Bit' : null}{ac.replace(/MPEG Audio/,"mpg")}{af.replace(/6ch/,"5.1")} join "_"}]
 {" ["+ group +"]"}
 {if(file.subtitle) fn =~ /[.|-|_]eng/ ? '.eng' : fn=~ /[.|-|_]ger/ ? '.ger' : null}{'.'+fn.match(/forced/)}
My questions are:
How can I remove certain files from renaming? ie.: sfv, -proof, -sample, etc?
The Bot already greys out some,but there often stay several files with -proof or -sample back.

How do I join the values properly?
ie: How can I make it like: [EngGerDub] ?
I am not sure how I can add the Dub after the join, if I add it directly after "join" it will be EngDubGer.

Yeah, okay. A few more questions...

Why is my Subtitle renaming not working?
1.) Why is there an blank between the group and the "." of the Subtitlelanguage?
2.) Why are the names not added correctly? eg.:
Wodkae-Bd.1080p-eng ->....[WodkaE]
Wodkae-Bd.1080p-forced -> ....[WodkaE] .forced
1080p-ger_forced -> ... DTS_5.1] .forced
Why is that stuff not correctly shown?

What can I do about groups that are not recognized but in your List?
I have "ENDSTATiON", but it resolves to nothing.



Is there anything I can do about anidb ban?
I have just added Anime to Filebot for like an year and the first message I got was an ban.

I am now trying to use TVDB.

Code: Select all

X:/TV Shows/{n}/{episode.special ? 'Special' : 'Season '+s}/{primaryTitle} - {episode.special ? 'S00E'+special.pad(2) : s00e00} - {t}
How can I check if there is only one Season? I want that there is no "Season 1" folder if there is only this one Season.

How do the names work? For some {n} is the same is primaryTitle and for others it´s not. Especially how can it find Shows where the file is named with the japanese name, but TVDB has not even that name saved! ie.: "Dakara Boku wa h ga Dekinai", the files are named like that and it finds them but then it renames them into "So I can´t play H". How does it find this show if in TVDB has apparently the searchterm not saved?
Because I really would like to use the Japanese names for Anime Series.

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

Re: Naming Scheme not working as expected

Post by rednoah » 05 Nov 2019, 08:15

1.
Please read How to process only specific kinds of files? for details.

:!: Your naming scheme conceptually cannot be used to include / exclude files from processing.

:idea: Assuming that you're using the GUI on Windows, your best option is probably a Preset with pre-defined input folder and custom Includes filter (e.g. (f.video && minutes > 10) || f.subtitle).



2.
This expression will yield values such as EngGerDub:

Code: Select all

{audioLanguages.ISO3B*.upperInitial().joining('', '','Dub')}


3.
If something is blank, then one or more {expressions} in your format error out or don't yield any value. Which specific {expression} doesn't work for which specific file?

:idea: Best to single a sample file, and then test with this specific file and only the problematic {expression} in the Format Editor, so you can see warning messages and narrow down what exactly is and isn't working.



4.
ENDSTATiON works for me when I use {group}.

:idea: You could try the latest beta: viewtopic.php?f=7&t=1609



5.
There is nothing you can do about AniDB bans. Just wait for a week and then try again. I think the daily limit is at ~200 episode list requests or less. Fairly low. You'll likely hit the limit if you process a large library all at once.

:idea: Notably, AniDB will ban by IP. So if you're using a VPN or any other kind of shared connection, then that IP could be banned due to requests sent by other users behind the same IP.



6.
TheTVDB does not have additional primary name info, nor a Japanese/Romanji info. {n} is the series name in your preferred language. {primaryTitle} is the series name in English. So if your preferred language is English, then those two will be the same.

:idea: TheTVDB does have Japanese language data though, so you do {localize.ja.n} to get the Japanese/Kanji name.



EDIT:

FileBot r6865 adds:
Enhance {primaryTitle} to yield AniDB x-jat (romanized Japanese) title for TheTVDB episode objects (via AnimeLists mappings)
:idea: Please read the FAQ and How to Request Help.

Elamania
Posts: 22
Joined: 07 Sep 2015, 23:00

Re: Naming Scheme not working as expected

Post by Elamania » 05 Nov 2019, 22:39

Regarding the Subtitle naming:

"Binding "file" undefined";
Although, file should be an valid Variable.
Also when I am switching to:

Code: Select all

{if (file.subtitle) fn =~ /[.|-|_]eng/ ? '.eng' : '.ger' }
Everything gets resolved to .ger. ie.:
...-1080p-eng
....-1080p-eng-forced
...-1080p-forced
Everything becomes .ger only.

And I just realised that with this scheme eng in the filename will match to this. I know I can use $ at the end of eng or ger, but then this will not work with forced. Ahh right, but I could use

Code: Select all

(fn.substring(fn.length()-15,fn.lengt())
in order to only take the last symbols to fetch the Subtitle stuff.

I have already shown my full Naming schema in the first post, everything gets resolved what can me resolved. In this case even an group is given and after the "]" is a blank.


Your Audio detection does not work:

Code: Select all

{audioLanguages.ISO3B*.upperInitial().joining('', '','Dub')}
If I use it within my scheme there will be no Output at all, if I only use this line I will get:

"Expression yields empty value: no signature method:...Array.ist.joiining() is applicable for argument types: (String, string, string) values [ , ,Dub]"

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

Re: Naming Scheme not working as expected

Post by rednoah » 06 Nov 2019, 00:17

1.
{file} is only a valid variable if you have selected a valid sample file for testing.

:idea: I recommend opening the Format Editor by double-clicking on the New Names entry, rather than clicking on Edit Format.


2.
{lang} and {subt} take care of subtitle language extensions so you don't have to worry about the details.


3.
{audioLanguages} requires a sample file, same root cause as (1.) probably:
viewtopic.php?t=4285


4.
Elamania wrote:
05 Nov 2019, 22:39

Code: Select all

"Expression yields empty value: no signature method:...Array.ist.joiining() is applicable for argument types: (String, string, string) values [ , ,Dub]"
Not sure. Maybe it's something that was recently added.

:?: What version are you using?

:idea: It definitely works with the latest beta: https://get.filebot.net/filebot/BETA/
:idea: Please read the FAQ and How to Request Help.

Elamania
Posts: 22
Joined: 07 Sep 2015, 23:00

Re: Naming Scheme not working as expected

Post by Elamania » 06 Nov 2019, 19:47

lol, I could have known earlier about {subt}.
However, is it possible that it does not recognize Subtitles where only forced is in the end and not the language?
It only checks the filename and not the content, right?

I have here one called:
track_1234-ger1080p
track_1234-ger1080p_forced
Which is not recognized as anything. I guess it only finds correctly named ones?

I have also some that are only xxxx-forced, without any language. Can I somehow match them? Because sometimes that will then leave me with two same filenames and extensions, where I then have to add to one a "forced".

I have tried to fix it with:

Code: Select all

  {subt}{fn.match(/forced$/ ? ".forced" : null)}
But obviously this will get my two forced if {subt} matches and out of some reason if {subt} does not match, but forced does I get: "xxxx _forced".
Why the fuck does it add an Underline.



And I still have an fucking blank between the point and the previous symbol >.<

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

Re: Naming Scheme not working as expected

Post by rednoah » 06 Nov 2019, 20:33

It'll check the file name first for language extensions such as .eng but it will fallback to doing statistical language detection based on the file content, so it'll always work, but potentially give you the wrong language (e.g. various Slavic languages are similar and prone to misidentification).

:idea: Please share one of the subtitle files that you have trouble with.

:idea: If a solution is the goal, then it's best to do any kind of discussion based on specific representative real-world example use cases, rather than general "Why does the proverbial it not work?" discussions. ;)




Exhibit A: A representative test case that shows that {lang} works based on file content:

Code: Select all

$ cat Avatar.srt
168
00:20:41,150 --> 00:20:45,109
Ja. Das ist gut! Deutsch. Bratwurst.

Code: Select all

$ filebot -mediainfo *.srt --format "{lang}"
deu
:idea: Please read the FAQ and How to Request Help.

Elamania
Posts: 22
Joined: 07 Sep 2015, 23:00

Re: Naming Scheme not working as expected

Post by Elamania » 07 Nov 2019, 21:08

I did give you an file.

Code: Select all

 {file.path[0]}:/Movies/ {collection+'/'} 
 {ny} / 
 {f.subtitle ? "Subs/" : null} 
 {if(ext=~ /nfo/ || ext=~ /sfv/ ||ext=~ /jpg/) {"FileInformation/"}}   
 {ny}
 {' - ' + fn.matchAll(/extended|uncensored|remastered|unrated|uncut|Theatrical|Theatrical.Cut|Theatrical.edition|directors.cut|special.edition|imax/)*.toUpperCase().sort().join(', ').replaceAll(/[._]/, " ")}  
 [{allOf{audio.language.contains("de") ? "Ger" : null}{audio.language.contains("en") ? "Eng" : null}{audio.language.contains("ja") ? "Jap" : null} join ""}]
 [{allOf{source.replace(/BluRay/,"BD")}{vf}{vc}{video.bitdepth=='10' ? '10Bit' : null}{ac.replace(/MPEG Audio/,"mpg")}{af.replace(/6ch/,"5.1")} join "_"}]
 {" ["+ group +"]"}
  {subt}
I will just screenshot what the GUI shows me and tell you what I would expect.
These are all sub, idx or srt files.

The problem is that if in the Subtitle file there is only the term "forced" it is not recognized.
Furthermore, if the Subtitle file is not properly named nothing is recognized at all.

Also you can see those stupid blanks for files where it is correctly matched.

https://imgur.com/ka5Qtbh

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

Re: Naming Scheme not working as expected

Post by rednoah » 08 Nov 2019, 04:39

1.
Looks like you're out of luck here for {lang} and {subt}.

:idea: Firstly, .ger1080 is not a recognized language extension, so auto-detection based on the file name doesn't work.
:idea: Secondly, idx/sub files are image based, and not text based, and so statistical language-detection based on file content is not possible either.


EDIT: FileBot r6874 adds support for FileBot .ger1080 style language extensions.


2.
You could manually match the information from the file name via fn.match() and friends.

:idea: I'd write the code for you, but since you didn't provide file paths as text, I can't auto-generate sample files for testing.
:idea: Please read the FAQ and How to Request Help.

Elamania
Posts: 22
Joined: 07 Sep 2015, 23:00

Re: {subt} not working for idx/sub files

Post by Elamania » 08 Nov 2019, 17:24

Here we go:

Code: Select all

02924.track_4608-eng1080
02924.track_4626-eng1080_forced
00800.track_4613-eng1080_forced
00800.track_4608-eng1080
Movie (2016) [BD_1080p_x265_DTS_5.1] -FORCED
The Witch (2016) [BD_1080p_x264_DTS_5.1] [COiNCiDENCE] -FORCED
How do you properly combine elements?
ie.:

Code: Select all

 {any{file.width<=1200 ? " [SD]" : ""}{hd.matches(/(?i)SD/) ? " [HD]":""}{hd.matches(/(?i)HD/) ? " [FHD]":""}{allOf{hd.matches(/(?i)UHD/) ? "UHD":""}{hdr}}} / 
The first three look okay, but the fourth only works properly if HDR exists.
If hdr is there then filebot surrounds it with [UHD, HDR], however if hdr does not match then there will be only UHD. How would one combine them so that without HDR the UHD is surrouned by [] too?

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

Re: {subt} not working for idx/sub files

Post by rednoah » 08 Nov 2019, 20:03

1.
e.g. for subtitle file only, match the last part of the file name, and normalize it:

Code: Select all

{if (f.subtitle) fn.match(/.\w+$/).replaceAll(/\P{Alpha}+/, '.').toLowerCase()}

Test Case:

Code: Select all

{'00800.track_4613-eng1080_forced'.match(/.\w+$/).replaceAll(/\P{Alpha}+/, '.')}

Code: Select all

.eng.forced


2.
IDK. Do you have a simple test case or sample file that illustrates the problem? For help with custom format expression based on MediaInfo, I will need a sample file for testing, and an example for that the output is supposed to be.

I'd just do this:

Code: Select all

{allOf{hd}{hdr}}
You'll get nice values such as this:

Code: Select all

[SD]
[UHD, HDR]
:idea: Please read the FAQ and How to Request Help.

Elamania
Posts: 22
Joined: 07 Sep 2015, 23:00

Re: {subt} not working for idx/sub files

Post by Elamania » 08 Nov 2019, 20:22

Thank´s a lot.
Although there is still an problem

dfd-toy.story.2-1080p
sons-mib3-1080p

will result to ".p", although there should be nothing.

00800.track_4608-eng1080 -> ".eng."
00800.track_4610-ger1080 -> ".ger."


I am still interested, why would: {fn.match(/forced$/ ? ".forced" : null)}
result in -forced or _forced if the original filename ends with that? Why is there no fuckin gpoint >.<

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

Re: {subt} not working for idx/sub files

Post by rednoah » 08 Nov 2019, 20:41

1.
Yep, the code above works for all your given test files, but may not necessarily generalize perfectly to other files that are different from the ones you provided for testing. You might need to fine-tune things a little bit here and there to make it work for all your files.

:idea: Here's an example for getting rid of trailing dots:

Code: Select all

{"test.".removeAll(/[.]$/)}


2.
Elamania wrote:
08 Nov 2019, 20:22
I am still interested, why would: {fn.match(/forced$/ ? ".forced" : null)}
result in -forced or _forced if the original filename ends with that? Why is there no fuckin gpoint >.<
Explanation time. Here's the code:

Code: Select all

fn.match(/forced$/ ? ".forced" : null)
1. Since you misplaced the () the ternary operation is used to decide which argument is passed into match() rather than evaluating the result of match:

Code: Select all

/forced$/ ? ".forced" : null
:arrow: /forced$/ is a valid String and always true, hence the result is always ".forced"

2. Now fn.match(".forced") is called, where ".forced" is a regular expression, and . referring to any character, so if fn is "test_forced" then the result is "_forced" since that's the match result.



:idea: Here's the correct code for expressing what you're trying to express:

Code: Select all

{fn =~ /forced$/ ? '.forced' : null}
:idea: Alternatively, this works too:

Code: Select all

{'.'+fn.match(/forced$/}
:idea: Please read the FAQ and How to Request Help.

Post Reply