Rename Folder - Just the Folder

Any questions? Need some help?
Post Reply
Delboy
Posts: 9
Joined: 03 Aug 2012, 22:39

Rename Folder - Just the Folder

Post by Delboy »

Hi there, Firstly, epic piece of software this, love it really do.

I've finally finished ripping/encoding my wifes dvd collection to my NAS so we can watch the films round the house (believe me, I don't ever want to do that again - took forever!) and I have a list of loads of Movie folders on my NAS.... thats great but a large portion of these films, i've never heard of and have no idea what they are or even if they are any good.

I was wondering if there is a way in FileBot for me to go into my Folder called 'D:\Videos' and rename them so its:

{title} - {year} - {genre} - {imdbrating}

I only want the first genre it comes back with as I know some films can have loads. I've looked through this forum and can't find anything that really works in the way I want. They're either renaming both the file and folder or require a .nfo file which I don't have as these are home rips.

Is there any option available for me?

Edit: Example folder names as follows:

D:\Videos\A Beautiful Mind
D:\Videos\A Cinderella Story
D:\Videos\A Clockwork Orange
D:\Videos\A Few Good Men
D:\Videos\A Fish Called Wanda

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

Re: Rename Folder - Just the Folder

Post by rednoah »

Just use this format:

Code: Select all

{n} - {y} - {genres[0]} - {rating}
Note: Genre/rating data is grabbed from TheMovieDB

Those file/folder names are enough to figure things out. No need for nfo and whatever.

If those folders are DVD folders or BluRay folders (i.e. contain a folder called VIDEO_TS, etc) then it'll work with the folder.

If you have avis/mkvs/etc but want to preserve the original name:

Code: Select all

/.../{n} - {y} - {genres[0]} - {rating}/{fn}
:idea: Please read the FAQ and How to Request Help.
Delboy
Posts: 9
Joined: 03 Aug 2012, 22:39

Re: Rename Folder - Just the Folder

Post by Delboy »

Thanks for this rednoah. You mention:

Code: Select all

Those file/folder names are enough to figure things out. No need for nfo and whatever.

If those folders are DVD folders or BluRay folders (i.e. contain a folder called VIDEO_TS, etc) then it'll work with the folder.

If you have avis/mkvs/etc but want to preserve the original name:
I don't actually want to rename anything in the folders themselves at all - just the folder name - presumably this is possible?

I use a batch script to loop through the folder names, but what would be the command line for me to just rename the folders themselves using "{n} - {y} - {genres[0]} - {rating}"?

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

Re: Rename Folder - Just the Folder

Post by rednoah »

With the newer revision you can just pass in a folder.

e.g. rename(file:<folder>, format: ...)
:idea: Please read the FAQ and How to Request Help.
User avatar
rednoah
The Source
Posts: 22923
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: Rename Folder - Just the Folder

Post by rednoah »

That's groovy script. Cmdline probably doesn't work cause it'll try to grab video files from the folder you specify.
:idea: Please read the FAQ and How to Request Help.
Delboy
Posts: 9
Joined: 03 Aug 2012, 22:39

Re: Rename Folder - Just the Folder

Post by Delboy »

Ok I tried it:

via command line I did:

Code: Select all

C:\Program Files (x86)\FileBot>filebot -script D:\Videos\test\test2.groovy
where groovy script contained:

Code: Select all

rename(folder:"D:/Videos/test/A Beautiful Mind", format:"{n} - {y} - {genres[0]} - {rating}")
Response was:

Code: Select all

Exception: No media files: []
Done ?(?????)?
I know im doing something stupid - what is it though?

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

Re: Rename Folder - Just the Folder

Post by rednoah »

You need a newer revision from here:
http://sourceforge.net/projects/filebot ... ebot/HEAD/

Just replace the jar in your install folder and it should work.
:idea: Please read the FAQ and How to Request Help.
Delboy
Posts: 9
Joined: 03 Aug 2012, 22:39

Re: Rename Folder - Just the Folder

Post by Delboy »

Got the latest .jar - re-ran the code:

Code: Select all

C:\Program Files (x86)\FileBot>filebot -version
FileBot 2.64 (r1190) / Java(TM) SE Runtime Environment 1.6.0_33


C:\Program Files (x86)\FileBot>filebot -script D:\Videos\test\test2.groovy
Filename pattern: [NaN] SxE, [NaN] CWS
Rename episodes using [TheTVDB]
Exception: No media files: []
Done ?(?????)?
Again the groovy script contains only:

Code: Select all

rename(folder:"D:/Videos/test/A Beautiful Mind", format:"{n} - {y} - {genres[0]} - {rating}")
edit: Just tried it with the db in the groovy script too:

Code: Select all

rename(folder:"D:/Videos/test/A Beautiful Mind", db: "TheMovieDB", format:"{n} - {y} - {genres[0]} - {rating}")

