Page 1 of 1

No Matching Genre - How to file in separate folder

Posted: 10 Jan 2017, 23:22
by MD500Pilot
Here is how I currently call filebot:

Code: Select all

/usr/bin/filebot -no-xattr -rename --db TheMovieDB -non-strict --log-file /root/filebot.log --action test --format /mount/media/Movies/"{any{genre}{'NoGenre'}} : {genres.contains('Comedy') ? 'Comedy' : genres.contains('Animation') ? 'Animation' : genres.contains('Science Fiction') ? 'Sci-Fi' : genres.contains('War') ? 'War' : genres.contains('Documentary') ? 'Documentary' : genres.contains('Fantasy') ? 'Fantasy': genres.contains('Sport') ? 'Sport': genres.contains('Horror') ? 'Horror': genres[0]}/{n} ({y})/{n} ({y})" /mount/media/pre-process/*
The problem that I am having is that a lot of my moves do not have Genres in TheMovieDB (verified by looking them up manually) and I want to put them in a folder all of their own. I added the:

Code: Select all

{any{genre}{'NoGenre'}}
to my cli command but now it is duplicating the genre when there is one but working properly when there is not one.

This is what I get now:

Code: Select all

Rename movies using [TheMovieDB]
Auto-detect movie from context: [/mount/media/pre-process/Heist.mkv]
Stripping invalid characters from new path: /mount/media/Movies/Crime : Crime/Heist (2015)/Heist (2015)
[TEST] Rename [/mount/media/pre-process/test/Heist.mkv] to [/mount/media/Movies/Crime Crime/Heist (2015)/Heist (2015).mkv]
Processed 1 files

I am sure I am missing something simple and looking for some guidance.


Thanks

Re: No Matching Genre - How to file in separate folder

Posted: 11 Jan 2017, 05:35
by rednoah
You're duplicating the genre part in your format. Please use the Format Editor GUI so you can quickly narrow down the problem. It's great for prototyping formats from scratch too.

Image

Re: No Matching Genre - How to file in separate folder

Posted: 11 Jan 2017, 15:08
by MD500Pilot
I do not have a GUI on the system this is installed so that is not possible. Any help with the command line part would be most appreciated.

Thank You

Re: No Matching Genre - How to file in separate folder

Posted: 11 Jan 2017, 15:16
by rednoah
You have a GUI on *this* system you're using right now.

1. Prototype your format in the Format Editor
2. Copy & paste into your bash script

Prototyping a format on the command-line is a waste of your time. I couldn't do it myself. :lol:


e.g.
Image

Re: No Matching Genre - How to file in separate folder

Posted: 11 Jan 2017, 15:36
by MD500Pilot
So...no idea why adding this: {any{genre}{'NoGenre'}} causes the problem?

Re: No Matching Genre - How to file in separate folder

Posted: 11 Jan 2017, 15:51
by rednoah
Your code effectively boils down to this:

Code: Select all

{any{genre}{'NoGenre'}} : {genres[0]}
Which unsurprisingly yields this result, exactly as specified by you:

Code: Select all

Crime : Crime
: is an invalid character and gets removed, so you end up with Crime Crime.


BAD CODE:

Code: Select all

{any{genre}{'NoGenre'}} : {genres.contains('Comedy') ? 'Comedy' : genres.contains('Animation') ? 'Animation' : genres.contains('Science Fiction') ? 'Sci-Fi' : genres.contains('War') ? 'War' : genres.contains('Documentary') ? 'Documentary' : genres.contains('Fantasy') ? 'Fantasy': genres.contains('Sport') ? 'Sport': genres.contains('Horror') ? 'Horror': genres[0]}/{n} ({y})/{n} ({y})
GOOD CODE:

Code: Select all

{any{genre}{'No Genre'}}/{ny}/{ny}

Re: No Matching Genre - How to file in separate folder

Posted: 11 Jan 2017, 16:42
by MD500Pilot
AH! Got it. I see what I did. THANK YOU. This now works perfectly:

Code: Select all

/usr/bin/filebot -no-xattr -rename --db TheMovieDB -non-strict --log-file /root/filebot.log --action test --format /mount/media/Movies/"{genres.contains('Comedy') ? 'Comedy' : genres.contains('Animation') ? 'Animation' : genres.contains('Science Fiction') ? 'Sci-Fi' : genres.contains('War') ? 'War' : genres.contains('Documentary') ? 'Documentary' : genres.contains('Fantasy') ? 'Fantasy': genres.contains('Sport') ? 'Sport': genres.contains('Horror') ? 'Horror': any{genre}{'NoGenre'}}/{n} ({y})/{n} ({y})" /mount/media/pre-process/*

Re: No Matching Genre - How to file in separate folder

Posted: 20 Aug 2023, 22:44
by Xvonmox
What if you are trying to include a conditional argument IF a genre exists?
For example FileBot gives off the following error when trying to reference the {genre} tag in the naming format on the TV Show "Parking Wars".

Code: Select all

Binding "genre": NoSuchElementException
Using your example from above...
rednoah wrote: 11 Jan 2017, 15:51

Code: Select all

{any{genre}{'No Genre'}}/{ny}/{ny}
...it will not produce the error and will just output 'No Genre'. However, what I am actually looking to do is if there is a genre, run a conditional argument to check if it's a Documentary Series. I have tried a few different ways, and any other way I have tried to reference the genre tag it kicks back that same error.

Any help would be greatly appreciated.

Re: No Matching Genre - How to file in separate folder

Posted: 21 Aug 2023, 02:59
by rednoah
e.g. check for a specific value, and then yield a specific value or yield no value, and yield no value on error:

Format: Select all

{ genres =~ /Documentary/ ? 'Documentary' : '' }
e.g. check for a specific value, and then yield a specific value or yield some other specific value, and yield no value on error:

Format: Select all

{ genres =~ /Documentary/ ? 'Documentary' : 'Not a Documentary' }
e.g. check for a specific value, and then yield a specific value or yield some other specific value, and yield yet another specific value on error:

Format: Select all

{ any{ genres =~ /Documentary/ ? 'Documentary' : 'Not a Documentary' }{ 'No genre, so probably not a Documentary' } }