Remove language from subtitle name

Running FileBot from the console, Groovy scripting, shell scripts, etc
xflak
Power User
Posts: 53
Joined: 25 Feb 2015, 01:51

Re: Remove language from subtitle name

Post by xflak »

Got that working thanks. it seems every question I ask leads to 10 more, lol, so I really appreciate your patience.

1- Is it possible to specify custom tv series titles? For example, instead of Dragons' Den CA I use Dragons' Den Canada.

2- I already managed to get vc included as part of the naming format for only 720p and 1080p using the match function. I want to do something similar for subtitles lang. Basically I want to include the {.lang} tag for non-english subtitles only. So videos and eng subs will exclude/ignore the Lang tag when renaming.

Edit: also I noticed the amc script doesn't have an argument for xbmc username/passwords, am I missing something or will it only work if there's no password set?
Last edited by xflak on 01 Mar 2015, 19:46, edited 1 time in total.
User avatar
rednoah
The Source
Posts: 22986
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: Remove language from subtitle name

Post by rednoah »

1.
You set the rules in your format. I recommend having a .csv file with your mappings and having your format code refer to that.

2.
Again, your format your rules.

e.g.

Code: Select all

{lang =~ 'eng' ? lang : null}
:idea: Please read the FAQ and How to Request Help.
xflak
Power User
Posts: 53
Joined: 25 Feb 2015, 01:51

Re: Remove language from subtitle name

Post by xflak »

Omg this tool is capable of so much it's overwhelming.

Not sure if u saw my edit above with another q about xbmc.

But also wanted to know if there a way to stop filebot from attempting to download subs when the anti-leech limit is met? I am running a script daily to download 200 missing subs at a time. So I would like it to close after the limit is reached instead of running pointlessly for another hour or two.
User avatar
rednoah
The Source
Posts: 22986
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: Remove language from subtitle name

Post by rednoah »

There's currently no good way. I highly recommend upgrading your OpenSubtitles account if you need higher limits.

Otherwise you can probably script something together with the output of filebot -script fn:osdb.stats to check if the limit has been reached or not.
:idea: Please read the FAQ and How to Request Help.
xflak
Power User
Posts: 53
Joined: 25 Feb 2015, 01:51

Re: Remove language from subtitle name

Post by xflak »

Even if I upgrade my account I will only be able to download 1000 subtitles a day and I will still hit that maximum and have filebot needlessly running and spending resources trying to get more. And even if I were to check my current limit there's no way for me to have filebot just download up to my limit so that doesn't help.

I'd like to make a feature request if I may. Can you have filebot stop checking for subs when the limit is reached? I.e. break the current command/operation only when the anti-leech message is received. Alternatively if it's easier maybe u could add an argument for the max download attempts? Then I could set it at 200 and worst case scenario I see the anti-leech message 200 times (if I had already reached my limit) instead of thousands.

What do you think?
thx
xflak
Power User
Posts: 53
Joined: 25 Feb 2015, 01:51

Re: Remove language from subtitle name

Post by xflak »

I got another question, how can I get filebot to skip jpg and nfo files when renaming?

I tried using --def ignore=.jpg and it didn't work. I tried using the cleaner script the folder before renaming but it doesn't delete jpg and nfo files if there's a large video file in the same directory.
User avatar
rednoah
The Source
Posts: 22986
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: Remove language from subtitle name

Post by rednoah »

Looks like those file are excluded by default already. Are you using the amc script?

If you not you have to do the exclude logic yourself with find | egrep | xargs | filebot -rename ...

Code: Select all

Parameter: minFileSize = 0
Parameter: minLengthMS = 0
Parameter: ut_dir = /Users/reinhard/Test/AMC-TEST
Parameter: ut_kind = multi
Parameter: ut_label = test
Ignore hidden: /Users/reinhard/Test/AMC-TEST/.DS_Store
Input: /Users/reinhard/Test/AMC-TEST/Forever.US.S01E14.720p.HDTV.X264-DIMENSION.mkv
Exclude: /Users/reinhard/Test/AMC-TEST/Forever.US.S01E14.720p.HDTV.X264-DIMENSION.jpg
Exclude: /Users/reinhard/Test/AMC-TEST/Forever.US.S01E14.720p.HDTV.X264-DIMENSION.nfo
Group: [tvs:forever us] => [Forever.US.S01E14.720p.HDTV.X264-DIMENSION.mkv]
Rename episodes using [TheTVDB]
Auto-detected query: [Forever US]
Fetching episode data for [Forever (2014)]
[DUPLICATE] Rename [/Users/reinhard/Test/AMC-TEST/Forever.US.S01E14.720p.HDTV.X264-DIMENSION.mkv] to [/Users/reinhard/Test/OUTPUT/TV Shows/Forever (2014)/Season 01/Forever (2014) - S01E14 - Hitler on the Half-Shell.mkv]
Processed 1 files
Done ヾ(@⌒ー⌒@)ノ
:idea: Please read the FAQ and How to Request Help.
xflak
Power User
Posts: 53
Joined: 25 Feb 2015, 01:51