C:\Program Files (x86)\FileBot>filebot -script D:\Videos\test\test2.groovy
Rename movies using [TheMovieDB]
Exception: No media files: []
Done ?(?????)?
Nothing happened.


Sorry for being slow - some of this stuff is a little beyond me.
Delboy
Posts: 9
Joined: 03 Aug 2012, 22:39

Re: Rename Folder - Just the Folder

Post by Delboy »

More playing, editted the groovy script and put this in so its a little more dynamic:

Code: Select all

// PERSONALIZED SETTINGS
def MovieDir    		= "D:/Videos/test/"
def MovieFormat    	= "D:/Videos/test/{n} - {y} - {genres[0]} - {rating}"


MovieDir.getFolders{!it.hasFile{} || it.hasFile{}}.each{ dir ->
	println "Processing $dir"
	def folder = dir

	println "Processing $dir"
	rename(folder:folder, db:'TheMovieDB', format:MovieFormat)
}
Output was this:

Code: Select all

D:\Videos>filebot -script D:\Videos\test\test3.groovy
Processing D:\Videos\test
Processing D:\Videos\test
Rename movies using [TheMovieDB]
Exception: No media files: [D:\Videos\test\test.groovy, D:\Videos\test\test2.gro
ovy, D:\Videos\test\test2.groovy.bak, D:\Videos\test\test3.groovy, D:\Videos\tes
t\test3.groovy.bak]
Processing D:\Videos\test\A Beautiful Mind
Processing D:\Videos\test\A Beautiful Mind
Rename movies using [TheMovieDB]
Exception: No media files: []
Processing D:\Videos\test\A Cinderella Story
Processing D:\Videos\test\A Cinderella Story
Rename movies using [TheMovieDB]
Exception: No media files: []
Processing D:\Videos\test\A Clockwork Orange
Processing D:\Videos\test\A Clockwork Orange
Rename movies using [TheMovieDB]
Exception: No media files: []
Processing D:\Videos\test\A Few Good Men
Processing D:\Videos\test\A Few Good Men
Rename movies using [TheMovieDB]
Exception: No media files: []
Processing D:\Videos\test\A Fish Called Wanda
Processing D:\Videos\test\A Fish Called Wanda
Rename movies using [TheMovieDB]
Exception: No media files: []
Done ?(?????)?

