Sorting films by genre with symlinks?

Running FileBot from the console, Groovy scripting, shell scripts, etc
Post Reply
noseboy
Posts: 6
Joined: 26 Aug 2012, 22:16

Sorting films by genre with symlinks?

Post by noseboy »

Hi, I'm entirely new to FileBot, have only just run into it tonight. I have my films stored on a Synology NAS box running Linux and can run FileBot from the command line.

I currently have a directory, Movies, and in that is a series of films in subfolders. I would like to form symlinks for these in genre categories, e.g. for "The Princess Bride", which might be characterised as Fantasy / Comedy / Romance, I would like symlinks for Movies\Fantasy\The Princess Bride, Comedy\The Princess Bride, etc to the original location.

Is this something that is easily achievable?
User avatar
rednoah
The Source
Posts: 22976
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: Sorting films by genre with symlinks?

Post by rednoah »

Sure. Set --format to some path pattern that includes the genre, i.e. X:/Movies/{genres[0]}/... and set --action symlink. You need Java 7 for symlinking to work.
:idea: Please read the FAQ and How to Request Help.
noseboy
Posts: 6
Joined: 26 Aug 2012, 22:16

Re: Sorting films by genre with symlinks?

Post by noseboy »

Excellent! Thanks very much.
noseboy
Posts: 6
Joined: 26 Aug 2012, 22:16

Re: Sorting films by genre with symlinks?

Post by noseboy »

Playing with this, I am stuck with Java 6 on my Synology box so this is not an option. Ah well!
User avatar
rednoah
The Source
Posts: 22976
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: Sorting films by genre with symlinks?

Post by rednoah »

In scripting you could define a custom rename action that'll just execute "ln -s ..." for each file/episode match.
:idea: Please read the FAQ and How to Request Help.
User avatar
rednoah
The Source
Posts: 22976
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: Sorting films by genre with symlinks?

Post by rednoah »

e.g. Replace rename action with any cmdline tool:
http://filebot.sourceforge.net/forums/v ... ?f=4&t=252
:idea: Please read the FAQ and How to Request Help.
noseboy
Posts: 6
Joined: 26 Aug 2012, 22:16

Re: Sorting films by genre with symlinks?

Post by noseboy »

Thanks for your help, but my knowledge is clearly too basic! I can't even get the test script to work...

renamex(
file: args.getFiles(),
action: { from, to ->
execute('echo', 'FROM', from, 'TO', to)
}
)
// filebot -script fn:renall <options> <folder>

/*
* Rename all tv shows, anime or movies using given or default options
*/
args.eachMediaFolder {
rename(folder:it, renamex())
}


> filebot -script filmgenre.groovy .
MissingMethodException: No signature of method: org.codehaus.groovy.jsr223.GroovyScriptEngineImpl.renamex() is applicable for argument types: (java.util.LinkedHashMap) values: [[file:[/volume1/video/Films/Comedy/.avi, ...], ...]]
groovy.lang.MissingMethodException: No signature of method: org.codehaus.groovy.jsr223.GroovyScriptEngineImpl.renamex() is applicable for argument types: (java.util.LinkedHashMap) values: [[file:[/volume1/video/Films/Comedy/.avi, ...], ...]]
at Script3.run(Script3.groovy:3)
at net.sourceforge.filebot.cli.ScriptShell.evaluate(Unknown Source)
at net.sourceforge.filebot.cli.ScriptShell.runScript(Unknown Source)
at net.sourceforge.filebot.cli.ArgumentProcessor.process(Unknown Source)
at net.sourceforge.filebot.Main.main(Unknown Source)
Failure (?_?)
User avatar
rednoah
The Source
Posts: 22976
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: Sorting films by genre with symlinks?

Post by rednoah »

Well, the sample script works as it is. But you somehow randomly copy&pasted things together...

The only thing that changes is adding a custom action property where the value of that property is a closure:

Code: Select all

args.eachMediaFolder { 
	rename(folder:it, action:{ from, to ->
		execute('echo', 'FROM', from, 'TO', to)
	})
}
:idea: Please read the FAQ and How to Request Help.
noseboy
Posts: 6
Joined: 26 Aug 2012, 22:16

Re: Sorting films by genre with symlinks?

Post by noseboy »

Thanks - never used Groovy or Filebot before so had no idea of the syntax. Your time is appreciated.
User avatar
rednoah
The Source
Posts: 22976
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: Sorting films by genre with symlinks?

Post by rednoah »

Sure, no worries. Let me know if you encounter any more problems and post the stuff you came up with when your finished. ;)
:idea: Please read the FAQ and How to Request Help.
Post Reply