Need help with using CLI and writing script.

Any questions? Need some help?
Post Reply
nzdreamer55
Posts: 162
Joined: 20 Jul 2012, 23:25

Need help with using CLI and writing script.

Post by nzdreamer55 »

Hello everyone,
Just came cross Filebot. I have been using theRenamer via a bat file for automation. I have just enough computer sense to write a bat file, so when I look at the scripts that Filebot uses, I am a little over my head. I want to take this in steps so I will be asking more questions (maybe in a different post) as this looks too cool not to spend some time on and learn how to use it.

Right now I have a mixture of files that are automatically moved into 2 folders on a server computer. This is where I want to run Filebot. The files I want Filebot to work on are a mixture of video files, RAR files, and folders with many levels buried with both video and RAR files.

Right now I am running a torrent client on a small computer. When the torrent finishes, a bat file copies (via Robocopy) the downloaded file to my server. This allows my torrent client computer to continue seeding the original d/l file. I though that I would use the watcher.groovy script, but I don't really know how it should work.

filebot -script fn:watcher --format "{home}/TV Shows/{n}/{episode}" /path/to/completed/

So I understand the filebot -script fn:watcher calls on filebot to run the watcher script, but everything after that I am a little lost on. How do I tell it which folders I want it to watch? Does it generate an output that will be used in another script? How does it keep working to check folders for newly added items?

I was hoping to watch a couple of folders (one with movies, one with TV shows) for changes, then employ the sorty.groovy script as this unrar files, grabs subtitles, encodes them, renames them, and files them away (way cooler than therenamer). I would also like to clean up any files that were left after running the script.

Thank you for any help you can give me
Steve

Currently I use mediaportal for my media player (not XBMC). I have Java 1.7 installed and have set the path to include both java and filebot so calls to these programs shouldn't need the full path.

Also I though that there was a way to test individual script lines using the GUI for Filebot. Is this correct?
User avatar
rednoah
The Source
Posts: 22923
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: Need help with using CLI and writing script.

Post by rednoah »

I'm gonna start with lots of links for you... :P

(1)
Some docs on how FileBot/Groovy works:
=> http://filebot.sourceforge.net/forums/v ... 8&p=75#p75

* There is Groovy Console which is really nice for prototyping code, but functions like rename() and other extras added by FileBot won't work.

(2)
The watcher script is kept simply but is fully functional for renaming and respects all -rename cmdline parameters. You can run two watchers for each tv show and movies root folders.

Code: Select all

filebot -script fn:watcher --format "{home}/Movies/{n} {y}/{movie}" --db TheMovieDB /folder/you/want/to/watch/
That'll watch for new files, wait 5min for additional new files, and then start the renaming. It's good practice to force movie/series mode via --db.

If you need extra functionality like unrar support, that's just a one line, or subtitles, another line. You'll need to add all functions into the watcher script since it'll run indefinitely watching for folders and running some code on new files every once in a while. Now you could modify the watcher script to execute another filebot cmd but it'd would probably make a lot more sense to just directly add the code that handles new files into the watcher script.

But really this sounds like something I wrote the utorrent script for. It's easy to modify for other torrent clients as well:
=> http://filebot.sourceforge.net/forums/v ... 4&t=5#p802

(3)
If you wanna get rid of left-over files you can schedule the cleaner script once in a while:
=> http://filebot.sourceforge.net/forums/v ... &t=5#p1341


PS: If that sounds complicated, actually it's not, everything is already there and works out of the box. Porting the extra functionality to watcher.groovy is only copy/paste. ;)
:idea: Please read the FAQ and How to Request Help.
nzdreamer55
Posts: 162
Joined: 20 Jul 2012, 23:25

Re: Need help with using CLI and writing script.

Post by nzdreamer55 »

Thanks so much Rednoah for the links. So I was able to get the JDK installed and then installed groovy, had a little look at the basic tutorial but it seems that there is a large hill for me to climb to understand

filebot -script fn:watcher --format "{home}/Movies/{n} {y}/{movie}" --db TheMovieDB /folder/you/want/to/watch/

I think that I am trying to bite off more than I can chew.

Code: Select all

// filebot -script "http://filebot.sf.net/scripts/watcher.groovy" --format <expression> <folder>

// SANITY CHECK
if (_prop['java.runtime.version'] < '1.7') throw new Exception('Java 7 required')
if (!(new File(_args.format ?: '').absolute)) throw new Exception('Absolute target path format required')


// watch folders and print files that were added/modified (requires Java 7)
def watchman = args.watch { changes ->
   println "Processing $changes"
   rename(file:changes)
}

