3D in file name seems to get ignored

All about user-defined episode / movie / file name format expressions
Post Reply
ChefGregS
Posts: 99
Joined: 30 Mar 2016, 11:14

3D in file name seems to get ignored

Post by ChefGregS »

Doing some testing. I have a file named:

Spider-Man (2018) 3D - Into the Spider-Verse

And I am testing this expression:

Code: Select all

{n =~ 'P90X' ? 'M:/Workouts' : n =~ '3D' ? 'Y:/test crap' : n =~ 'X-Rated' ? 'M:/Movies P' : 'M:/Movies/'}
In this the new name is always going to M:/Movies

However, if I switch the 3D to Man the new name goes to Y:/test crap

I don't understand why it won't pick up the 3D but does pick it up if I change that to Man.

Also, just so you know I tested it several ways, I tried moving 3D to the front of the name: 3D Spider-Man (2018).. Same results. Won't pick up the 3D but picks up Man if I use that. However, running more tests shows it won't pick up if I make it 'The' but does work if I make it 'Verse'

I am scratching my head......

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

Re: 3D in file name seems to get ignored

Post by rednoah »

:?: Are you using Movie Mode or Plain File Mode?


:?: What is the value of n? Use {n} as format and see for yourself.


:idea: In Movie Mode, n is the movie name, and fn is the current file name. The movie name Spider-Man: Into the Spider-Verse does not contain the word "3D" but does contain "Man" and "Verse".


:arrow: You probably meant to use fn to check if the current file name, as opposed to the movie name, contains the keyword "3D".
:idea: Please read the FAQ and How to Request Help.
ChefGregS
Posts: 99
Joined: 30 Mar 2016, 11:14

Re: 3D in file name seems to get ignored

Post by ChefGregS »

Ok...doh! Yes, I am using movie mode. And I didn't think about fn. I mean, just because the fn stands for File Name, why would I possibly think of using that? LOL!!!!

That, of course, solved the problem. The funny thing is that I even have the page open that shows me all the attributes and their values. Just missed that.

As always, thank you!

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

Re: 3D in file name seems to get ignored

Post by rednoah »

It happens. Cheers.
:idea: Please read the FAQ and How to Request Help.
ChefGregS
Posts: 99
Joined: 30 Mar 2016, 11:14

Re: 3D in file name seems to get ignored

Post by ChefGregS »

Using my code how would I have it search n and fn? Or any 2 variables for that matter? I can think of a few things I may like to use that for. This example (where to put the file) is a great example of one way I'd like to use it. So it should check both to see if the word is found, and if so set the folder to X.

Also, on those same lines, is there an order to when it stops matching? In other words, using my above example, what if the movie were an X-rated movie in 3D? Which folder would take precedence? Does it stop at the first match? The reason I'm asking is that I have some movies that I'd like to sort out (new format) but I'd like them to sort into folder A and not folder B. Even though they match both cases.

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

Re: 3D in file name seems to get ignored

Post by rednoah »

You can make your code more clear by writing it like this:
rednoah wrote: 03 Oct 2016, 18:53 e.g. Sort movies from different years into different destination folders:

Format: Select all

{
	if (y < 1960) {
		return "M:/Old Movies"
	} else if (y < 2000) {
		return "N:/Classic Movies"
	} else if (y < 2020) {
		return "O:/Modern Movies"
	} else {
		return "P:/New Movies"
	}
}
You can have all kinds of conditions. You can do different checks one after another. Your {...} can only return one value, so any kind of condition that relies on multiple values is just one more condition. The code is executed from top to bottom. The return value depends on Groovy semantics, i.e. in this case return ends execution and returns that value.


e.g.

Format: Select all

{
	if (fn =~ /3D/ && y >= 2020) {
		return "M:/Modern 3D Movies"
	}

	if (y >= 2020) {
		return "M:/Modern Movies"
	}

	return "M:/Other Movies"
}
:idea: Please read the FAQ and How to Request Help.
ChefGregS
Posts: 99
Joined: 30 Mar 2016, 11:14

Re: 3D in file name seems to get ignored

Post by ChefGregS »

That does make a lot more sense and more like I remember coding 40 years ago...thank you!
Greg
Post Reply