Page 1 of 1

Sort Sylvester Stallone movies

Posted: 21 Jul 2019, 14:27
by Optimus
Hello,

Please if someone can assist me, I'll be very grateful.

I have some video clips of various actors and I'm sorting to them in order.

I have some files named like this "Rocky 2_final fight_Sylvester Stallone". I intend to sort them by re-naming them the file to the actor the film is associated with followed by a digit to denote the number of files. For example:

- Sylvester Stallone 1
- Sylvester Stallone 2
- Sylvester Stallone 3

What code would I enter to make this happen? This might be forward, but I don't prefer to learn coding, so I can get to better grips with the FileBot. I purchased it to sort a few files and then more than likely I won't be using it.

If someone can assist me with the code, that'll be great.

Re: Sort Sylvester Stallone movies

Posted: 21 Jul 2019, 15:06
by rednoah
:idea: Your requirements are odd and unique, and thus may or may not be supported well out of the box. I recommend sticking to built-in bindings such as {plex} to keep things simple.


1.
Maybe something like this is close enough to what you want:

Code: Select all

{ny} with {actors.take(2)}

2.
Grouping and numbering by first actor is a bit more tricky:

Code: Select all

{ny} - {actors[0]} {model.findAll{ actors[0] in it.actors }.findIndexOf{ id == it.id } + 1}
:arrow: viewtopic.php?f=5&t=5690

Re: Sort Sylvester Stallone movies

Posted: 21 Jul 2019, 15:20
by Optimus
Hi rednoah,

Thank you.

Would I replace "actors" in each of the codes with the name of the actor? So for example:

{ny} with {Sylvester Stallone.take(2)}

{ny} - {Sylvester Stallone[0]} {model.findAll{ Sylvester Stallone[0] in it.Sylvester Stallone}.findIndexOf{ id == it.id } + 1}


Plus, would I run the first code and then the second?

I appreciate your effort mate.

Re: Sort Sylvester Stallone movies

Posted: 21 Jul 2019, 15:26
by rednoah
No. Why would you do that?

{actors} is a variable that will give the actors for the movie match, so the value is different for each movie.

Re: Sort Sylvester Stallone movies

Posted: 21 Jul 2019, 15:29
by Optimus
Pardon my ignorance. I'm clueless when it comes to executing codes.

Understood.

Would I run the first code and then the second?

Re: Sort Sylvester Stallone movies

Posted: 21 Jul 2019, 15:29
by rednoah
Both format expressions given above are independent of each other. Just two possible solutions to your naming problem.

You may need to familiarize yourself with FileBot formats first though.

Re: Sort Sylvester Stallone movies

Posted: 21 Jul 2019, 15:41
by Optimus
I was just wondering how the code would know which word in the original file name would be the actor.

Re: Sort Sylvester Stallone movies

Posted: 21 Jul 2019, 15:45
by rednoah
Typically, FileBot works by identifying a movie from the filename, matching it to an online database, and then retrieve extra information such as actors or director from the internet on demand.

Re: Sort Sylvester Stallone movies

Posted: 21 Jul 2019, 16:04
by Optimus
rednoah wrote: 21 Jul 2019, 15:45 Typically, FileBot works by identifying a movie from the filename, matching it to an online database, and then retrieve extra information such as actors or director from the internet on demand.
Each time I Fetch Data there are too many mis-matchs. It only re-named 6 files out of 540.

Any suggestions?

Re: Sort Sylvester Stallone movies

Posted: 21 Jul 2019, 16:08
by rednoah
Screenshots and file paths please.

Read How to Request Help for details on how you can help me help you. ;)

Re: Sort Sylvester Stallone movies

Posted: 21 Jul 2019, 16:09
by Optimus
rednoah wrote: 21 Jul 2019, 16:08 Screenshots and file paths please.
To make things easier and if time permitting, I'm happy to give you remote access where you can see and get the job done?

Please.

Re: Sort Sylvester Stallone movies

Posted: 21 Jul 2019, 16:10
by rednoah
Sorry, remote assistance is not generally a service I provide.

Screenshots usually make it quite clear what you're trying to do. And file paths allow me to recreate your file structure for testing.

Re: Sort Sylvester Stallone movies

Posted: 21 Jul 2019, 22:14
by kim
He is asking about "video clips of various actors"
I think it's a bad idea to use normal online lookup here ?
the files can be named badly ?

if file e.g. "Rocky 2_final fight_Sylvester Stallone"
then use F2 aka offline mode
viewtopic.php?t=2072

with a format like this:
{fn.match(/Sylvester.Stallone|Some.other.dude/).space(' ')} {i}
for it to work you need to rename ALL of e.g. sly in 1 go

Re: Sort Sylvester Stallone movies

Posted: 22 Jul 2019, 03:18
by rednoah
I see. Possibly. Best to wait for screenshots and file paths and more details from the OP so we can check what the OP is talking about exactly.