// process after 5 minutes without any changes to the folder
watchman.setCommitDelay(5 * 60 * 1000)

println "Waiting for events"
console.readLine() // keep running and watch for changes
Please tell me if this is correct
// beginning a line is a comment line.
Sanity check area is for checking that the user has JAva1.7 installed
Watchfolders is where the magic happens

Code: Select all

def watchman = args.watch { changes ->
This line has to do with setting a variable, but I don't quite get it

Code: Select all

  println "Processing $changes"
This prints the words in quotes

Code: Select all

rename(file:changes)
Not sure what this does
I won't go too much further as I get lost :-(

So I get that the filebot is using a script to "do stuff" but I don't get the commands after the script name. Are these variables for filebot or the script? If they are for filebot where can I learn about them. I looked through these links but kind of got lost.
Also keep in mind that FileBot provides it's own additional API to make things more streamlined for automated processing of media files:
http://sourceforge.net/p/filebot/code/H ... force=True
http://sourceforge.net/p/filebot/code/H ... force=True
I know people say that this is simple stuff, but remember I am the simple minded. Thanks again for your help. If I am going in the wrong direction please point me correct. Links are always appreciated if I can figure out what is being taught with them.

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

Re: Need help with using CLI and writing script.

Post by rednoah »

I commend your interest in learning groovy and trying to make filebot scripting work for you... but isn't this working out of the box?

Code: Select all

filebot -script fn:watcher --format "{home}/Movies/{n} {y}/{movie}" --db TheMovieDB /folder/you/want/to/watch/
I mean it's only renaming, but at least that should work perfectly. It'll run until you hit ENTER, and then it'll terminate, so don't hit ENTER.
: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: Need help with using CLI and writing script.

Post by rednoah »

btw here is some colorcoded code on how to watch folders with filebot:
GREEN = Hooking up a watch service and keeping the script running until ENTER is pressed. You don't need to concern yourself with this code.
RED = This is the code that runs whenever a set of files has been changed. This is where you're code is gonna go.

def watchman = args.watch { files ->
println files
}

// process after 500ms without any changes to the folder
watchman.commitDelay = 500

println 'Waiting for changes'
console.readLine() // keep running and watch for changes


Now we basically reduced the script you need to worry about to a single println that prints the files that have been changed.

Now guess what this would do ;)

files += extract(file:files)
files += getMissingSubtitles(file:files)
rename(file:files)


Now this is all filebot-specific code but it's quite simple. You start with a list of files that have been changed, then you try to extract files from archives and add those to the list, then try to download subs and add those, and finally rename the whole batch.
:idea: Please read the FAQ and How to Request Help.
nzdreamer55
Posts: 162
Joined: 20 Jul 2012, 23:25

Re: Need help with using CLI and writing script.

Post by nzdreamer55 »

Thanks rednoah. I really don't want to think outside the box on this one. I saw your utorrent script and was going to use this, however the computer that is the torrent client should not be doing any of the work for unpacking, renaming, getting subtitles, filing and cleaning up the left overs. This computer is "protected" from my other computers so really once the file finishes d/l I move it to my server and that is where I want to use filebot. I also want it to be really responsive as when the file get's moved that is when I want filebot to run (I have some pretty demanding people in my house that NEED their shows ASAP :-)

So maybe you can think in the box for me knowing how I need to handle stuff? I also need to change how it renames things to a different pattern than is the default in filebot.

Thank you very much for the help.
User avatar
rednoah
The Source
Posts: 22923
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: Need help with using CLI and writing script.

Post by rednoah »

Alright, so lets start by setting up auto-rename for TV Shows:

Code: Select all

filebot -script fn:watcher "E:/incoming/tvshows" --output "E:/output/TV Shows" --format "{n}/Season {s}/{n} - {s00e00} - {t}" --db TheTVDB
That's it. Try that and see if you can make it work for movies as well. No no need to know any Groovy at all.

Once you get this watch & rename working I'll help you do the rest.

PS: Keep in mind that things are set up to run 5min delayed to wait for file transfers to finish etc
:idea: Please read the FAQ and How to Request Help.
nzdreamer55
Posts: 162
Joined: 20 Jul 2012, 23:25

Re: Need help with using CLI and writing script.

Post by nzdreamer55 »

Thank you. I'll give it a try. Five minute retrying is perfect. Will post back later today as I have been kicked off the computer for family time ;-)
nzdreamer55
Posts: 162
Joined: 20 Jul 2012, 23:25

Re: Need help with using CLI and writing script.

Post by nzdreamer55 »

Code: Select all