D:\Videos>
Again, nothing in the directory was changed. :(
User avatar
rednoah
The Source
Posts: 22923
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: Rename Folder - Just the Folder

Post by rednoah »

Ah, found the problem that got you.

rename(folder:dir, ...) -> resolve folder automatically and pass fileset to rename
rename(file:dir, ...) -> just process this fileset directly (folders will be handled just as if they were files)

This works:

Code: Select all

args.eachMediaFolder { dir ->
	println dir
	rename(file:dir, format:'{n} - {y} - {genres[0]} - {rating}', db:'TheMovieDB')
}
:idea: Please read the FAQ and How to Request Help.
Delboy
Posts: 9
Joined: 03 Aug 2012, 22:39

Re: Rename Folder - Just the Folder

Post by Delboy »

Sadly that doesn't work either :(

Tried:
def args = "D:/Videos/test/"

args.eachMediaFolder { dir ->
println dir
rename(file:dir, format:'{n} - {y} - {genres[0]} - {rating}', db:'TheMovieDB')
}
Simply says Done?(??????)?

then tried:

Code: Select all

// PERSONALIZED SETTINGS
def MovieDir    		= "D:/Videos/test/"
def MovieFormat    	= "D:/Videos/test/{n} - {y} - {genres[0]} - {rating}"

MovieDir.getFolders{!it.hasFile{} || it.hasFile{}}.each{ dir ->
   println dir
   rename(file:dir, format:MovieFormat, db:'TheMovieDB')
}
Which had a result but because its using the full path to do the search, its failing to select the movie.

Result:

Code: Select all

C:\Program Files (x86)\FileBot>filebot -script D:\Videos\test\test4.groovy
D:\Videos\test
Rename movies using [TheMovieDB]
Auto-detect movie from context: [D:\Videos\test]
Exception: [null/test] Failed to auto-select search result: [Test (2000), Test (
2007), This Is Not a Test (2009), Crash Test Dummies (2005), Insanity - 1. Dig D
eeper & Fit Test (2009), Test Tube Teens from the Year 2000 (1994), Testament (1
983), The Tested (2011), Testosteron (2007), Testosterone (2003), The Testaments
 (2000), Testament of Orpheus (1960), The Testament of Dr. Mabuse (1933), Das Te
stament des Dr. Mabuse (1962), New Testament DVD Presentations (2006), Old Testa
ment Video Presentations (2006), Das Testament des Cornelius Gulden (1932), A Fi
stful of Dynamite (1971), The Seventh Brother (1991), Nobel's Last Will (2012),
Heads I Win, Tails You Lose (1982), Experiment in Evil (1959)]
D:\Videos\test\A Beautiful Mind
Rename movies using [TheMovieDB]
Auto-detect movie from context: [D:\Videos\test\A Beautiful Mind]
Exception: [test/A Beautiful Mind] Failed to auto-select search result: [A Beaut
iful Mind (2001), Test (2000), Test (2007), Beautiful (2008), Beautiful (2009),
Beautiful (2009), This Is Not a Test (2009), Crash Test Dummies (2005), Crazy/Be
autiful (2001), Insanity - 1. Dig Deeper & Fit Test (2009), Test Tube Teens from
 the Year 2000 (1994), Beautiful Boy (2011), Life Is Beautiful (1997), Beautiful
 City (2012), Beautiful Lies (2010), Everybody He Is Nice, Everybody He Is Beaut
iful (1972), Testament (1983), The Tested (2011), American Beauty (1999), Sleepi
ng Beauty (2011), Sleeping Beauty (1959), Beauties at War (2009), Stealing Beaut
y (1996), Testosteron (2007), Testosterone (2003), Beauty and the Beast (1991),
Beauty and the Beast (2009), Beauty Shop (2005), The Testaments (2000), Olympia
Part Two: Festival of Beauty (1938), Star of David: Beauty Hunting (1979), A Fis
tful of Dynamite (1971), Testament of Orpheus (1960), Beauty and the Beast: The
Enchanted Christmas (1997), The Testament of Dr. Mabuse (1933), Das Testament de
s Dr. Mabuse (1962), New Testament DVD Presentations (2006), Old Testament Video
 Presentations (2006), Das Testament des Cornelius Gulden (1932), The Seventh Br
other (1991), Nobel's Last Will (2012), Heads I Win, Tails You Lose (1982), Expe
riment in Evil (1959), All Good Things (2010), Dubbel-8 (2000)]
D:\Videos\test\A Cinderella Story
Rename movies using [TheMovieDB]
Auto-detect movie from context: [D:\Videos\test\A Cinderella Story]
Exception: [test/A Cinderella Story] Failed to auto-select search result: [A Cin
derella Story (2004), Ever After: A Cinderella Story (1998), A Cinderella Story:
 Once Upon a Song (2011), Another Cinderella Story (2008), Test (2007), Test (20
00), Cinderella (1950), Cinderella (1950), Cinderella (1994), Cinderella (1997),
 Cinderella (2003), Cinderella (1947), Cinderella (2006), Cinderella (1965), Cin
derella (1957), This Is Not a Test (2009), Crash Test Dummies (2005), Insanity -
 1. Dig Deeper & Fit Test (2009), Test Tube Teens from the Year 2000 (1994), Sto
ry (2012), The Slipper and the Rose: The Story of Cinderella (1976), Testosteron
 (2007), Testosterone (2003), Testament (1983), The Tested (2011), The Testament
s (2000), Testament of Orpheus (1960), The Testament of Dr. Mabuse (1933), Das T
estament des Dr. Mabuse (1962), New Testament DVD Presentations (2006), Old Test
ament Video Presentations (2006), Das Testament des Cornelius Gulden (1932), A F
istful of Dynamite (1971), The Seventh Brother (1991), Nobel's Last Will (2012),
 Heads I Win, Tails You Lose (1982), Experiment in Evil (1959)]
D:\Videos\test\A Clockwork Orange
Rename movies using [TheMovieDB]
Auto-detect movie from context: [D:\Videos\test\A Clockwork Orange]
Exception: [test/A Clockwork Orange] Failed to auto-select search result: [A Clo
ckwork Orange (1971), Test (2000), Test (2007), This Is Not a Test (2009), Clock
work (1964), Crash Test Dummies (2005), Insanity - 1. Dig Deeper & Fit Test (200
9), Jaffa, the Orange's Clockwork (2010), Test Tube Teens from the Year 2000 (19
94), Orange (2010), Testament (1983), The Tested (2011), Testosteron (2007), Tes
tosterone (2003), Testament of Orpheus (1960), The Testaments (2000), The Testam
ent of Dr. Mabuse (1933), Das Testament des Dr. Mabuse (1962), New Testament DVD
 Presentations (2006), Old Testament Video Presentations (2006), Das Testament d
es Cornelius Gulden (1932), A Fistful of Dynamite (1971), The Seventh Brother (1
991), Nobel's Last Will (2012), Heads I Win, Tails You Lose (1982), Experiment i
n Evil (1959)]
D:\Videos\test\A Few Good Men
Rename movies using [TheMovieDB]
Auto-detect movie from context: [D:\Videos\test\A Few Good Men]
Exception: [test/A Few Good Men] Failed to auto-select search result: [A Few Goo
d Men (1992), Test (2000), Test (2007), This Is Not a Test (2009), Crash Test Du
mmies (2005), Insanity - 1. Dig Deeper & Fit Test (2009), Test Tube Teens from t
he Year 2000 (1994), Good (2008), Men (1973), Testament (1983), The Testaments (
2000), The Tested (2011), Testosteron (2007), Testosterone (2003), Testament of
Orpheus (1960), New Testament DVD Presentations (2006), The Testament of Dr. Mab
use (1933), Das Testament des Dr. Mabuse (1962), Old Testament Video Presentatio
ns (2006), Das Testament des Cornelius Gulden (1932), A Fistful of Dynamite (197
1), Experiment in Evil (1959), The Seventh Brother (1991), Nobel's Last Will (20
12), Heads I Win, Tails You Lose (1982)]
D:\Videos\test\A Fish Called Wanda
Rename movies using [TheMovieDB]
Auto-detect movie from context: [D:\Videos\test\A Fish Called Wanda]
Exception: [test/A Fish Called Wanda] Failed to auto-select search result: [A Fi
sh Called Wanda (1988), Test (2000), Test (2007), This Is Not a Test (2009), Cra
sh Test Dummies (2005), Insanity - 1. Dig Deeper & Fit Test (2009), Test Tube Te
ens from the Year 2000 (1994), Wanda (1970), The Tested (2011), Testament (1983)
, Testosteron (2007), Testosterone (2003), The Testaments (2000), A Fistful of D
ynamite (1971), Testament of Orpheus (1960), The Testament of Dr. Mabuse (1933),
 Das Testament des Dr. Mabuse (1962), New Testament DVD Presentations (2006), Ol
d Testament Video Presentations (2006), Das Testament des Cornelius Gulden (1932
), The Seventh Brother (1991), Nobel's Last Will (2012), Heads I Win, Tails You
Lose (1982), Experiment in Evil (1959)]
Done ?(?????)?

