Page 1 of 1

Renaming a second time with additional details

Posted: 04 Feb 2014, 15:41
by benitbabu969
I already renamed a movie (The Girl Next Door, 720p BRRip Unrated) using the script:

Code: Select all

{collection.upperInitial().replaceAll(/[:|]/, " - ").replaceAll(/[?]/, "!")}/{n.upperInitial().replaceAll(/[:|]/, " - ").replaceAll(/[?]/, "!")} ({imdb.released.year}, {imdb.rating},{' '+vf}{' '+source}, {imdb.genres.take(3).join('-')})/{n.upperInitial().replaceAll(/[:|]/, " - ").replaceAll(/[?]/, "!")}{" CD$pi"} [{imdb.director} - {imdb.actors.take(3).join(', ')}]
The result was:
P:\English Movies\The Girl Next Door (2004, 6.8, 720p BRRip, Comedy-Drama-Romance)\The Girl Next Door [Luke Greenfield - Emile Hirsch, Elisha Cuthbert, Timothy Olyphant]

But now i want to rename it so that it also includes the tag 'Unrated' like below:
P:\English Movies\The Girl Next Door (2004, 6.8, 720p BRRip Unrated, Comedy-Drama-Romance)\The Girl Next Door [Luke Greenfield - Emile Hirsch, Elisha Cuthbert, Timothy Olyphant]

I tried the script below but it didn't work :

Code: Select all

{collection.upperInitial().replaceAll(/[:|]/, " - ").replaceAll(/[?]/, "!")}/{n.upperInitial().replaceAll(/[:|]/, " - ").replaceAll(/[?]/, "!")} ({imdb.released.year}, {imdb.rating},{' '+vf}{' '+source} {' '+fn.matchAll(/extended|uncensored|remastered|unrated|uncut|directors.cut|special.edition/).upperInitial().lowerTrail().sort().join('-').replaceAll(/[._]/, " ")}, {imdb.genres.take(3).join('-')})/{n.upperInitial().replaceAll(/[:|]/, " - ").replaceAll(/[?]/, "!")}{" CD$pi"} [{imdb.director} - {imdb.actors.take(3).join(', ')}]
So is it possible to rename again including the tag 'Unrated'? If yes then what corrections should i make in the above script?

Re: Renaming a second time with additional details

Posted: 04 Feb 2014, 23:23
by Ithiel
Hi benitbabu969,

The fn.matchAll function should find and include instances of 'Unrated' from the filename, but if it has been removed from the filename during the previous renaming attempt.. it no longer has anything there to find :-(

This means you will need to either manually add the word Unrated back into the file name, or use the restore option in the FileBot History (little button that looks like a notepad under the left list box in the GUI) and restore the file to its original name, and then try with the updated naming scheme.

Also, I'm not sure if your upper and lower's will work correctly as they are. Try seeing if you have more luck replacing this:

Code: Select all

{' '+fn.matchAll(/extended|uncensored|remastered|unrated|uncut|directors.cut|special.edition/).upperInitial().lowerTrail().sort().join('-').replaceAll(/[._]/, " ")},
with this:

Code: Select all

{' '+fn.matchAll(/extended|uncensored|remastered|unrated|uncut|directors.cut|special.edition/)*.upperInitial()*.lowerTrail().sort().join('-').replaceAll(/[._]/, " ")+', '}
Note: I also moved the comma at the end inside the process, so that it only adds the comma if there was something there to keep (i.e. if there's no unrated tag or whatever, it won't just leave a random comma hanging there for no reason.

Also, personally, I would consider using something like XBMC or Plex which has genre sorting to manage the media collection, so that you don't need to include things like Comedy-Drama-Romance in the file (because those tags could really confuse any media managers that you do eventually run with).

Good luck - let me know how you go. :-)

Re: Renaming a second time with additional details

Posted: 05 Feb 2014, 13:55
by benitbabu969
:) Thanks a lot for replying so fast ithiel. . :D
I used the code you gave me and it worked like a charm. . . but the hard part is that i have 1000+ movies and now i have to check the original name of each one to see whether it had any tags. . :shock:
I also started using XBMC and i'm starting to like it. . . My new renaming script is :

Code: Select all

{collection.replaceAll(/[:|]/, " - ").replaceAll(/[?]/, "!").upperInitial().lowerTrail()}/{n.replaceAll(/[:|]/, " - ").replaceAll(/[?]/, "!").upperInitial().lowerTrail()} ({imdb.released.year}) [{vf}{' '+source}{' '+fn.matchAll(/extended|uncensored|remastered|unrated|uncut|directors.cut|special.edition/)*.upperInitial()*.lowerTrail().sort().join('-').replaceAll(/[._]/, " ")}]/{n.upperInitial().replaceAll(/[:|]/, " - ").replaceAll(/[?]/, "!")}{" CD$pi"} ({imdb.released.year}) [{imdb.rating}]
The renamed file path is :
P:\English Movies\The Girl Next Door (2004) [720p BRRip Unrated]\The Girl Next Door (2004) [6.8]

Thanks again for the help :)

Re: Renaming a second time with additional details

Posted: 05 Feb 2014, 14:43
by Ithiel
Awesome - glad you got it to work. :-)

It's probably also worth mentioning that there is a filter in the FileBot history window that will allow you to search for the movies that had those tags and just restore them (so you can then rename them with your updated scheme). Screen shot below ^.^

Image

Re: Renaming a second time with additional details

Posted: 05 Feb 2014, 19:30
by rednoah
If you xattr is supported / enabled for your platform / filebot you can use {original} binding since filebot will write the original name plus metadata into extended file attributes on rename.

So you could try:

Code: Select all

{original.matchAll(/remastered|unrated|uncut/)}