C:\Users\Kira>filebot -script fn:watcher "\\TITANSERVER\1media.3tb\Unpack\TV.Ser
ies.Landing" --output "\\TITANSERVER\4media.2tb\TV Shows 2" --format "{n}/Season
 {s}/{n} - {s00e00} - {t}" --db TheTVDB
MissingPropertyException: No such property: _prop for class: Script3
groovy.lang.MissingPropertyException: No such property: _prop for class: Script3

        at Script3.run(Script3.groovy:4)
        at net.sourceforge.filebot.cli.ScriptShell$1.run(Unknown Source)
        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 (¦_¦)

C:\Users\Kira>filebot -version
FileBot 2.64 (r1024) / Java(TM) SE Runtime Environment 1.6.0_31
OK so here is what happened with this script. FYI, the watcher script is in the same folder as where filebot is.

Thanks again for the support
-Steve
User avatar
rednoah
The Source
Posts: 22923
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: Need help with using CLI and writing script.

Post by rednoah »

Ups my fault, watcher.groovy was outdated. Fixed and should work now. btw fn:watcher means filebot will grab the script from http://filebot.sourceforge.net/scripts/watcher.groovy, since I just changed it you should run with -clear to make sure it's not using an old cached version.
:idea: Please read the FAQ and How to Request Help.
nzdreamer55
Posts: 162
Joined: 20 Jul 2012, 23:25

Re: Need help with using CLI and writing script.

Post by nzdreamer55 »

Run it with "-clear"?

Like this

Code: Select all

filebot -script fn:watcher -clear "\\TITANSERVER\1media.3tb\Unpack\TV.Series.Landing" --output "\\TITANSERVER\4media.2tb\TV Shows 2" --format "{n}/Season {s}/{n} - {s00e00} - {t}" --db TheTVDB
So does filebot download the script? what if I don't have an internet connection to my server can I keep a local copy?
nzdreamer55
Posts: 162
Joined: 20 Jul 2012, 23:25

Re: Need help with using CLI and writing script.

Post by nzdreamer55 »

Just though about it, but I guess the renaming function won't work if the server does not have internet access. Ok. Set it to have internet access so that is solved. here is what happened

Code: Select all

C:\Users\Kira>filebot -script fn:watcher -clear "\\TITANSERVER\1media.3tb\Unpack
\TV.Series.Landing" --output "\\TITANSERVER\4media.2tb\TV Shows 2" --format "{n}
/Season {s}/{n} - {s00e00} - {t}" --db TheTVDB
Reset preferences and clear cache
NoSuchMethodError: java.io.File.toPath()Ljava/nio/file/Path;
java.lang.NoSuchMethodError: java.io.File.toPath()Ljava/nio/file/Path;
        at net.sourceforge.filebot.cli.FolderWatchService$FolderWatcher.<init>(U
nknown Source)
        at net.sourceforge.filebot.cli.FolderWatchService$3.<init>(Unknown Sourc
e)
        at net.sourceforge.filebot.cli.FolderWatchService.startWatch(Unknown Sou
rce)
        at net.sourceforge.filebot.cli.FolderWatchService.watchFolderTree(Unknow
n Source)
        at net.sourceforge.filebot.cli.FolderWatchService.watchFolderTree(Unknow
n Source)
        at net.sourceforge.filebot.cli.FolderWatchService.watchFolderTree(Unknow
n Source)
        at net.sourceforge.filebot.cli.FolderWatchService.watchFolder(Unknown So
urce)
        at net.sourceforge.filebot.cli.FolderWatchService$watchFolder.call(Unkno
wn Source)
        at Script2$_createWatchService_closure56_closure79.doCall(Script2.groovy
:143)
        at Script2$_createWatchService_closure56_closure79.doCall(Script2.groovy
)
        at Script2$_run_closure52.doCall(Script2.groovy:284)
        at Script2$_createWatchService_closure56.doCall(Script2.groovy:143)
        at Script2.createWatchService(Script2.groovy:143)
        at Script2$_run_closure50.doCall(Script2.groovy:149)
        at Script3.run(Script3.groovy:4)
        at net.sourceforge.filebot.cli.ScriptShell$1.run(Unknown Source)
        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: 22923
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: Need help with using CLI and writing script.

Post by rednoah »

Yep, it downloads the script. You can do -script /local/file.groovy but if you don't have internet matching online data won't work anyway.

PS: I have no idea if watching smb shares works. You should maybe test that before using this: http://filebot.sourceforge.net/forums/v ... 1343#p1343

