How to match "year - director - moviename.ext"
-
- Posts: 4
- Joined: 27 Jul 2020, 12:33
How to match "year - director - moviename.ext"
Hi.
I am trying to figure out how to do the matchings for movies.
I have worked with regular expressions in two other programming languages, but find this very hard.
All my movies are in the format of "1984 - James Cameron - Peace and Love.mkv".
If I want to have the result "Peace and Love (1984)", I need to somehow identify the director name and then ignore it,or don't I?
I have tried to use the fn.after, but I can't figure out how to match after the second " - ".
In the "Format expressions" page https://www.filebot.net/naming.html I found that there is a function names "di", but I can't figure out how to use it.
And I'm not even sure if this is the way to go.
Any help would be greatly appreciated.
I am trying to figure out how to do the matchings for movies.
I have worked with regular expressions in two other programming languages, but find this very hard.
All my movies are in the format of "1984 - James Cameron - Peace and Love.mkv".
If I want to have the result "Peace and Love (1984)", I need to somehow identify the director name and then ignore it,or don't I?
I have tried to use the fn.after, but I can't figure out how to match after the second " - ".
In the "Format expressions" page https://www.filebot.net/naming.html I found that there is a function names "di", but I can't figure out how to use it.
And I'm not even sure if this is the way to go.
Any help would be greatly appreciated.
Re: How to match "year - director - moviename.ext"
Use Plain File Mode to pre-process your files into nice Name (Year) patterns first before matching them against TheMovieDB in a second step:
Code: Select all
{fn.after(" - ").after(" - ")} ({fn.before(" - ")})
Please read the FAQ and How to Request Help.
-
- Posts: 4
- Joined: 27 Jul 2020, 12:33
Re: How to match "year - director - moviename.ext"
Oh yes!
Thank you!
As usual, when you see the solution, you think "Oh, it was that easy...".
It would have taken me some time to figure that one out though.
Works like a charm!
Thanks a lot.
Thank you!
As usual, when you see the solution, you think "Oh, it was that easy...".
It would have taken me some time to figure that one out though.
Works like a charm!
Thanks a lot.
Re: How to match "year - director - moviename.ext"
or with regex
Code: Select all
{fn.replaceAll(/(^(?:19|20)\d{2}) - (.+) - (.+)$/),'$3 ($1) - $2'}
Peace and Love (1984) - James Cameron
Re: How to match "year - director - moviename.ext"
This also works quite nicely~
Code: Select all
{fn.split('-', 3)[2,0].join(' ')}
Please read the FAQ and How to Request Help.
-
- Posts: 4
- Joined: 27 Jul 2020, 12:33
Re: How to match "year - director - moviename.ext"
After some testing neither of these work very well.
When I create a preset (Named Movies and set datasource to TheMovieDB) and try {fn.replaceAll(/(^(?:19|20)\d{2}) - (.+) - (.+)$/),'$3 ($1) - $2'}, then "11940 - Anatole Litvak - City for Conquest.avi" becomes "City for Conquest (1940) - Anatole Litvak".
When using the format {fn.split('-', 3)[2,0].join(' ')} in file mode it can't find anything, but sends up the popup "Please identify the following files".
(Just a question on the split. Is the number 3 the third part? Does this mean that the split is 1-based and not 0-based?)
It seems to me that the {fn.after(" - ").after(" - ")} ({fn.before(" - ")}) gets more matches than the other two do.
When I create a preset (Named Movies and set datasource to TheMovieDB) and try {fn.replaceAll(/(^(?:19|20)\d{2}) - (.+) - (.+)$/),'$3 ($1) - $2'}, then "11940 - Anatole Litvak - City for Conquest.avi" becomes "City for Conquest (1940) - Anatole Litvak".
When using the format {fn.split('-', 3)[2,0].join(' ')} in file mode it can't find anything, but sends up the popup "Please identify the following files".
(Just a question on the split. Is the number 3 the third part? Does this mean that the split is 1-based and not 0-based?)
It seems to me that the {fn.after(" - ").after(" - ")} ({fn.before(" - ")}) gets more matches than the other two do.
Re: How to match "year - director - moviename.ext"
rednoah wrote: ↑28 Jul 2020, 11:40 Use Plain File Mode to pre-process your files into nice Name (Year) patterns first before matching them against TheMovieDB in a second step:Code: Select all
{fn.after(" - ").after(" - ")} ({fn.before(" - ")})
this new filename works 100%, sounds like you don't do the 2 stepsMagnusDaMan wrote: ↑29 Jul 2020, 12:39 When I create a preset (Named Movies and set datasource to TheMovieDB) and try {fn.replaceAll(/(^(?:19|20)\d{2}) - (.+) - (.+)$/),'$3 ($1) - $2'}, then "11940 - Anatole Litvak - City for Conquest.avi" becomes "City for Conquest (1940) - Anatole Litvak".
1. rename using this format
2. match using an other format e.g.
Code: Select all
{plex.tail}
-
- Posts: 4
- Joined: 27 Jul 2020, 12:33
Re: How to match "year - director - moviename.ext"
Ok. That renaming works perfect if there is only the movie file itself. I removed the name of the director, since I don't need it. I want to add a library to it as well, so I changed it to:
and then it works perfect for one file.
But when I have subtitles as well, then each subtitle get's it's own folder as well, so that becomes very weird.
I have to understand this second step as well. I am using Emby, so I guess plex is not right (or is it?). And in which format would this be used? In the movie format?
Code: Select all
{fn.replaceAll(/(^(?:19|20)\d{2}) - (.+) - (.+)$/),'./$3 ($1)/$3 ($1)'}
But when I have subtitles as well, then each subtitle get's it's own folder as well, so that becomes very weird.
I have to understand this second step as well. I am using Emby, so I guess plex is not right (or is it?). And in which format would this be used? In the movie format?
Re: How to match "year - director - moviename.ext"
1.
You'll need to adjust your format to account for subtitles as well. Please read How to Request Help if you need more specific help.
2.
{plex} will work just fine. Emby will be happy with standard Plex naming.
You'll need to adjust your format to account for subtitles as well. Please read How to Request Help if you need more specific help.
2.
{plex} will work just fine. Emby will be happy with standard Plex naming.
Please read the FAQ and How to Request Help.