Specific Genre naming based on several genres.
Specific Genre naming based on several genres.
So i've looked through the forum, and kinda found info on this. but i'm having an issue.
I want to define my own custom genres. based on the genres the movie has.
For example, I want movies that have Documentary|History|Biography & Drama To be sorted into: Docudrama
I have:
{(imdb.genres.contains('Drama') && imdb.genres.contains('Biography')) ? '[Docudrama]' : imdb.genres.take(1)}
Which works. But how do i add other genres to check?
I've tried:
{(imdb.genres.contains('Drama') && (imdb.genres.contains('History') || imdb.genres.contains('Biography'))) ? '[Docudrama]' : imdb.genres.take(1)}
which that doesn't work. - or is there another way to do it? - Right now this is the only one I can think of that I want, but i might want to add more later on.
ideally i'd like it to be as easy as editing a csv file. but i don't think that's possible with multiple genres sadly.
So something else i've noticed the imdb.genres returns with [ and ] around it. is there a way to change/disable that? I tried the .replace() and that didn't work.
Thanks,
-Dev
I want to define my own custom genres. based on the genres the movie has.
For example, I want movies that have Documentary|History|Biography & Drama To be sorted into: Docudrama
I have:
{(imdb.genres.contains('Drama') && imdb.genres.contains('Biography')) ? '[Docudrama]' : imdb.genres.take(1)}
Which works. But how do i add other genres to check?
I've tried:
{(imdb.genres.contains('Drama') && (imdb.genres.contains('History') || imdb.genres.contains('Biography'))) ? '[Docudrama]' : imdb.genres.take(1)}
which that doesn't work. - or is there another way to do it? - Right now this is the only one I can think of that I want, but i might want to add more later on.
ideally i'd like it to be as easy as editing a csv file. but i don't think that's possible with multiple genres sadly.
So something else i've noticed the imdb.genres returns with [ and ] around it. is there a way to change/disable that? I tried the .replace() and that didn't work.
Thanks,
-Dev
Re: Specific Genre naming based on several genres.
I'd set up my own CSV file that maps the original genre value to something you like.
Sample

Code: Select all
{csv('mygenres.csv').get(genre) ?: genre}
Re: Specific Genre naming based on several genres.
Yeah, I did that with my TV Show naming. but with the movies, in this example it's a little more complicated.
I want to separate into a new folder, but only if multiple genres exist.
Drama + Biography or History. and with a csv file, that's not possible, is it?
I want to separate into a new folder, but only if multiple genres exist.
Drama + Biography or History. and with a csv file, that's not possible, is it?
Re: Specific Genre naming based on several genres.
So in theory, Could'nt I do something like:
{(imdb.genres.contains('Drama') && imdb.genres.contains('Biography')) ? {csv('mygenres.csv').get(genre) ?: Drama-Biography} : imdb.genres.take(1)}
{(imdb.genres.contains('Drama') && imdb.genres.contains('History')) ? {csv('mygenres.csv').get(genre) ?: Drama-History} : imdb.genres.take(1)}
no. cause that would have it twice as long and put the default genre twice. Hmm.
{(imdb.genres.contains('Drama') && imdb.genres.contains('Biography')) ? {csv('mygenres.csv').get(genre) ?: Drama-Biography} : imdb.genres.take(1)}
{(imdb.genres.contains('Drama') && imdb.genres.contains('History')) ? {csv('mygenres.csv').get(genre) ?: Drama-History} : imdb.genres.take(1)}
no. cause that would have it twice as long and put the default genre twice. Hmm.
Re: Specific Genre naming based on several genres.
For long if-then-else-if-then-else-etc chains you might be able to use one of my helper functions:
@see viewtopic.php?f=5&t=1895
Maybe any{a}{b}{c}{'default'} would help?
Note that {imdb} has been removed, and {omdb} has been added, which should be pretty much the same. Though I still discourage mixing data from different datasources.
@see viewtopic.php?f=5&t=1895
Maybe any{a}{b}{c}{'default'} would help?
Note that {imdb} has been removed, and {omdb} has been added, which should be pretty much the same. Though I still discourage mixing data from different datasources.
Re: Specific Genre naming based on several genres.
I was able to get that to work with some RegEx, thank you.
and why would ya remove the imdb?
I only used imdb.genres instead of genres. as the 'genres' for the ones i tested on, only showed 1 genre, and randomly it would show 2. and they were completely different than the imdb ones and I wanted to keep consistency with my other files.
and why would ya remove the imdb?
I only used imdb.genres instead of genres. as the 'genres' for the ones i tested on, only showed 1 genre, and randomly it would show 2. and they were completely different than the imdb ones and I wanted to keep consistency with my other files.
Re: Specific Genre naming based on several genres.
I was able to get it working with:
{any{if (imdb.genres.join(', ').matchAll(/^(?=.*Drama)(?=.*Biography|History)/)){'[Docudrama]'}}{imdb.genres.take(1)}}
I couldn't think of a way to use the csv file, that would make it easier to add too. but this works. i can just keep adding to it, if i need to add say Dramedy. or Dark Comedy.
{any{if (imdb.genres.join(', ').matchAll(/^(?=.*Drama)(?=.*Biography|History)/)){'[Docudrama]'}}{imdb.genres.take(1)}}
I couldn't think of a way to use the csv file, that would make it easier to add too. but this works. i can just keep adding to it, if i need to add say Dramedy. or Dark Comedy.
Re: Specific Genre naming based on several genres.
I'm trying to sort films into different folders based on the language:
However movie always goes to 'English' folder. What's wrong with this snippet? 
Code: Select all
def movieformat="//mnt/MyMedia/{omdb.language.contains('Hindi') ? 'Hindi' : 'English' }/..... "