PS2: You're using Java 6, hooking into filesystem notifications requires Java 7.
:idea: Please read the FAQ and How to Request Help.
nzdreamer55
Posts: 162
Joined: 20 Jul 2012, 23:25

Re: Need help with using CLI and writing script.

Post by nzdreamer55 »

So I changed the smb shares to local

Code: Select all

filebot -script fn:watcher "L:\Unpack\TV.Series.Landing" --output "P:\TV Shows 2" --format "{n}/Season {s}/{n} - {s00e00} - {t}" --db TheTVDB
Here is the java that I am running on my server
Java Version 1.7.0_05 from Oracle Corporation

Still getting the same error as before :-(

I'm going to re read the thread and check your links to see if I can learn a little more.

Thanks again for all of your thinking "in" the box and the help.
-Steve
User avatar
rednoah
The Source
Posts: 22923
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: Need help with using CLI and writing script.

Post by rednoah »

Are you sure you're using Java 7 to run FileBot??

Because this can't happen with Java 7:

Code: Select all

NoSuchMethodError: java.io.File.toPath()Ljava/nio/file/Path;
...
Try this to make sure:

Code: Select all

filebot -version
:idea: Please read the FAQ and How to Request Help.
nzdreamer55
Posts: 162
Joined: 20 Jul 2012, 23:25

Re: Need help with using CLI and writing script.

Post by nzdreamer55 »

Well I'll be a monkey's uncle. I am running Java SE Runtime Environment 1.6.0_31

When I go to javatester.org/version.html it says that I have version 1.7.0_05. :?: :?:

So I uninstalled all the java that was on my server and reinstalled the JDK x86 version

Now when I type filebot -version it says 1.7.0_05.

Also on this issue I am going through your website reading the information there. I got the command filebot -extract to work :D Here is what I said

filebot -extract "L:\Unpack\TV.Series.Landing\Futurama.S07E06.720p.HDTV.x264-ORENJI\futurama.s07e06.720p.hdtv.x264-orenji.rar" --output "C:\Users\Kira\Desktop"

filebot -extract "\\TITANSERVER\1media.3tb\Unpack\TV.Series.Landing\Futurama.S07E06.720p.HDTV.x264-ORENJI\futurama.s07e06.720p.hdtv.x264-orenji.rar" --output "\\TITANSERVER\1media.3tb\Unpack\TV.Series.Landing"

Both of these extracted without any problems (confirming that my 7Zip is working properly)

1 question about the scripts. You mentioned that filebot will download the scripts. Does it do this each time it runs or only once then it uses it locally?

So as I type I was able to get

Code: Select all

filebot -script fn:watcher "L:\Unpack\TV.Series.Landing" --output "P:\TV Shows 2" --format "{n}/Season {s}/{n} - {s00e00} - {t}" --db TheTVDB
running. I then did 2 things. 1) I copied a torrent file into the watched folder and 2) I started downloading a torrent file that was then copied from my "protected" computer to the watched file and here is what I got

Code: Select all

Microsoft Windows [Version 6.1.7601]
Copyright (c) 2009 Microsoft Corporation.  All rights reserved.

C:\Users\Kira>filebot -version
FileBot 2.64 (r1024) / Java(TM) SE Runtime Environment 1.7.0_05


C:\Users\Kira>filebot -script fn:watcher "L:\Unpack\TV.Series.Landing" --output
"P:\TV Shows 2" --format "{n}/Season {s}/{n} - {s00e00} - {t}" --db TheTVDB
Waiting for events
L:\Unpack\TV.Series.Landing\Futurama.S07E05.720p.HDTV.x264-IMMERSE\Sample: The p
rocess cannot access the file because it is being used by another process.

java.nio.file.FileSystemException: L:\Unpack\TV.Series.Landing\Futurama.S07E05.7
20p.HDTV.x264-IMMERSE\Sample: The process cannot access the file because it is b
eing used by another process.

        at sun.nio.fs.WindowsException.translateToIOException(Unknown Source)
        at sun.nio.fs.WindowsException.asIOException(Unknown Source)
        at sun.nio.fs.WindowsWatchService$Poller.implRegister(Unknown Source)
        at sun.nio.fs.AbstractPoller.processRequests(Unknown Source)
        at sun.nio.fs.WindowsWatchService$Poller.run(Unknown Source)
        at java.lang.Thread.run(Unknown Source)

So far I am really happy with the progress and see that it won't be long before I get this working with your support. Thank you (A coffee is on it's way once I figure out the paypal thing)
-Steve
nzdreamer55
Posts: 162
Joined: 20 Jul 2012, 23:25

Re: Need help with using CLI and writing script.

