Way to add LANGUAGE only when it isn't English?

All about user-defined episode / movie / file name format expressions
Bexorcist
Posts: 28
Joined: 20 Dec 2020, 14:48

Way to add LANGUAGE only when it isn't English?

Post by Bexorcist »

Hello,


Is there a way to add a LANGUAGE part in my renaming scheme but only when the language of the movie isn't English? Thx in advance!
User avatar
rednoah
The Source
Posts: 22923
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: Way to add LANGUAGE only when it isn't English?

Post by rednoah »

:?: {audioLanguages} audio stream language media information or {languages} spoken languages movie / series information?



e.g. yield nothing for files that have one or more English audio streams, among possibly others audio streams for other languages:

Code: Select all

{ audioLanguages =~ /eng/ ? null : audioLanguages }
e.g. yield nothing for files that have exactly one English audio stream:

Code: Select all

{ audioLanguages.size() == 1 && audioLanguages =~ /eng/ ? null : audioLanguages }
:idea: Please read the FAQ and How to Request Help.
Bexorcist
Posts: 28
Joined: 20 Dec 2020, 14:48

Re: Way to add LANGUAGE only when it isn't English?

Post by Bexorcist »

Thank u kindly! Will check this out!

I'm trying to add information to movies that are spoken in a different language (Japanese, French, etc. ) because they are automatically renamed to their English name by Filebot.

e.g.

Movie called 'L'adversaire' is now renamed 'The Adversary (2002) [Mystery, Nicole Garcia, 1080p]' in my current Filebot setup. I would like the program to rename it to 'The Adversary (2002) [FRENCH, Mystery, Nicole Garcia, 1080p]' for example but only when the movie isn't English.
kim
Power User
Posts: 1251
Joined: 15 May 2014, 16:17

Re: Way to add LANGUAGE only when it isn't English?

Post by kim »

Code: Select all

{plex.name} {allOf{ languages =~ /eng/ ? null : languages.name[0].upper() }{genre}{director}{vf}.joining(', ', ' [', ']')}
sample:
The Adversary (2002) [FRENCH, Mystery, Nicole Garcia, 1080p]
Bexorcist
Posts: 28
Joined: 20 Dec 2020, 14:48

Re: Way to add LANGUAGE only when it isn't English?

Post by Bexorcist »

kim wrote: 31 Jan 2022, 16:34

Code: Select all

{plex.name} {allOf{ languages =~ /eng/ ? null : languages.name[0].upper() }{genre}{director}{vf}.joining(', ', ' [', ']')}
sample:
The Adversary (2002) [FRENCH, Mystery, Nicole Garcia, 1080p]
Thx for the effort! I'm using this one atm:

Code: Select all

{ny.colon(/ - /)} [{genre}, {director}, {vf}]/{plex.name} [{genre}, {director}, {vf}]{subt}
I can't use {plex.name} because it fucks up the way I want my subtitles to be named.
Is there a way to combine my code with yours?
Bexorcist
Posts: 28
Joined: 20 Dec 2020, 14:48

Re: Way to add LANGUAGE only when it isn't English?

Post by Bexorcist »

This one seems to do the trick although it gives some strange results!
{ny.colon(/ - /)} {allOf{ languages =~ /eng/ ? null : languages.name[0].upper() }{genre}{director}{vf}.joining(', ', ' [', ']')}{subt}
Where does it get its information from concerning the language?

Thx for the brilliant code BTW!
kim
Power User
Posts: 1251
Joined: 15 May 2014, 16:17

Re: Way to add LANGUAGE only when it isn't English?

Post by kim »

what strange results! ?

https://www.themoviedb.org/movie/52999- ... uage=en-US

Code: Select all

{ plex.derive{allOf{ languages =~ /eng/ ? null : languages.name[0].upper() }{genre}{director}{vf}.joining(', ', ' [', ']')}.name }

Code: Select all

{(plex^ null).name } {allOf{ languages =~ /eng/ ? null : languages.name[0].upper() }{genre}{director}{vf}.joining(', ', ' [', ']')}{subt}
Plex Naming Schemes
viewtopic.php?p=23141#p23141
Bexorcist
Posts: 28
Joined: 20 Dec 2020, 14:48

Re: Way to add LANGUAGE only when it isn't English?

Post by Bexorcist »

