Can't rename subtitle properly

Any questions? Need some help?
Post Reply
raxer
Posts: 3
Joined: 30 Mar 2016, 12:40

Can't rename subtitle properly

Post by raxer »

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
group-movie-1080p-eng.idx
group-movie-1080p-eng.sub
group-movie-1080p-forced.idx
group-movie-1080p-forced.sub
group-movie-1080p.idx
group-movie-1080p.sub
Now i want them in this format:

Code: Select all

Movie (2016)/Movie (2016) - 1080p.mkv
Movie (2016)/Movie (2016) - 1080p.eng.idx
Movie (2016)/Movie (2016) - 1080p.eng.sub
Movie (2016)/Movie (2016) - 1080p.ger.forced.idx
Movie (2016)/Movie (2016) - 1080p.ger.forced.sub
Movie (2016)/Movie (2016) - 1080p.ger.idx
Movie (2016)/Movie (2016) - 1080p.ger.sub
but i am not able to create nested if clauses. also i don't know how to tell filebot that the main video file has the resolution 1080p which should also appear in the subtitle name.

with my naming scheme:

Code: Select all

/movies/{n.upperInitial().space(' ')} ({y})/{n.upperInitial().space(' ')} ({y}) - {vf}{mediaType[0].match(/subtitle/) ? fn.match(/[-_]+eng/) ? fn.match(/[-_]+forced/) ? '.eng.forced' : '.eng' : fn.match(/[-_]+forced/) ? '.ger.forced' : '.ger' : ''}
i always get:

Code: Select all

Movie (2016)/Movie (2016) - 1080p.mkv
Movie (2016)/Movie (2016) - .idx
Movie (2016)/Movie (2016) - .sub
Movie (2016)/Movie (2016) - .idx
Movie (2016)/Movie (2016) - .sub
Movie (2016)/Movie (2016) - .idx
Movie (2016)/Movie (2016) - .sub
User avatar
rednoah
The Source
Posts: 23953
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: Can't rename subtitle properly

Post by rednoah »

Here's the solution:

Code: Select all

{ny} - {vf} {fn =~ /[.]eng$/ ? '.eng' : '.ger' }{'.'+fn.match(/forced/)}
:idea: If you use my code, then you must also make a donation.
:idea: Please read the FAQ and How to Request Help.
traxxus
Posts: 8
Joined: 27 Aug 2015, 08:50

Re: Can't rename subtitle properly

Post by traxxus »

rednoah wrote:Here's the solution:

Code: Select all

{ny} - {vf} {fn =~ /[.]eng$/ ? '.eng' : '.ger' }{'.'+fn.match(/forced/)}
:idea: If you use my code, then you must also make a donation.
If i use this, the MKV file has also .ger or .eng - how to avoid this?
User avatar
rednoah
The Source
Posts: 23953
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: Can't rename subtitle properly

Post by rednoah »

Example:

Code: Select all

{if (file.subtitle) fn =~ /[.]eng$/ ? '.eng' : '.ger' }
The the latest revision / RC build you can just do {subt} for all the subtitle language/category tags, though language detection might not be as accurate as just forcing between eng/ger manually.
:idea: Please read the FAQ and How to Request Help.
traxxus
Posts: 8
Joined: 27 Aug 2015, 08:50

Re: Can't rename subtitle properly

Post by traxxus »

Will / is this feature {subt} be implemented in the AMC script?
raxer
Posts: 3
Joined: 30 Mar 2016, 12:40

Re: Can't rename subtitle properly

Post by raxer »

Thanks for the help.

Is it possible to get the resolution of a video file in the same folder as the subtitle?

For example i want "1080p" in the subtitle file.

I would do the following procedure:
- List all files in the same folder like the subtitle
- Find the first movie file in the folder
- get the resolution
- Paste it to the subtitle file

Is this possible as format expression?
User avatar
rednoah
The Source
Posts: 23953
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: Can't rename subtitle properly

Post by rednoah »

If the subtitle filename matches the movie filename, then this behaviour is default, i.e. all mediainfo/file bindings will work based on the movie file when formatting the corresponding subtitle file.
:idea: Please read the FAQ and How to Request Help.
raxer
Posts: 3
Joined: 30 Mar 2016, 12:40

Re: Can't rename subtitle properly

Post by raxer »

I've tested it and it works. Thanks a lot!
s25a
Posts: 2
Joined: 19 Jun 2016, 08:37

Re: Can't rename subtitle properly

Post by s25a »

Hi,

I have the same question / issue like the author of this thread. As I do not understand all the scripting can someone help and post the final and complete code for the correct renaming?
If I use the code

Code: Select all

{ny} - {vf} {fn =~ /[.]eng$/ ? '.eng' : '.ger' }{'.'+fn.match(/forced/)}
the Videofile is llso renamed with .ger as mentioned above.

and I am not sure where to put this correctly

Code: Select all

{if (file.subtitle) fn =~ /[.]eng$/ ? '.eng' : '.ger' }
Thanks

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

Re: Can't rename subtitle properly

Post by rednoah »

1.
Have you tried using the subt binding?

Code: Select all

{subt}
2.
Where to put this? Just take a few example files, put it anywhere in your format, and see what happens:

Code: Select all

{if (file.subtitle) fn =~ /[.]eng$/ ? '.eng' : '.ger'}
Just play with it. You'll figure it out.
:idea: Please read the FAQ and How to Request Help.
s25a
Posts: 2
Joined: 19 Jun 2016, 08:37

Re: Can't rename subtitle properly

Post by s25a »

Hi,

thank you so much for the quick answer :-)

To be honest - I have absolutely no idea what this all do so if you wnat me to play with that I even do not know where to start. :?
Have you tried using the subt binding?
What exactly do you mean by that?

Appreciate your support

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

Re: Can't rename subtitle properly

Post by rednoah »

Open the format editor and start "coding" and see what happens. There's plenty of examples you can look at. First you copy something that works, then you slightly modify it and see if it still works. That's how you figure it out. ;)

* http://www.filebot.net/naming.html
* http://www.filebot.net/forums/viewtopic.php?f=5&t=2#p51

There's some help on custom formats in this video tutorial around the 8 minute mark:
https://www.youtube.com/watch?v=zcSFKiwFLZw

Image
:idea: Please read the FAQ and How to Request Help.
Post Reply