Post by nzdreamer55 »

I forgot to ask. If the watcher is running is there a way to hide the cli window?
User avatar
rednoah
The Source
Posts: 22923
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: Need help with using CLI and writing script.

Post by rednoah »

1. It'll download and cache the script and it'll also check if there's a newer version of that script every 24h hours.

2. Looks like after you copied in a new folder filebot tries to hook into filesystem events for that folders. It's probably easiest to just use the housekeeping script instead to work around this problem.

3. There's lots of ways by just running that cmd directly, not via cmd.exe, easiest way is probably to make a windows shortcut with "filebot.launcher.exe -script fn:watcher..." So if you use the launcher for the GUI app then there shouldn't be any console stuff.
:idea: Please read the FAQ and How to Request Help.
nzdreamer55
Posts: 162
Joined: 20 Jul 2012, 23:25

Re: Need help with using CLI and writing script.

Post by nzdreamer55 »

Here is some interesting news...
I was able to run the house cleaning script which was able to watch the folder and when new files were dropped into it, move them to another folder.

Code: Select all

Microsoft Windows [Version 6.1.7601]
Copyright (c) 2009 Microsoft Corporation.  All rights reserved.

C:\Users\Kira>filebot -script fn:housekeeping "\\TITANSERVER\1media.3tb\Unpack\T
V.Series.Landing\" --output "\\TITANSERVER\1media.3tb\Unpack\" --format "Movies/
{n} {y}" --db TheMovieDB
Jul 22, 2012 11:54:08 AM net.sf.ehcache.store.compound.factories.DiskPersistentS
torageFactory <init>
WARNING: The index for data file C:\Users\Kira\AppData\Roaming\FileBot\cache\web
-persistent-datasource.data is out of date, probably due to an unclean shutdown.
 Deleting index file C:\Users\Kira\AppData\Roaming\FileBot\cache\web-persistent-
datasource.index
Jul 22, 2012 11:54:08 AM net.sf.ehcache.store.compound.factories.DiskPersistentS
torageFactory <init>
WARNING: The index for data file C:\Users\Kira\AppData\Roaming\FileBot\cache\web
-datasource.data is out of date, probably due to an unclean shutdown. Deleting i
ndex file C:\Users\Kira\AppData\Roaming\FileBot\cache\web-datasource.index
Press ENTER to abort
Exception in thread "Thread-4" org.codehaus.groovy.runtime.InvokerInvocationExce
ption: java.io.FileNotFoundException: \\TITANSERVER\1media.3tb\Unpack\TV.Series.
Landing" --output \TITANSERVER\1media.3tb\Unpack"
        at org.codehaus.groovy.reflection.CachedMethod.invoke(CachedMethod.java:
97)
        at groovy.lang.MetaMethod.doMethodInvoke(MetaMethod.java:233)
        at org.codehaus.groovy.runtime.metaclass.ClosureMetaClass.invokeMethod(C
losureMetaClass.java:272)
        at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:883)
        at groovy.lang.Closure.call(Closure.java:410)
        at groovy.lang.Closure.call(Closure.java:404)
        at groovy.lang.Closure.run(Closure.java:488)
        at java.lang.Thread.run(Unknown Source)
Caused by: java.io.FileNotFoundException: \\TITANSERVER\1media.3tb\Unpack\TV.Ser
ies.Landing" --output \TITANSERVER\1media.3tb\Unpack"
        at org.codehaus.groovy.runtime.DefaultGroovyMethods.checkDir(DefaultGroo
vyMethods.java:15200)
        at org.codehaus.groovy.runtime.DefaultGroovyMethods.traverse(DefaultGroo
vyMethods.java:15451)
        at org.codehaus.groovy.runtime.DefaultGroovyMethods.traverse(DefaultGroo
vyMethods.java:15370)
        at org.codehaus.groovy.runtime.dgm$843.doMethodInvoke(Unknown Source)
        at org.codehaus.groovy.runtime.metaclass.ClosureMetaClass.invokeMethod(C
losureMetaClass.java:361)
        at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:883)
        at org.codehaus.groovy.runtime.callsite.PogoMetaClassSite.callCurrent(Po
goMetaClassSite.java:66)
        at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCallCurrent
(CallSiteArray.java:46)
        at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callCurrent(Abs
tractCallSite.java:133)
        at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callCurrent(Abs
tractCallSite.java:145)
        at Script2$_run_closure15.doCall(Script2.groovy:22)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
        at java.lang.reflect.Method.invoke(Unknown Source)
        at org.codehaus.groovy.reflection.CachedMethod.invoke(CachedMethod.java:
90)
        at org.codehaus.groovy.runtime.metaclass.ClosureMetaMethod.invoke(Closur
eMetaMethod.java:80)
        at org.codehaus.groovy.runtime.callsite.PojoMetaMethodSite$PojoMetaMetho