C:\Program Files (x86)\FileBot>
Is there a way for it only to select the actual folder name and pass that rather than the full path - that seems to be the issue?

Del
Delboy
Posts: 9
Joined: 03 Aug 2012, 22:39

Re: Rename Folder - Just the Folder

Post by Delboy »

This seemed to work and also adding -non-strict to the command line. Not sure if thats safe to do though:

Code: Select all

// PERSONALIZED SETTINGS
def MovieDir    		= "D:/Videos/test"
def DirRoot					= "test"
def MovieFormat    	= "D:/Videos/test/{n} - {y} - {genres[0]} - {rating}"

MovieDir.getFolders{!it.hasFile{} || it.hasFile{}}.each{ dir ->

   	if (dir.name != DirRoot) {
			println dir
	   	rename(file:dir, format:MovieFormat, db:'TheMovieDB')
		}
}
User avatar
rednoah
The Source
Posts: 22923
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: Rename Folder - Just the Folder

Post by rednoah »

The snipped I posted definitely does work.

Cmdline:

Code: Select all

filebot -script test.groovy "E:\testdata\folders" -non-strict --action test
Script:

Code: Select all

args.eachMediaFolder { dir ->
	println dir
	rename(file:dir, format:'{n} - {y} - {genres[0]} - {rating}', db:'TheMovieDB')
}
Output:

Code: Select all

E:\testdata\folders\Blade Runner [The Final Cut].1982.HDRip.x264.AAC[5.1]-VLiS
Rename movies using [TheMovieDB]
Auto-detect movie from context: [E:\testdata\folders\Blade Runner [The Final Cut].1982.HDRip.x264.AAC[5.1]-VLiS]
[TEST] Rename [E:\testdata\folders\Blade Runner [The Final Cut].1982.HDRip.x264.AAC[5.1]-VLiS] to [Blade Runner - 1982 - Drama - 9.0]
Processed 1 files
Done ヾ(@⌒ー⌒@)ノ

But eachMediaFolder will run through each folder that contains at least 1 video file (your test setup was probably all empty folders). If it doesn't do anything than there's no avis/mks/etc.

That search for [null/test] is because you also have video files in your root folder which is a bit odd since you said you have everything organized in folders. Move your video files into folders or make it skip that folder like in your last script above.

Obviously you have to pass in the whole path so filebot knows what you wanna rename. If you already know that the folder name is the movie name then you can add rename(file: ..., query: dir.name, ...) to force the search query rather then have filebot auto-detect it.

Adding -non-strict just forces filebot to auto-select the most probable option rather then fail in case there are multiple plausible options.
:idea: Please read the FAQ and How to Request Help.
Delboy
Posts: 9
Joined: 03 Aug 2012, 22:39

Re: Rename Folder - Just the Folder

Post by Delboy »

Got it all working now - thanks very much for your help rednoah.

Del
Post Reply