For example, 'Black' (https://www.imdb.com/title/tt4008758/), a movie that's mostly french/dutch spoken is considered 'ARABIC' by the renaming scheme! :D
Bexorcist
Posts: 28
Joined: 20 Dec 2020, 14:48

Re: Way to add LANGUAGE only when it isn't English?

Post by Bexorcist »

kim wrote: 31 Jan 2022, 22:33 what strange results! ?

https://www.themoviedb.org/movie/52999- ... uage=en-US

Code: Select all

{ plex.derive{allOf{ languages =~ /eng/ ? null : languages.name[0].upper() }{genre}{director}{vf}.joining(', ', ' [', ']')}.name }

Code: Select all

{(plex^ null).name } {allOf{ languages =~ /eng/ ? null : languages.name[0].upper() }{genre}{director}{vf}.joining(', ', ' [', ']')}{subt}
Plex Naming Schemes
viewtopic.php?p=23141#p23141
What's the difference between these 2 codes? Should I use one for the main movie and the rest for the subs? I also noticed that your formula does not alter the FOLDER-name, which should also mention the movie's language. Is there a possiblity to achieve this? Do I just use the code 2 times?
Bexorcist
Posts: 28
Joined: 20 Dec 2020, 14:48

Re: Way to add LANGUAGE only when it isn't English?

Post by Bexorcist »

kim wrote: 31 Jan 2022, 22:33 what strange results! ?

https://www.themoviedb.org/movie/52999- ... uage=en-US

Code: Select all

{ plex.derive{allOf{ languages =~ /eng/ ? null : languages.name[0].upper() }{genre}{director}{vf}.joining(', ', ' [', ']')}.name }

Code: Select all

{(plex^ null).name } {allOf{ languages =~ /eng/ ? null : languages.name[0].upper() }{genre}{director}{vf}.joining(', ', ' [', ']')}{subt}
Plex Naming Schemes
viewtopic.php?p=23141#p23141
Mmm, naming is completely screwed now. My former formula took both movie and subs (with specific language indicator such as '.eng') and put them in one folder, ignoring all the filler. With the formulas u suggested I'm getting 2 seperate folders atm.

e.g.

Hellboy (2004) [Fantasy, Guillermo del Toro, 1080p] & Hellboy (2004) [Fantasy, Guillermo del Toro, 1080p].eng

The latter containing the subtitles.
I think my definitive naming scheme would be something like this:

Hellboy (2004) [Fantasy, Guillermo del Toro, 1080p]\Hellboy (2004)

with subtitles in the same folder named Hellboy (2004).eng.srt

Is that a plausible route?

Thx in advance!
kim
Power User
Posts: 1251
Joined: 15 May 2014, 16:17

Re: Way to add LANGUAGE only when it isn't English?

Post by kim »

Code: Select all

{ plex[1] }/{ plex.derive{allOf{ languages =~ /eng/ ? null : languages.name[0].upper() }{genre}{director}{vf}.joining(', ', ' [', ']')}.name }
Hellboy (2004)/Hellboy (2004) [Fantasy, Guillermo del Toro, 1080p]
Bexorcist
Posts: 28
Joined: 20 Dec 2020, 14:48

Re: Way to add LANGUAGE only when it isn't English?

Post by Bexorcist »

kim wrote: 01 Feb 2022, 22:11

Code: Select all

{ plex[1] }/{ plex.derive{allOf{ languages =~ /eng/ ? null : languages.name[0].upper() }{genre}{director}{vf}.joining(', ', ' [', ']')}.name }
Hellboy (2004)/Hellboy (2004) [Fantasy, Guillermo del Toro, 1080p]
Thx for the code but now it still puts the subs in a seperate folder.

When I use this:
E:\[Video]\{ plex.derive{allOf{ languages =~ /eng/ ? null : languages.name[0].upper() }{genre}{director}{vf}.joining(', ', ' [', ']')}.name }\{ plex[1] }
I get this for the sub folder:
E:/[Video]/Hellboy (2004) [Fantasy, Guillermo del Toro, 1080p].eng/Hellboy (2004)
Bexorcist
Posts: 28
Joined: 20 Dec 2020, 14:48

Re: Way to add LANGUAGE only when it isn't English?

Post by Bexorcist »

kim wrote: 01 Feb 2022, 22:11

Code: Select all

{ plex[1] }/{ plex.derive{allOf{ languages =~ /eng/ ? null : languages.name[0].upper() }{genre}{director}{vf}.joining(', ', ' [', ']')}.name }
Hellboy (2004)/Hellboy (2004) [Fantasy, Guillermo del Toro, 1080p]
Any suggestions? I'm kinda stuck here. :(
User avatar
rednoah
The Source
Posts: 22923
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: Way to add LANGUAGE only when it isn't English?

Post by rednoah »

{plex.name} includes the subtitle suffix for subtitle files. So you can't use that component for a folder level in your format.


e.g. generate file names and rename files in place:

Code: Select all

{plex.name}
e.g. generate absolute file paths to move files into a new file and folder structure:

Code: Select all

X:/Plex/{plex}

One of the suggestions above; use second folder and final file name component from the {plex} path; can work:

Code: Select all

{ plex[1] }/{ plex.name }
but then you turned it around for some reason, but that won't make sense, because you're using the file name component which includes .eng bit as folder level, so you get folders for each subtitle language, and more folders for non-subtitle files:

Code: Select all

{ plex.name }/{ plex[1] }

:?: Can you provide a few sample file path for what you want? I'm not actually sure what kinda file paths you want FileBot to generate at this point, since we're already pretty off-topic from the original question.



EDIT:

:idea: If you want to use the {plex} format but append to values to the movie / series folder name, then that would work like this:

Code: Select all

X:/Plex/{ plex * { allOf{ languages =~ /eng/ ? null : languages.name[0].upper() }{genre}{director}{vf}.joining(', ', ' [', ']') } }
rednoah wrote: 12 Sep 2016, 10:03 e.g. Avatar (2009) [M19995]/Avatar (2009)

Code: Select all

{ ~plex * " [M$id]" }
:idea: Please read the FAQ and How to Request Help.
Bexorcist
Posts: 28
Joined: 20 Dec 2020, 14:48

Re: Way to add LANGUAGE only when it isn't English?

Post by Bexorcist »

rednoah wrote: 03 Feb 2022, 00:33 [
One of the suggestions above; use second folder and final file name component from the {plex} path; can work:

Code: Select all

{ plex[1] }/{ plex.name }
but then you turned it around for some reason, but that won't make sense, because you're using the file name component which includes .eng bit as folder level, so you get folders for each subtitle language, and more folders for non-subtitle files:

Code: Select all

{ plex.name }/{ plex[1] }
I turned it around because the turned around version is what I initially asked for.

I would like to be my organisation like this:

e.g.

Code: Select all

X:/Dark Habits (1983) [SPANISH, Comedy, Pedro Almodóvar, 1080p]/Dark Habits (1983)
with

Code: Select all

X:/Dark Habits (1983) [SPANISH, Comedy, Pedro Almodóvar, 1080p]/Dark Habits (1983).eng.srt
in the same folder.

Important features are:
  • Language indicator other than English first in the specification list
  • Sub with language indicator (.eng or others) in subtitles
Main reason I want the name of the movie itself to be shorter is to avoid problems with path lengths.

I initially used this:
{ny.colon(/ - /)} [{genre}, {director}, {vf}]/{plex.name} [{genre}, {director}, {vf}]{subt}
to rename my movies and that worked perfectly but most importantly I need the language indicator in the folder's name.
User avatar
rednoah
The Source
Posts: 22923
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: Way to add LANGUAGE only when it isn't English?

Post by rednoah »

I see. I'd start with this example from the {plex} format manual:
rednoah wrote: 12 Sep 2016, 10:03 e.g. Avatar (2009) [M19995]/Avatar (2009)

Code: Select all

{ ~plex * " [M$id]" }
and then copy & paste your specification list code:

Code: Select all

X:/{ ~plex * { allOf{ languages =~ /eng/ ? null : languages.name[0].upper() }{genre}{director}{vf}.joining(', ', ' [', ']') } }



Alternatively, you can just add the { languages =~ /eng/ ? null : languages.name[0].upper() } bit into the format that you were previously happy with. I shall note though that your format uses {plex.name} incorrectly and so it will inject a ".eng" bit in the middle of the filename when processing subtitle files. It also doesn't account for undefined bindings, and so you might end up with [, , , 720p] in the specification bit for one file or another.
:idea: Please read the FAQ and How to Request Help.
Bexorcist
Posts: 28
Joined: 20 Dec 2020, 14:48

Re: Way to add LANGUAGE only when it isn't English?

Post by Bexorcist »

rednoah wrote: 03 Feb 2022, 00:33 EDIT:

:idea: If you want to use the {plex} format but append to values to the movie / series folder name, then that would work like this:

Code: Select all

X:/Plex/{ plex * { allOf{ languages =~ /eng/ ? null : languages.name[0].upper() }{genre}{director}{vf}.joining(', ', ' [', ']') } }
rednoah wrote: 12 Sep 2016, 10:03 e.g. Avatar (2009) [M19995]/Avatar (2009)

Code: Select all

{ ~plex * " [M$id]" }
This one seems to do exactly what I want, Rednoah! Thank u & Kim tremendously for your efforts! Best software in the world! :D
Bexorcist
Posts: 28
Joined: 20 Dec 2020, 14:48

Re: Way to add LANGUAGE only when it isn't English?

Post by Bexorcist »

rednoah wrote: 03 Feb 2022, 01:15 I see. I'd start with this example from the {plex} format manual:
rednoah wrote: 12 Sep 2016, 10:03 e.g. Avatar (2009) [M19995]/Avatar (2009)

Code: Select all

{ ~plex * " [M$id]" }
and then copy & paste your specification list code:

Code: Select all

X:/{ ~plex * { allOf{ languages =~ /eng/ ? null : languages.name[0].upper() }{genre}{director}{vf}.joining(', ', ' [', ']') } }



Alternatively, you can just add the { languages =~ /eng/ ? null : languages.name[0].upper() } bit into the format that you were previously happy with. I shall note though that your format uses {plex.name} incorrectly and so it will inject a ".eng" bit in the middle of the filename when processing subtitle files. It also doesn't account for undefined bindings, and so you might end up with [, , , 720p] in the specification bit for one file or another.
One final question: I tried using the formula for series as well but noticed (obviously) that the 'director' tag had to be removed due to different directors for different seasons. Is it possible to add the year in your given formula? I was experimenting with the {y}-code but can't seem to get it implemented in my formula. Thx in advance!
User avatar
rednoah
The Source
Posts: 22923
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: Way to add LANGUAGE only when it isn't English?

Post by rednoah »

Yes, you can just use y:

Code: Select all

X:/{ ~plex * { allOf{ languages =~ /eng/ ? null : languages.name[0].upper() }{genre}{y}{vf}.joining(', ', ' [', ']') } }

Code: Select all

X:/Firefly [Drama, 2002, 2160p]/Season 01/Firefly - S01E01 - Serenity
:idea: Please read the FAQ and How to Request Help.
Bexorcist
Posts: 28
Joined: 20 Dec 2020, 14:48

Re: Way to add LANGUAGE only when it isn't English?

Post by Bexorcist »

rednoah wrote: 03 Feb 2022, 14:20 Yes, you can just use y:

Code: Select all

X:/{ ~plex * { allOf{ languages =~ /eng/ ? null : languages.name[0].upper() }{genre}{y}{vf}.joining(', ', ' [', ']') } }

Code: Select all

X:/Firefly [Drama, 2002, 2160p]/Season 01/Firefly - S01E01 - Serenity
Yeah, that one I figured out but I was having trouble with getting it like this:
Firefly (2002) [Drama, 2160p]/Season 01/Firefly - S01E01 - Serenity
So the renaming is similar to my movie scheme. Sorry for my OCD acting up! :'(
Bexorcist
Posts: 28
Joined: 20 Dec 2020, 14:48

Re: Way to add LANGUAGE only when it isn't English?

Post by Bexorcist »

rednoah wrote: 03 Feb 2022, 14:20 Yes, you can just use y:

Code: Select all

X:/{ ~plex * { allOf{ languages =~ /eng/ ? null : languages.name[0].upper() }{genre}{y}{vf}.joining(', ', ' [', ']') } }

Code: Select all

X:/Firefly [Drama, 2002, 2160p]/Season 01/Firefly - S01E01 - Serenity
Hey Noah,

Any idea how to get the year as (XXXX) behind the movie name? Thx in advance!
User avatar
rednoah
The Source
Posts: 22923
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: Way to add LANGUAGE only when it isn't English?

Post by rednoah »

Use ny instead of n?
:idea: Please read the FAQ and How to Request Help.
Bexorcist
Posts: 28
Joined: 20 Dec 2020, 14:48

Re: Way to add LANGUAGE only when it isn't English?

Post by Bexorcist »

rednoah wrote: 04 Feb 2022, 12:09 Use ny instead of n?
Sorry, but I don't see the n-indicator in this formula:
X:/{ ~plex * { allOf{ languages =~ /eng/ ? null : languages.name[0].upper() }{genre}{y}{vf}.joining(', ', ' [', ']') } }
Am I blind? :D
User avatar
rednoah
The Source
Posts: 22923
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: Way to add LANGUAGE only when it isn't English?

Post by rednoah »

If you're using {plex} for movies then you will always get Name (Year) naming by default.


:?: Are we perhaps talking about TV Show naming and not Movie naming?
:idea: Please read the FAQ and How to Request Help.
Bexorcist
Posts: 28
Joined: 20 Dec 2020, 14:48

Re: Way to add LANGUAGE only when it isn't English?

Post by Bexorcist »

rednoah wrote: 05 Feb 2022, 10:53 If you're using {plex} for movies then you will always get Name (Year) naming by default.


:?: Are we perhaps talking about TV Show naming and not Movie naming?
Correct. I thought this was obvious since I gave a concrete example with Firefly.
Post Reply