dSiteNoUnwrapNoCoerce.invoke(PojoMetaMethodSite.java:271)
        at org.codehaus.groovy.runtime.callsite.PojoMetaMethodSite.call(PojoMeta
MethodSite.java:53)
        at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSi
teArray.java:42)
        at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCa
llSite.java:108)
        at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCa
llSite.java:116)
        at Script2$_run_closure16_closure71.doCall(Script2.groovy:23)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
        at java.lang.reflect.Method.invoke(Unknown Source)
        at org.codehaus.groovy.reflection.CachedMethod.invoke(CachedMethod.java:
90)
        at groovy.lang.MetaMethod.doMethodInvoke(MetaMethod.java:233)
        at org.codehaus.groovy.runtime.metaclass.ClosureMetaClass.invokeMethod(C
losureMetaClass.java:272)
        at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:883)
        at groovy.lang.Closure.call(Closure.java:410)
        at groovy.lang.Closure.call(Closure.java:423)
        at org.codehaus.groovy.runtime.DefaultGroovyMethods.findResults(DefaultG
roovyMethods.java:2536)
        at org.codehaus.groovy.runtime.dgm$264.doMethodInvoke(Unknown Source)
        at org.codehaus.groovy.runtime.metaclass.ClosureMetaClass.invokeMethod(C
losureMetaClass.java:361)
        at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:883)
        at org.codehaus.groovy.runtime.callsite.PogoMetaClassSite.callCurrent(Po
goMetaClassSite.java:66)
        at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCallCurrent
(CallSiteArray.java:46)
        at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callCurrent(Abs
tractCallSite.java:133)
        at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callCurrent(Abs
tractCallSite.java:141)
        at Script2$_run_closure16.doCall(Script2.groovy:23)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
        at java.lang.reflect.Method.invoke(Unknown Source)
        at org.codehaus.groovy.reflection.CachedMethod.invoke(CachedMethod.java:
90)
        at org.codehaus.groovy.runtime.metaclass.ClosureMetaMethod.invoke(Closur
eMetaMethod.java:80)
        at groovy.lang.MetaMethod.doMethodInvoke(MetaMethod.java:233)
        at org.codehaus.groovy.runtime.metaclass.ClosureMetaClass.invokeMethod(C
losureMetaClass.java:361)
        at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:883)
        at org.codehaus.groovy.runtime.callsite.PogoMetaClassSite.callCurrent(Po
goMetaClassSite.java:66)
        at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCallCurrent
(CallSiteArray.java:46)
        at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callCurrent(Abs
tractCallSite.java:133)
        at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callCurrent(Abs
tractCallSite.java:141)
        at Script2$_run_closure19.doCall(Script2.groovy:27)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
        at java.lang.reflect.Method.invoke(Unknown Source)
        at org.codehaus.groovy.reflection.CachedMethod.invoke(CachedMethod.java:
90)
        at org.codehaus.groovy.runtime.metaclass.ClosureMetaMethod.invoke(Closur
eMetaMethod.java:80)
        at org.codehaus.groovy.runtime.callsite.PojoMetaMethodSite$PojoMetaMetho
dSiteNoUnwrapNoCoerce.invoke(PojoMetaMethodSite.java:271)
        at org.codehaus.groovy.runtime.callsite.PojoMetaMethodSite.call(PojoMeta
MethodSite.java:53)
        at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSi
teArray.java:42)
        at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCa
llSite.java:108)
        at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCa
llSite.java:116)
        at Script3$_run_closure1.doCall(Script3.groovy:13)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
        at java.lang.reflect.Method.invoke(Unknown Source)
        at org.codehaus.groovy.reflection.CachedMethod.invoke(CachedMethod.java:
90)
        at groovy.lang.MetaMethod.doMethodInvoke(MetaMethod.java:233)
        at org.codehaus.groovy.runtime.metaclass.ClosureMetaClass.invokeMethod(C
losureMetaClass.java:272)
        at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:883)
        at org.codehaus.groovy.runtime.callsite.PogoMetaClassSite.callCurrent(Po
goMetaClassSite.java:66)
        at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCallCurrent
(CallSiteArray.java:46)
        at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callCurrent(Abs
tractCallSite.java:133)
        at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callCurrent(Abs
tractCallSite.java:141)
        at Script3$_run_closure1.doCall(Script3.groovy)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
        at java.lang.reflect.Method.invoke(Unknown Source)
        at org.codehaus.groovy.reflection.CachedMethod.invoke(CachedMethod.java:
90)
        ... 7 more
I'm not sure if this script is suppose to extract them and then name the extracted files. How do I get filebot do do this? Am I to use scripts or just command switched for filebot?

Just to recap. New files land in the new folder, I want filebot to extract them (if needed), rename the files based on if they are movies or TV series, get the subtitles, and then file the movie and subtitles appropriately into structure like this \TV show name\TV Show Name Series XX\TVShow name.SXXEXX.Title.avi

Thanks again
-Steve
nzdreamer55
Posts: 162
Joined: 20 Jul 2012, 23:25

Re: Need help with using CLI and writing script.

Post by nzdreamer55 »

Well I though that the housekeeping script moved the files from one directory to another, but it didn't even do this. So here is another attempt to run it on a folder where files get downloaded to. Can you tell what happens?

Code: Select all

Microsoft Windows [Version 6.1.7601]
Copyright (c) 2009 Microsoft Corporation.  All rights reserved.

C:\Users\Kira>filebot -script fn:housekeeping "\\TITANSERVER\1media.3tb\Unpack\TV.Series.Landing\" --output "\\TITANSERV
ER\1media.3tb\Unpack\" --format "Movies/{n} {y}" --db TheMovieDB
Press ENTER to abort
Exception in thread "Thread-4" org.codehaus.groovy.runtime.InvokerInvocationException: java.io.FileNotFoundException: \\
TITANSERVER\1media.3tb\Unpack\TV.Series.Landing" --output \TITANSERVER\1media.3tb\Unpack"
        at org.codehaus.groovy.reflection.CachedMethod.invoke(CachedMethod.java:97)
        at groovy.lang.MetaMethod.doMethodInvoke(MetaMethod.java:233)
        at org.codehaus.groovy.runtime.metaclass.ClosureMetaClass.invokeMethod(ClosureMetaClass.java:272)
        at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:883)
        at groovy.lang.Closure.call(Closure.java:410)
        at groovy.lang.Closure.call(Closure.java:404)
        at groovy.lang.Closure.run(Closure.java:488)
        at java.lang.Thread.run(Unknown Source)