Re: Remove language from subtitle name

Post by xflak »

Last Question. For some reason renaming from the gui and from cmd line using the same format are yielding slightly different results. The GUI is working fine, I'm hoping you can help me get the same results from cmd line.

So the issue only occurs when renaming multi-episode tv shows. For example renaming:
"Teenage.Mutant.Ninja.Turtles.2012.S03E12E13.Battle.for.New.York.720p.WEB-DL.AAC2.0.H.264-iT00NZ"
via cmd line results in "S03E12 Battle for New York (1) [720p].mkv"
and via the GUI results in "S03E12-E13 Battle for New York [720p].mkv"

Is there a way for me to get the cmd line to give the same output as the GUI?

the cmd I'm using specifically is:
filebot.exe -rename --action move --conflict auto --db theTVDB -r -non-strict --format "\\Nas\video\TV\{csv('list.csv').get(n) ?: n}\Season {s}\{s00e00} {t}{' ['+vf.match(/720[pP]|1080[pP]/)+']'}{lang =~ 'eng' ? null : '.'+ lang}" "C:\Users\Admin\Downloads\TV"

I finished my whole script and was about to share it in these forums when I noticed this issue. I'd like to address it before sharing, thanks!

Edit:
rednoah and I took this "offline" and discussed further in PMs. Turns out this was a problem with FileBot but has been fixed in r2837 (March 2015)
xflak
Power User
Posts: 53
Joined: 25 Feb 2015, 01:51

Re: Remove language from subtitle name

Post by xflak »

rednoah wrote:Looks like those file are excluded by default already. Are you using the amc script?

If you not you have to do the exclude logic yourself with find | egrep | xargs | filebot -rename ...

Code: Select all

Parameter: minFileSize = 0
Parameter: minLengthMS = 0
Parameter: ut_dir = /Users/reinhard/Test/AMC-TEST
Parameter: ut_kind = multi
Parameter: ut_label = test
Ignore hidden: /Users/reinhard/Test/AMC-TEST/.DS_Store
Input: /Users/reinhard/Test/AMC-TEST/Forever.US.S01E14.720p.HDTV.X264-DIMENSION.mkv
Exclude: /Users/reinhard/Test/AMC-TEST/Forever.US.S01E14.720p.HDTV.X264-DIMENSION.jpg
Exclude: /Users/reinhard/Test/AMC-TEST/Forever.US.S01E14.720p.HDTV.X264-DIMENSION.nfo
Group: [tvs:forever us] => [Forever.US.S01E14.720p.HDTV.X264-DIMENSION.mkv]
Rename episodes using [TheTVDB]
Auto-detected query: [Forever US]
Fetching episode data for [Forever (2014)]
[DUPLICATE] Rename [/Users/reinhard/Test/AMC-TEST/Forever.US.S01E14.720p.HDTV.X264-DIMENSION.mkv] to [/Users/reinhard/Test/OUTPUT/TV Shows/Forever (2014)/Season 01/Forever (2014) - S01E14 - Hitler on the Half-Shell.mkv]
Processed 1 files
Done ヾ(@⌒ー⌒@)ノ
Can I exclude extensions like txt and jpg using something like this?
--def ignore=.txt --def ignore=.jpg

edit:
just tested it and seems to not work. If there's some way to get this working it would be very much appreciated. Thanks!
User avatar
rednoah
The Source
Posts: 22986
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: Remove language from subtitle name

Post by rednoah »

Since the ignore pattern is applied to the path I'm sure that it's working. But you can't do is specifing the same option multiple times, most likely only last one will count. Also it's a regex so . is not what you think

If you wanted to ignore jpg and txt files you'd write a regex like so:

Code: Select all

--def "ignore=[.](jpg|txt)$"
:idea: Please read the FAQ and How to Request Help.
xflak
Power User
Posts: 53
Joined: 25 Feb 2015, 01:51

Re: Remove language from subtitle name

Post by xflak »

Thanks I'll test it out and add it to uFiler (assuming it works).

Where was this knowledge the first time I asked? Does FileBot have so many bells and whistles that even you have a hard time keeping track of them all? lol
User avatar
rednoah
The Source
Posts: 22986
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: Remove language from subtitle name

