Is it possible to automatically detect Marvel movies and put them in their own folder?

Any questions? Need some help?
Post Reply
Creamcups
Posts: 2
Joined: 24 Aug 2018, 00:09

Is it possible to automatically detect Marvel movies and put them in their own folder?

Post by Creamcups »

My current expression is

Code: Select all

/{y}/{genre}/{n.replaceAll(":", replacement = " - ")} ({y})
Would it be possible to automatically place marvel movies in their own folder while still keeping other movies seperate?
User avatar
rednoah
The Source
Posts: 22923
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: Is it possible to automatically detect Marvel movies and put them in their own folder?

Post by rednoah »

If you're lucky, and if TheMovieDB as full metadata on production companies, then this might work:

Code: Select all

{'Marvel Studios' in info.productionCompanies ? 'Marvel Movie' : 'Normal Movie'}
:idea: This one is tested with and works for at least Iron Man (2008). Not tested for any other Marvel movie, but it should probably mostly work.
:idea: Please read the FAQ and How to Request Help.
Creamcups
Posts: 2
Joined: 24 Aug 2018, 00:09

Re: Is it possible to automatically detect Marvel movies and put them in their own folder?

Post by Creamcups »

Works perfectly! Thank you!
AleXSR700
Posts: 18
Joined: 27 May 2022, 21:44

Re: Is it possible to automatically detect Marvel movies and put them in their own folder?

Post by AleXSR700 »

Hello everyone,
I found this helpful thread and was wondering if this can be used to add multiple filters.
I thought I could simply integrate them, but this does not seem to work.
Could someone help me get this working?

Code: Select all

{'Marvel Studios' in info.productionCompanies ? 'Marvel Movies' : {'DC Entertainment' in info.productionCompanies ? 'DC Comics Movies' : {'Lucasfilm' in info.productionCompanies ? 'Star Wars' : {'Eon Productions' in info.productionCompanies ? 'James Bond' : 'Movies'}}}}
User avatar
rednoah
The Source
Posts: 22923
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: Is it possible to automatically detect Marvel movies and put them in their own folder?

Post by rednoah »

Yes, you can do multiple if-then-else.


:?: What's not working? What is your test case(s)? What does the Format Editor say?
:idea: Please read the FAQ and How to Request Help.
kim
Power User
Posts: 1251
Joined: 15 May 2014, 16:17

Re: Is it possible to automatically detect Marvel movies and put them in their own folder?

Post by kim »

this works just fine ?

Code: Select all

{
	'Marvel Studios' in info.productionCompanies 
		? 'Marvel Movies' 
		: {'DC Entertainment' in info.productionCompanies 
			? 'DC Comics Movies' 
			: {'Lucasfilm' in info.productionCompanies 
				? 'Star Wars' 
				: {'Eon Productions' in info.productionCompanies 
					? 'James Bond' 
					: 'Movies'
				}
			}
		}
}
... if not working it's the rest of your format
AleXSR700
Posts: 18
Joined: 27 May 2022, 21:44

Re: Is it possible to automatically detect Marvel movies and put them in their own folder?

Post by AleXSR700 »

I tried a Marvel movie and it works. Then I tried a movie that matches Lucasfilms and one that matches none of the cases and I get

Code: Select all

./script1$_run_closure1$_closure2@584bdd47/The Matrix.....
So the path is a strange expression.

The preset editor says nothing.

It seems only the Marvel part (so the first IF) works.

My full expression is

Code: Select all