Caused by: java.io.FileNotFoundException: \\TITANSERVER\1media.3tb\Unpack\TV.Series.Landing" --output \TITANSERVER\1medi
a.3tb\Unpack"
        at org.codehaus.groovy.runtime.DefaultGroovyMethods.checkDir(DefaultGroovyMethods.java:15200)
        at org.codehaus.groovy.runtime.DefaultGroovyMethods.traverse(DefaultGroovyMethods.java:15451)
        at org.codehaus.groovy.runtime.DefaultGroovyMethods.traverse(DefaultGroovyMethods.java:15370)
        at org.codehaus.groovy.runtime.dgm$843.doMethodInvoke(Unknown Source)
        at org.codehaus.groovy.runtime.metaclass.ClosureMetaClass.invokeMethod(ClosureMetaClass.java:361)
        at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:883)
        at org.codehaus.groovy.runtime.callsite.PogoMetaClassSite.callCurrent(PogoMetaClassSite.java:66)
        at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCallCurrent(CallSiteArray.java:46)
        at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callCurrent(AbstractCallSite.java:133)
        at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callCurrent(AbstractCallSite.java:145)
        at Script2$_run_closure15.doCall(Script2.groovy:22)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
        at java.lang.reflect.Method.invoke(Unknown Source)
        at org.codehaus.groovy.reflection.CachedMethod.invoke(CachedMethod.java:90)
        at org.codehaus.groovy.runtime.metaclass.ClosureMetaMethod.invoke(ClosureMetaMethod.java:80)
        at org.codehaus.groovy.runtime.callsite.PojoMetaMethodSite$PojoMetaMethodSiteNoUnwrapNoCoerce.invoke(PojoMetaMet
hodSite.java:271)
        at org.codehaus.groovy.runtime.callsite.PojoMetaMethodSite.call(PojoMetaMethodSite.java:53)
        at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:42)
        at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:108)
        at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:116)
        at Script2$_run_closure16_closure71.doCall(Script2.groovy:23)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
        at java.lang.reflect.Method.invoke(Unknown Source)
        at org.codehaus.groovy.reflection.CachedMethod.invoke(CachedMethod.java:90)
        at groovy.lang.MetaMethod.doMethodInvoke(MetaMethod.java:233)
        at org.codehaus.groovy.runtime.metaclass.ClosureMetaClass.invokeMethod(ClosureMetaClass.java:272)
        at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:883)
        at groovy.lang.Closure.call(Closure.java:410)
        at groovy.lang.Closure.call(Closure.java:423)
        at org.codehaus.groovy.runtime.DefaultGroovyMethods.findResults(DefaultGroovyMethods.java:2536)
        at org.codehaus.groovy.runtime.dgm$264.doMethodInvoke(Unknown Source)
        at org.codehaus.groovy.runtime.metaclass.ClosureMetaClass.invokeMethod(ClosureMetaClass.java:361)
        at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:883)
        at org.codehaus.groovy.runtime.callsite.PogoMetaClassSite.callCurrent(PogoMetaClassSite.java:66)
        at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCallCurrent(CallSiteArray.java:46)
        at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callCurrent(AbstractCallSite.java:133)
        at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callCurrent(AbstractCallSite.java:141)
        at Script2$_run_closure16.doCall(Script2.groovy:23)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
        at java.lang.reflect.Method.invoke(Unknown Source)
        at org.codehaus.groovy.reflection.CachedMethod.invoke(CachedMethod.java:90)
        at org.codehaus.groovy.runtime.metaclass.ClosureMetaMethod.invoke(ClosureMetaMethod.java:80)
        at groovy.lang.MetaMethod.doMethodInvoke(MetaMethod.java:233)
        at org.codehaus.groovy.runtime.metaclass.ClosureMetaClass.invokeMethod(ClosureMetaClass.java:361)
        at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:883)
        at org.codehaus.groovy.runtime.callsite.PogoMetaClassSite.callCurrent(PogoMetaClassSite.java:66)
        at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCallCurrent(CallSiteArray.java:46)
        at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callCurrent(AbstractCallSite.java:133)
        at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callCurrent(AbstractCallSite.java:141)
        at Script2$_run_closure19.doCall(Script2.groovy:27)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
        at java.lang.reflect.Method.invoke(Unknown Source)
        at org.codehaus.groovy.reflection.CachedMethod.invoke(CachedMethod.java:90)
        at org.codehaus.groovy.runtime.metaclass.ClosureMetaMethod.invoke(ClosureMetaMethod.java:80)
        at org.codehaus.groovy.runtime.callsite.PojoMetaMethodSite$PojoMetaMethodSiteNoUnwrapNoCoerce.invoke(PojoMetaMet
hodSite.java:271)
        at org.codehaus.groovy.runtime.callsite.PojoMetaMethodSite.call(PojoMetaMethodSite.java:53)
        at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:42)
        at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:108)
        at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:116)
        at Script3$_run_closure1.doCall(Script3.groovy:13)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
        at java.lang.reflect.Method.invoke(Unknown Source)
        at org.codehaus.groovy.reflection.CachedMethod.invoke(CachedMethod.java:90)
        at groovy.lang.MetaMethod.doMethodInvoke(MetaMethod.java:233)
        at org.codehaus.groovy.runtime.metaclass.ClosureMetaClass.invokeMethod(ClosureMetaClass.java:272)
        at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:883)
        at org.codehaus.groovy.runtime.callsite.PogoMetaClassSite.callCurrent(PogoMetaClassSite.java:66)
        at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCallCurrent(CallSiteArray.java:46)
        at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callCurrent(AbstractCallSite.java:133)
        at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callCurrent(AbstractCallSite.java:141)
        at Script3$_run_closure1.doCall(Script3.groovy)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
        at java.lang.reflect.Method.invoke(Unknown Source)
        at org.codehaus.groovy.reflection.CachedMethod.invoke(CachedMethod.java:90)
        ... 7 more
Thanks again
-S
User avatar
rednoah
The Source
Posts: 22923
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: Need help with using CLI and writing script.

Post by rednoah »

It's trying to open a file called:

Code: Select all

\\TITANSERVER\1media.3tb\Unpack\TV.Series.Landing" --output \TITANSERVER\1media.3tb\Unpack"
That's because your cmdline call is messed up. Never write \" => it makes the cmdline ignore it. Just don't use \ at the end.

e.g.

Code: Select all

\\TITANSERVER/1media.3tb/Unpack/TV.Series.Landing
: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: Need help with using CLI and writing script.

Post by rednoah »

Also updated the housekeeping and watcher script to support extracting archives, fetching subtitles and renaming out of the box (activated via -rename, -extract, -get-subtitles cmdline flags).
http://filebot.sourceforge.net/forums/v ... p=132#p132
:idea: Please read the FAQ and How to Request Help.
Post Reply