Post by rednoah »

--def ignore=regex Ignore filepaths that match the given regular expression
;)

PS: I didn't notice you asked how to use --def ignore before :?
:idea: Please read the FAQ and How to Request Help.
xflak
Power User
Posts: 53
Joined: 25 Feb 2015, 01:51

Re: Remove language from subtitle name

Post by xflak »

so I tried using --def "ignore=[.](jpg|txt)$" and it's not ignoring txt files. Am I doing something wrong? The exact cmd I'm using is:

Code: Select all

"C:\Program Files\FileBot\filebot.exe" -rename --action copy --conflict auto --db theTVDB -r -non-strict --def "ignore=[.](jpg|txt)$" --format "C:\Users\XFlak\Desktop\out\TV\{n}\Season {s}\{s00e00} {t}{lang =~ 'eng' ? null : '.'+ lang}" "C:\Users\XFlak\Desktop\in"
Thanks!
User avatar
rednoah
The Source
Posts: 22986
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: Remove language from subtitle name

Post by rednoah »

The --def parameters are for scripting, so --def ignore will only work in the amc script, or other script that support that parameter.

Simple -rename, -get-subtitles, etc does not support what you want, because you're supposed to select the files you want before passing them on to filebot, i.e. instead of passing in a folder you should pass in all the files you want to process.

On Linux/Mac you'd do this with some simple find | xargs | filebot call but on Windows you'll have to find some equivalent for that, or use a Groovy script.
:idea: Please read the FAQ and How to Request Help.
shotar
Posts: 8
Joined: 29 Jun 2015, 16:25

Re: Remove language from subtitle name

Post by shotar »

Is it possible to remove the language in the .srt file using the amc script?
User avatar
rednoah
The Source
Posts: 22986
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: Remove language from subtitle name

Post by rednoah »

Yes. By providing your own --format that doesn't include the language tag.
:idea: Please read the FAQ and How to Request Help.
shotar
Posts: 8
Joined: 29 Jun 2015, 16:25

Re: Remove language from subtitle name

Post by shotar »

I tried by adding --format "{n} ({y} {sdhd})" but it seems to have no effect. here's my complete expression:

Code: Select all

filebot -script fn:amc --output "/volume1/downloads/nice" --format "{n} ({y} {sdhd})" --log-file /volume1/downloads/amc.log --action move -non-strict "/volume1/downloads/complete" --def subtitles=en --conflict auto --def pushover=****:**** --def clean=y --def "ut_label=movie"
before that I had

Code: Select all

--def "movieFormat=Movies/{fn}"
What is the difference between --format and --def movieFormat?
User avatar
rednoah
The Source
Posts: 22986
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: Remove language from subtitle name

Post by rednoah »

If you're using the amc script then --format has no effect. Instead you need to use the amc specific anime/series/movie format options.
:idea: Please read the FAQ and How to Request Help.
shotar
Posts: 8
Joined: 29 Jun 2015, 16:25

Re: Remove language from subtitle name

Post by shotar »

So what would be your suggestion? I'm using filebot just for renaming new downloaded movies. Should I modify the amc script or use the different filebot functions (which are rename, get subtitles and clean, correct?)?
User avatar
rednoah
The Source
Posts: 22986
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: Remove language from subtitle name

Post by rednoah »

You need to use --def movieFormat if you want to override the default format that is used for movies in the amc script. You don't have to modify the script.
:idea: Please read the FAQ and How to Request Help.
shotar
Posts: 8
Joined: 29 Jun 2015, 16:25

Re: Remove language from subtitle name

Post by shotar »

oh now I get it :D

Now I would like to add the IMDB rating and found this code on the forum:

Code: Select all

{net.sourceforge.filebot.WebServices.TMDb.getMovieInfo(movie, Locale.ENGLISH).rating}
but it doesn't seems to work..

Another question: If a subtitle is not found by hash, why Filebot is not searching with the movie name?
User avatar
rednoah
The Source
Posts: 22986
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: Remove language from subtitle name

Post by rednoah »

1.
FileBot does not support IMDB.

I recommend {rating} which is the rating from your chosen datasource:

Code: Select all

{rating}
Alternatively you can grab {omdb} data (which is NOT IMDB) specifically:

Code: Select all

{omdb.rating}
2.
Hash lookup is fast and reliable => good default
Name search is slow and unreliable => bad default

You can always call the suball script, for -non-strict subtitle search and other reasons => viewtopic.php?f=4&t=5#p8871
:idea: Please read the FAQ and How to Request Help.
Post Reply