./{'Marvel Studios' in info.productionCompanies ? 'Marvel Movies' : {'DC Entertainment' in info.productionCompanies ? 'DC Comics Movies' : {'Lucasfilm' in info.productionCompanies ? 'Star Wars' : {'Eon Productions' in info.productionCompanies ? 'James Bond' : 'Movies'}}}}/{n.replaceAll(/[?*:]/,'.').upperInitial()} ({y}) {AudioLanguages} ({vf}.{vc}_{af}.{ac})
And everything else is working. Just not the path (which works if I remove the additional IF statements and only use one basic IF ELSE.
AleXSR700
Posts: 18
Joined: 27 May 2022, 21:44

Re: Is it possible to automatically detect Marvel movies and put them in their own folder?

Post by AleXSR700 »

I got it almost working by using old school if then else if instead of the above short-hand.

Code: Select all

{
	if ('Marvel Studios' in info.productionCompanies) {
		return "./Marvel"
	} else if ('DC Entertainment' in info.productionCompanies) {
		return "./DC Comics"
	} else if ('dc extended universe' in info.keywords) {
		return "./DC Comics"
	} else if ('Lucasfilm' in info.productionCompanies) {
		return "./Star Wars"
	} else if ('Eon Productions' in info.productionCompanies) {
		return "./James Bond"
	} else {
		return "."
	}
}/{n.replaceAll(/[?*:]/,'.').upperInitial()} ({y}) {AudioLanguages} ({vf}.{vc}_{af}.{ac})
But what is not working is
1. Keyword. Is info.keywords the wrong field? Or does TMDB handle keywords in a way that I have to change to e.g. "dc-extended-universe" or need to even add the keyword code?
2. The final else is being ignored. The if and else if are being processed, but the else is not.

Can somebody help me out?

Thank you
Alex
User avatar
rednoah
The Source
Posts: 22923
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: Is it possible to automatically detect Marvel movies and put them in their own folder?

Post by rednoah »

Your code works for my test case:

Code: Select all

'dc extended universe' in info.keywords

Code: Select all

$ filebot -list --q 791373 --db TheMovieDB --format "{ny} | {info.keywords} | {'dc extended universe' in info.keywords}"
Zack Snyder's Justice League (2021) | [superhero, based on comic, superhero team, dc extended universe, superhero teamup] | true
:?: What's your test case? Which movies (please paste TheMovieDB link) are you testing with where your code doesn't work as expected?
:idea: Please read the FAQ and How to Request Help.
AleXSR700
Posts: 18
Joined: 27 May 2022, 21:44

Re: Is it possible to automatically detect Marvel movies and put them in their own folder?

Post by AleXSR700 »

I tried it with Birds of Preyhttps://www.themoviedb.org/movie/495764 ... rley-quinn

Birds Of Prey (And The Fantabulous Emancipation Of One Harley Quinn) (2020)

I also tried it with Zack Snyder's Justice League. Same problem when using the code I posted.
User avatar
rednoah
The Source
Posts: 22923
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: Is it possible to automatically detect Marvel movies and put them in their own folder?

Post by rednoah »

Here's what I see:

Image

:?: What do you see?
:idea: Please read the FAQ and How to Request Help.
AleXSR700
Posts: 18
Joined: 27 May 2022, 21:44

Re: Is it possible to automatically detect Marvel movies and put them in their own folder?

Post by AleXSR700 »

I am not sure which screen that is :(
I just put the code I created above into the preset and then run the preset on a file. And then the folder is not adjusted. So either it is not finding the keyword or is ignoring the search for a keyword.
User avatar
rednoah
The Source
Posts: 22923
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: Is it possible to automatically detect Marvel movies and put them in their own folder?

Post by rednoah »

You'll want to use the FileBot Desktop application to prototype your custom format code, if you're not doing so already:
https://www.filebot.net/naming.html

:arrow: Double-Click <New Names Item> ➔ Edit Format

Image


:arrow: Please watch the video tutorials to familiarize yourself with typical usage:
https://youtu.be/cihWAvDW7MM


:idea: Presets just automate the setting of various settings (e.g. custom format, language preferences, database preferences, etc) so it's best to familiarize yourself with FileBot (and custom formats in this case) first, before automating your various use cases. If you only have one use case then you don't need presets at all, because you can just configure FileBot for that one use case and leave it at that.
:idea: Please read the FAQ and How to Request Help.
AleXSR700
Posts: 18
Joined: 27 May 2022, 21:44

Re: Is it possible to automatically detect Marvel movies and put them in their own folder?

Post by AleXSR700 »

I used to use that, but since I cannot change the sample (nothing happens when I push the folder icon to open a new media file), I simply write the code and then test it.
User avatar
rednoah
The Source
Posts: 22923
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: Is it possible to automatically detect Marvel movies and put them in their own folder?

Post by rednoah »

AleXSR700 wrote: 28 May 2022, 15:35 I used to use that, but since I cannot change the sample (nothing happens when I push the folder icon to open a new media file), I simply write the code and then test it.
Double-Click <New Names Item> ➔ Edit Format to prototype your custom format using the currently selected file / movie pair as sample information. You'll want to do that because you'll want rapidly test your custom format on various movies.


:idea: If you see the Image Sample file has not been set. Click "Change Sample" to select a sample file. message then you can click on that message and then select a sample file, or click on the Image button. You will see this message because {audioLanguages} {vf} {vc} and friends require a sample media file. In this case it's probably more important to set the Match Object to a movie you can test your conditions with though. Media File can be any file that has some audio stream so you can see a few values when testing.

Image
:idea: Please read the FAQ and How to Request Help.
AleXSR700
Posts: 18
Joined: 27 May 2022, 21:44

Re: Is it possible to automatically detect Marvel movies and put them in their own folder?

Post by AleXSR700 »

A sample is set. It is the same as yours. Avatar. But I cannot change it. When I try setting a new sample and then click the folder icon in the last screen you posted, nothing happens.

I will try with the prototyping. I hope it supports the if else if else statement. Although I don't see how that would work there and not in a preset.
User avatar
rednoah
The Source
Posts: 22923
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: Is it possible to automatically detect Marvel movies and put them in their own folder?

Post by rednoah »

There are different ways of opening the format editor, but the language will always work the same. If you open it via Double-Click <New Names Item> ➔ Edit Format then the "sample data" is locked to the real data that you are currently working with. Otherwise it'll use generic sample data (i.e. Avatar as movie object; no file object) and in this case you can change things to better suit your testing needs.


e.g. if you open the Format Editor from your Preset via the Image button then it'll use a sample movie object and sample file that you can adjust to your needs via Image Change SampleImage Select Match like so:
Image


:arrow: If you continue to have trouble, please post a screenshot so that we can see where you're stuck.
:idea: Please read the FAQ and How to Request Help.
AleXSR700
Posts: 18
Joined: 27 May 2022, 21:44

Re: Is it possible to automatically detect Marvel movies and put them in their own folder?

Post by AleXSR700 »

I know it should behave like that, but it does not. Nothing opens. I cannot chose anything :(
User avatar
rednoah
The Source
Posts: 22923
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: Is it possible to automatically detect Marvel movies and put them in their own folder?

Post by rednoah »

rednoah wrote: 28 May 2022, 16:50 :arrow: If you continue to have trouble, please post a screenshot so that we can see where you're stuck.
Please post a screenshot of the windows you see and the button you're trying to click when nothing happens. Then we can use the screenshot above and compare to make sure that we are on the same page. That is the first step to figuring it out.
:idea: Please read the FAQ and How to Request Help.
AleXSR700
Posts: 18
Joined: 27 May 2022, 21:44

Re: Is it possible to automatically detect Marvel movies and put them in their own folder?

Post by AleXSR700 »

I cannot post pictures on this forum without an external filehost.

I am in the window "Movie Bindings" and then press the yellow folder icon next to "Media File".
User avatar
rednoah
The Source
Posts: 22923
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: Is it possible to automatically detect Marvel movies and put them in their own folder?

Post by rednoah »

You're clicking on the wrong button. Please click on the other button. You'll want to change the field that says Avatar (2009) to the movie you want to test with by clicking on the button next to that field.

Image

:idea: Match Object is your sample Movie match object. Movie-based bindings such as {n} or {id} or {info.productionCompanies} depend on the sample Movie match object.
:idea: Media File is your sample file. File-based bindings such as {audioLanguage} or {vc} depend on the sample file.


rednoah wrote: 28 May 2022, 16:50 :arrow: If you continue to have trouble, please post a screenshot so that we can see where you're stuck.
:idea: If you click on screenshot then, then you will go to https://snipboard.io/ where you can post pictures. Perhaps useful for next time.
:idea: Please read the FAQ and How to Request Help.
Post Reply