first letter of directors name

All about user-defined episode / movie format expressions
Post Reply
rainbow
Posts: 7
Joined: 21 Feb 2019, 19:53

first letter of directors name

Post by rainbow » 21 Feb 2019, 20:07

Hi all,
I haven't found answers to these, even though they're pretty simple questions-

What I want to do is include a movies director in my filename, but I want only the first letter of the first name, like this: 'J. Cameron', and I'd like to do the same for the first two items in actors[]. What is the best way to do this?

Also, I found rednoah mentioning {az} a number of times, and {model}, yet neither is mentioned in the reference found here: https://www.filebot.net/naming.html
Is there a more complete / up to date reference of bindings and functions somewhere else?

Oh and something else- I have added language 'tags' to my filenames by hand already for some files, like this: 'filename [english]', or filename[french]. Is it possible to carry them over to the new filenames, if they exist?

I hope I posted to the right forum, feel free to move this if I didn't. And thanks in advance :)

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

Re: first letter of directors name

Post by rednoah » 22 Feb 2019, 05:29

1.
This will work for "James Cameron" but what should happen for "Home Jay Simpson" is somewhat undefined:

Code: Select all

{director.replaceFirst(/(\w)(\w+) (\w+)/, '$1. $3')}
Here's how you'd apply this to the first two actors:

Code: Select all

{actors.take(2)*.replaceFirst(/(\w)(\w+) (\w+)/, '$1. $3')}

2.
{az} is just the first letter of the name, in case you want to organize files into A-Z folders.

e.g.

Code: Select all

Movies/{az}/{ny}/{ny}

3.
{model} is a meta binding. If {az} and {director} is the value for the current file item, then {model.az} and {model.director} will give you the value for all items in the current file group.

e.g.

Code: Select all

Season {model.s.bounds().join('-')}/{episode}

Code: Select all

Season 1-5/Alias - 1x05 - Doppelgänger
(if processing all 5 seasons at once)


EDIT: Added some documentation for that: viewtopic.php?f=5&t=9814


4.
Bindings are best explored in the built-in reference, since it's more interactive and allows you to see how different movie / object items give you different values.
Image


5.
You can use fn.match(/pattern/) to carry over arbitrary text patterns from the original filename.

e.g. just the first tag:

Code: Select all

{fn.match(/\[\w+\]/)}
e.g. all the words in brackets:

Code: Select all

{fn.matchAll(/\[\w+\]/).join(' ')}
:idea: Please read the FAQ and How to Request Help.

rainbow
Posts: 7
Joined: 21 Feb 2019, 19:53

Re: first letter of directors name

Post by rainbow » 22 Feb 2019, 10:22

thanks, that's quite helpful.

rainbow
Posts: 7
Joined: 21 Feb 2019, 19:53

Re: first letter of directors name

Post by rainbow » 22 Feb 2019, 11:32

I guess I have to ask again, can't seem to figure it out... My 'manual tags' unfortunately are a bit inconsistent, they can be either one of the below list. So I tried this (and a number of variations of it):

Code: Select all

{fn.match(['english', 'eng', 'french', 'deutsch', 'deu'])}
...in an effort to find out if any of the list items is present in the original filename and if so, carry it over to the new filename. Nothing I tried worked - how would I do this?

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

Re: first letter of directors name

Post by rednoah » 22 Feb 2019, 11:39

1.
The match function expects are regular expression:
https://regexr.com/

e.g.

Code: Select all

{fn.match(/english|eng|french|deutsch|deu/)}

2.
If you're trying match the audio language or the subtitle language, then depending on your files, you may be able to extract that information from the file contents directly:

Code: Select all

{audioLanguages}

Code: Select all

{textLanguages}
:idea: Please read the FAQ and How to Request Help.

rainbow
Posts: 7
Joined: 21 Feb 2019, 19:53

Re: first letter of directors name

Post by rainbow » 22 Feb 2019, 11:56

thanks, that works great :) the {audioLanguages} tag seems to rarely contain any data, though, but that's no big deal.

rainbow
Posts: 7
Joined: 21 Feb 2019, 19:53

Re: first letter of directors name

Post by rainbow » 25 Feb 2019, 03:04

I double checked and indeed {audioLanguages} are empty in the vast majority of files, looks like no one bothers to put anything there. And unfortunately I live in a country where nearly every movie gets dubbed...

So without having much hope, and admitting this might be a veery stupid question since its veery late here - is there any way (maybe even outside of fileBot) to find out if a movie / video file is dubbed? Without wanting to know the specific language, just a yes/no answer, is dubbed / is not dubbed?

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

Re: first letter of directors name

Post by rednoah » 25 Feb 2019, 03:15

Well, that's too bad. In my experience, mkv and mp4 files are usually tagged, so that players like VLC can show you what audio languages are available. If it's older avi files, then they're usually not tagged.

Alternatively, the {languages} will give you the spoken languages as per TheMovieDB, so you could check that, and just assume that a movie is dubbed if the original language is not your native language.
:idea: Please read the FAQ and How to Request Help.

Post Reply