Is there a way to get the genre of a collection?

Any questions? Need some help?
Post Reply
Punt
Posts: 5
Joined: 05 Jun 2019, 08:12

Is there a way to get the genre of a collection?

Post by Punt » 05 Jun 2019, 10:57

Title.

For example, I have
  • The Matrix 1999 (genre=Action)
  • The Matrix Roloaded 2003 (genre=Adventure)
  • The Matrix Revolutions 2003 (genre= Adventure)
Is it possible to order my films like
  • Films/Genre/ all films (less collection films)
  • Films/Genre/CollectionName/collection films
So that for example for Matrix it would be
Films/Adventure/TheMatrixCollection/ the 3 films

Because if I just use {genre}
it would be the genre of the film, and so The Matrix 1999 would be in /Action/TheMatrixCollection and the other two would be in /Adventure/TheMatrixCollection ...


+ Quick question : Is it possible to order alphabetically {audioLanguages} ? Because sometimes I get [fra, eng] and sometimes [eng, fra].

Thanks!

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

Re: Is there a way to get the genre of a collection?

Post by rednoah » 05 Jun 2019, 11:28

1.
I'm pretty sure TheMovieDB doesn't have metadata like that for collections.

If you process the complete collection in one go, then you could use the {model} to just use the {genre} of the first related match:

Code: Select all

{model.find{ it.collection == collection }.genre}
:arrow: viewtopic.php?t=9814


2.
Sort audioLanguages using natural order:

Code: Select all

{audioLanguages.toSorted()}
:idea: Please read the FAQ and How to Request Help.

Punt
Posts: 5
Joined: 05 Jun 2019, 08:12

Re: Is there a way to get the genre of a collection?

Post by Punt » 05 Jun 2019, 11:50

Thanks for your quick answer.

The {model} is doing the job.
But not .toSorted() ...

I have

Code: Select all

Films/
{any{model.find{ it.collection == collection }.genre}{genre}}/
{collection}/
{audioLanguages.toSorted()} {ny.upperInitial()} - {vf}.{channels}.sub{textLanguages.toSorted()}.{ext}
As you can see, there's still a problem :
Image

Edit:

I tried with an order :

Code: Select all

{
	def langueOrder = ['eng': 1, 'fra': 2]
	audioLanguages.toSorted{ langueOrder[it] }
}
And result :

Image

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

Re: Is there a way to get the genre of a collection?

Post by rednoah » 05 Jun 2019, 15:05

Not sure what's going on there.

I guess explicitly sorting by 3-letter language code will work more reliably:

Code: Select all

{audioLanguages.toSorted{ it.ISO3 }}
:idea: Using a custom priority map as sort order makes sense though. Since you probably want custom sort order of languages, rather than plain alphabetic sort order.
:idea: Please read the FAQ and How to Request Help.

Punt
Posts: 5
Joined: 05 Jun 2019, 08:12

Re: Is there a way to get the genre of a collection?

Post by Punt » 06 Jun 2019, 23:45

Thanks! ISO3 did the job.
I'm happy with my current films collection, I used :

Code: Select all

Films/
{any{'Marvel Studios' in info.productionCompanies ? 'Marvel Movie' : null}{model.find{ it.collection == collection }.genre}{genre}}/
{collection}/
{ny.upperInitial()} {audioLanguages.toSorted{it.ISO3}} - {vf}.{channels}.sub{textLanguages.toSorted{it.ISO3}}.{ext}
I feel like collection's genre could be better, and that would cool if we could choose a list of favorite genres because...
Image
There's a lot of genres haha.

While trying to find a good format, I had some trouble to match a local film with a TheMovieDb film. I was trying to have something like the year first {y} then {audioLanguages} (ex: (2018) [fra,eng] movieName) and guess it had trouble using movies' name with with the previous information.