Re: Specific Genre naming based on several genres.
1.
I don't recommend using {omdb} unless you have a good reason to do so.
2.
TheMovieDB has SpokenLanguages metadata, so that should work:
PS: Smart people use the FileBot GUI to prototype and test their new formats quickly before pasting them into the command-line.
omdb.language does not contain "Hindi". That's all I can tell you.What's wrong with this snippet?

2.
TheMovieDB has SpokenLanguages metadata, so that should work:
Code: Select all
{info.SpokenLanguages =~ /de/ ? 'German' : 'Not German'}
PS: Smart people use the FileBot GUI to prototype and test their new formats quickly before pasting them into the command-line.
Re: Specific Genre naming based on several genres.
Searching Examples section at http://www.omdbapi.com/ gives:
So I presume "Hindi" language is there. Will try moviedb today. And , I run filebot headless on a Pi, Yeah..We not so smart folks! 
Code: Select all
{"Title":"Airlift","Year":"2016","Rated":"N/A","Released":"22 Jan 2016","Runtime":"N/A","Genre":"Drama, History, Thriller","Director":"Raja Menon","Writer":"Ritesh Shah, Suresh Nair, Raja Menon, Rahul Nangia","Actors":"Akshay Kumar, Nimrat Kaur, Feryna Wazheir, Pawan Chopra","Plot":"Airlift is an uplifting and entertaining edge-of-the-seat thriller and is the story of the biggest ever human evacuation in the history of mankind.","Language":"[b]Hindi[/b]","Country":"India","Awards":"N/A","Poster":"http://ia.media-imdb.com/images/M/MV5BMTAzZmJiOGQtOWM3NS00MDEwLWJiNGEtN2QzMDM3NDJjMWQwXkEyXkFqcGdeQXVyNDUzOTQ5MjY@._V1_SX300.jpg","Metascore":"N/A","imdbRating":"N/A","imdbVotes":"N/A","imdbID":"tt4387040","Type":"movie","Response":"True"}

Re: Specific Genre naming based on several genres.
That "language" field is currently not mapped the SpokenLanguages property, so you won't be able to (easily) access it from the format. I'll fix that for the next release, but you should be using TheMovieDB instead anyway. 

Re: Specific Genre naming based on several genres.
Hi Hoarder, I have a similar need in which I want to sort movies, series and animes (including animation) into different folders based on the language.DHoarder wrote:I'm trying to sort films into different folders based on the language:
However movie always goes to 'English' folder. What's wrong with this snippet?Code: Select all
def movieformat="//mnt/MyMedia/{omdb.language.contains('Hindi') ? 'Hindi' : 'English' }/..... "
I am pretty new to filbert and close to total ignorant about coding but not afraid to try kind of guy

Have you sorted your script out to your likings at all? Would you be able to help please?
Re: Specific Genre naming based on several genres.
This seems to be working for me in AMC script:Hi Hoarder, I have a similar need in which I want to sort movies, series and animes (including animation) into different folders based on the language.
I am pretty new to filbert and close to total ignorant about coding but not afraid to try kind of guy
Have you sorted your script out to your likings at all? Would you be able to help please?
Code: Select all
--def "movieFormat=//mnt/MyMedia/{info.genres.contains('Documentary') ? 'Documentaries': info.SpokenLanguages =~ /hi/ ? 'Hindi' : 'Movies'}/........
Re: Specific Genre naming based on several genres.
This would be shorter

Code: Select all
/mnt/Media/{genres =~ /Documentary/ ? 'Documentaries': languages =~ /hi/ ? 'Hindi' : 'Movies'}/...