I think it could be a good idea to have a place where we could share some tips about this tool, so that people don't waste time trying to use the tool! If I had read a tip like "By passing the name of a movie at the very beggining of your format, It'll help the tool -in the future- to directly re-match movies with TheMovieDb" it would have win me some time lol.

But in the end, super cool tool! I was like "Well, my film collection is a big mess. Maybe I'll try to develop a tool to reformate the name and try to order film by genre or something like that." Then I found FileBot. Thanks for the good work!

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

Re: Is there a way to get the genre of a collection?

Post by rednoah » 07 Jun 2019, 03:39

1.
Customizing and prioritizing genres can be done. It’s a bit more code-y though.

:arrow: viewtopic.php?f=10&t=6068#p34992


2.
Since FileBot will store xattr metadata, FileBot will always be able to identify the file later regardless of the filename. Good naming is always a great good idea though.

:arrow: viewtopic.php?f=3&t=324#p2248
:idea: Please read the FAQ and How to Request Help.

Punt
Posts: 5
Joined: 05 Jun 2019, 08:12

Re: Is there a way to get the genre of a collection?

Post by Punt » 24 Jul 2019, 13:08

Hey I'm back :D

So how am I supposed to use the sorted genre ? I tried

Code: Select all

H:/Mes Films/
{any{'Marvel Studios' in info.productionCompanies ? 'Marvel Movie' : null}{model.find{ it.collection == collection }.genre}
{
	def genreOrder = ['Animation': 1, 'Comedy': 2, 'Horror': 3, 'Science-Fiction': 4, 'Adventure': 5, 'Romance': 6, 'Drama': 7, 'Action': 8].withDefault{ 100 }
	genres.toSorted{ genreOrder[it] }[0]
}}/
{collection}/
{ny.upperInitial()} {audioLanguages.toSorted{it.ISO3}} - {vf}.{channels}.sub{textLanguages.toSorted{it.ISO3}}
But it's not working

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

Re: Is there a way to get the genre of a collection?

Post by rednoah » 24 Jul 2019, 14:02

1.
What exactly is "it" and how does "working" look different from "not working".


2.
I recommend doing things bit by bit, so that "it" doesn't refer to everything, and instead refers to something very specific.

Here's an example test case for testing that "sorting genres by given order" works correctly:

Code: Select all

{
	// An example list of genres in random order
	def genres = ['Action', 'Test', 'Comedy', 'Horror', 'Animation']

	def genreOrder = ['Animation': 1, 'Comedy': 2, 'Horror': 3, 'Science-Fiction': 4, 'Adventure': 5, 'Romance': 6, 'Drama': 7, 'Action': 8].withDefault{ 100 }
	genres.toSorted{ genreOrder[it] }
	// OUTPUT: [Animation, Comedy, Horror, Action, Test]
}
Image
:idea: Please read the FAQ and How to Request Help.

Punt
Posts: 5
Joined: 05 Jun 2019, 08:12

Re: Is there a way to get the genre of a collection?

Post by Punt » 28 Jul 2019, 23:46

Hey,

So... It was working actually... The problem was in my def genreOrder I had english genres... But I was using French settings !

Buuuut...
I tried to change my naming file

Code: Select all

{ny}
to

Code: Select all

{y} - {n.upperInitial()}
like I said in a post
I think it could be a good idea to have a place where we could share some tips about this tool, so that people don't waste time trying to use the tool! If I had read a tip like "By passing the name of a movie at the very beggining of your format, It'll help the tool -in the future- to directly re-match movies with TheMovieDb" it would have win me some time lol.
It fucked my matching to TheMovieDB...

Before changing that I had 0 manual match to do... And now a lot...

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

Re: Is there a way to get the genre of a collection?

Post by rednoah » 29 Jul 2019, 16:31

Name (Year) is most highly recommended, especially if you use Plex or Kodi or any other software that interprets the file names to make sense of things.
:idea: Please read the FAQ and How to Request Help.

Post Reply