Combine amc and watcher scripts
Combine amc and watcher scripts
I was wondering if there is an easy way to combine amc and the watcher script together? What I'm looking for is all the features and options of amc but the input is a folder it is watching. So, anything put into the watched folder is run through amc.
My guess is that it should be easy to just swap out the input source but i'm not sure. I looked at both groovy scripts but I dont know enough about programming to see the part of code that would need to be removed for it to work.
My guess is that it should be easy to just swap out the input source but i'm not sure. I looked at both groovy scripts but I dont know enough about programming to see the part of code that would need to be removed for it to work.
Re: Combine amc and watcher scripts
I just found this forum post:
http://www.filebot.net/forums/viewtopic.php?f=4&t=1004
This is what I want to do but I am receiving an error when I try to run it.
Any ideas?
http://www.filebot.net/forums/viewtopic.php?f=4&t=1004
This is what I want to do but I am receiving an error when I try to run it.
I'm sure I am doing something wrong. Here is my script.
C:\Rm_Finished_Torrents>filebot -script C:\Users\Amishman\Desktop\watcher_test.g
roovy
Jan 17, 2014 5:28:45 PM java.util.prefs.WindowsPreferences <init>
WARNING: Could not open/create prefs root node Software\JavaSoft\Prefs at root 0
x80000002. Windows RegCreateKeyEx(...) returned error code 5.
MultipleCompilationErrorsException: startup failed:
Script3.groovy: 1: expecting EOF, found 'watchman' @ line 1, column 6.
?def watchman = args.watch { changes ->
^
1 error
org.codehaus.groovy.control.MultipleCompilationErrorsException: startup failed:
Script3.groovy: 1: expecting EOF, found 'watchman' @ line 1, column 6.
?def watchman = args.watch { changes ->
^
1 error
at net.sourceforge.filebot.cli.ScriptShell.evaluate(ScriptShell.java:102
)
at net.sourceforge.filebot.cli.ScriptShell.runScript(ScriptShell.java:95
)
at net.sourceforge.filebot.cli.ArgumentProcessor.process(ArgumentProcess
or.java:125)
at net.sourceforge.filebot.Main.main(Main.java:190)
Failure (░_░)
Launch4j: Failed to run the given command.
Code: Select all
def watchman = args.watch { changes ->
execute('filebot', '-script', 'fn:amc', '-non-strict', '--output G:/', 'G:/Watched', '--log-file amc.log', '--action move', '--conflict override', --
def "seriesFormat=TV/{n}/{'Season '+s.pad (1)}/{s00e00} {t}/{n} {s00e00} {t}" "movieFormat=New Movies/{n} ({y}) {\"[$vf]\"}/{n} ({y})" --def clean=y --
def plex=localhost)
}
watchman.commitDelay = 5 * 1000
watchman.commitPerFolder = false
println "Waiting for events"
if (console) { console.readLine() } else { sleep(Long.MAX_VALUE) } // keep running and watch for changes
Re: Combine amc and watcher scripts
You're code has syntax errors. Your String literals are wrong.
If you pass in arguments just use '''...''' to avoid any escape issue that you may have with " or '
If you pass in arguments just use '''...''' to avoid any escape issue that you may have with " or '
Please read the FAQ and How to Request Help.
Re: Combine amc and watcher scripts
I think I am getting closer. This is my new error.
Here is my code:MissingMethodException: No signature of method: org.codehaus.groovy.jsr223.GroovyScriptEngineImpl.?def() is applicable for argument types: (Script2$1) values: [Script2$1@1961e2a]
Possible solutions: grep(), get(java.lang.String), grep(java.lang.Object), use([Ljava.lang.Object;), wait(), find()
groovy.lang.MissingMethodException: No signature of method: org.codehaus.groovy.jsr223.GroovyScriptEngineImpl.?def() is applicable for argument types: (Script2$1) values: [Script2$1@1961e2a]
Possible solutions: grep(), get(java.lang.String), grep(java.lang.Object), use([Ljava.lang.Object;), wait(), find()
at Script3.run(Script3.groovy:1)
at net.sourceforge.filebot.cli.ScriptShell.evaluate(ScriptShell.java:102
)
at net.sourceforge.filebot.cli.ScriptShell.runScript(ScriptShell.java:95
)
at net.sourceforge.filebot.cli.ArgumentProcessor.process(ArgumentProcess
or.java:125)
at net.sourceforge.filebot.Main.main(Main.java:190)
Failure (░_░)
Launch4j: Failed to run the given command.
Code: Select all
def watchman = args.watch { changes ->
execute('''filebot -script fn:amc -non-strict --output "G:/" "G:/Watched" --log-file amc.log --action move --conflict override --def "seriesFormat=TV/{n}/{'Season '+s.pad (1)}/{s00e00} {t}/{n} {s00e00} {t}" "movieFormat=New Movies/{n} ({y}) {\"[$vf]\"}/{n} ({y})" --def clean=y --def plex=localhost''')
}
Re: Combine amc and watcher scripts
I tested with the latest revision. Your code seems to work.
You probably have issues in the rest of the script.
You probably have issues in the rest of the script.
Please read the FAQ and How to Request Help.
Re: Combine amc and watcher scripts
This is the whole script.
I just put that in a batch file and run it. Should I be doing it another way?
Code: Select all
def watchman = args.watch { changes ->
execute('''filebot -script fn:amc -non-strict --output "G:/" "G:/Watched" --log-file amc.log --action move --conflict override --def "seriesFormat=TV/{n}/{'Season '+s.pad (1)}/{s00e00} {t}/{n} {s00e00} {t}" "movieFormat=New Movies/{n} ({y}) {\"[$vf]\"}/{n} ({y})" --def clean=y --def plex=localhost''')
}
watchman.commitDelay = 5 * 1000
watchman.commitPerFolder = false
println "Waiting for events"
if (console) { console.readLine() } else { sleep(Long.MAX_VALUE) } // keep running and watch for changes
Re: Combine amc and watcher scripts
batch file as in .bat file? Not sure what you mean, that doesn't make sense.
groovy script should be .groovy files and you should use filebot to execute the script with filebot -script script.groovy
When I say "latest version" I don't mean version 3.8 but the absolutely latest revision.
groovy script should be .groovy files and you should use filebot to execute the script with filebot -script script.groovy
When I say "latest version" I don't mean version 3.8 but the absolutely latest revision.
Please read the FAQ and How to Request Help.
Re: Combine amc and watcher scripts
I created .bat file to execute the script. This is the script in the .bat file
I just updated to the latest revision FileBot.jar 2014-01-17. It had 161 downloads this week.
I tried running it from the CLI.
I still received the same error.
Code: Select all
filebot -script C:\Users\Amishman\Desktop\watcher_test.groovy
I tried running it from the CLI.
Code: Select all
C:\Users\Amishman\Desktop>filebot -script watcher_test.groovy
MissingMethodException: No signature of method: org.codehaus.groovy.jsr223.GroovyScriptEngineImpl.?def() is applicable for argument types: (Script2$1) values: [Script2$1@1e7cb19]
Possible solutions: grep(), get(java.lang.String), use([Ljava.lang.Object;), grep(java.lang.Object), wait(), find()
groovy.lang.MissingMethodException: No signature of method: org.codehaus.groovy.
jsr223.GroovyScriptEngineImpl.?def() is applicable for argument types: (Script2$1) values: [Script2$1@1e7cb19]
Possible solutions: grep(), get(java.lang.String), use([Ljava.lang.Object;), grep(java.lang.Object), wait(), find()
at Script3.run(Script3.groovy:1)
at net.sourceforge.filebot.cli.ScriptShell.evaluate(ScriptShell.java:91)
at net.sourceforge.filebot.cli.ScriptShell.runScript(ScriptShell.java:85)
at net.sourceforge.filebot.cli.ArgumentProcessor.process(ArgumentProcessor.java:123)
at net.sourceforge.filebot.Main.main(Main.java:194)
Failure (░_░)
Launch4j: Failed to run the given command.
Re: Combine amc and watcher scripts
It all works fine.
I guess you're using a crappy windows editor that adds a byte marker to the beginning of the file, which makes it illegal groovy code. Use a good editor like notepad2 or notepad++ and NEVER EVER using anything made by microsoft like editor, wordpad or word.
I guess you're using a crappy windows editor that adds a byte marker to the beginning of the file, which makes it illegal groovy code. Use a good editor like notepad2 or notepad++ and NEVER EVER using anything made by microsoft like editor, wordpad or word.
Please read the FAQ and How to Request Help.
Re: Combine amc and watcher scripts
ok, I used notepad++ to make the groovy script. When I run the script, it now says "waiting for event". I take it to mean that it is watching the G:/Watched folder. I put a tv show into the folder and nothing happens that I can tell. The TV show has not been moved or renamed and it has been about 15 minutes. I thought the time was set for 5 seconds?
Re: Combine amc and watcher scripts
I've tried the same script and it starts working after 5 seconds when a file is added.
Is this what you're calling?
How would it know which folder to watch?
Is this what you're calling?
Code: Select all
filebot -script watcher_test.groovy
Code: Select all
filebot -script watcher_test.groovy /path/to/folder/to/watch
Please read the FAQ and How to Request Help.
Re: Combine amc and watcher scripts
I thought I was telling it what folder to watch in the script but now that you mention it. I was telling the amc script not the watcher script. It is working great now.
I just made donation to Thank you so much for all your help.
I just made donation to Thank you so much for all your help.
Re: Combine amc and watcher scripts
I was doing some testing and almost everything is working perfectly. The only thing that I can tell so far that is not working properly is the movie rename part. It does not add the 720p or 1080p to the folder name.
The code works properly when uTorrent downloads the file but it doesn't worl in the watched folder. I'm guessing it has to do with the quotes but I cant seem to find the right code.
Code: Select all
"movieFormat=New Movies/{n} ({y}) {\"[$vf]\"}/{n} ({y})"
Re: Combine amc and watcher scripts
The Escape tool gave me this, difference is it escaped the "$" sign:
Escape tool:
filename -script fn:escape
Code: Select all
"movieFormat=New Movies/{n} ({y}) {\"[\$vf]\"}/{n} ({y})"
filename -script fn:escape
Re: Combine amc and watcher scripts
Thanks bonelifer but that doesn't work. It just gives the name and year of the movie - Caddyshack (1980) in the folder name but not resolution - Caddyshack (1980) [1080p].
For it to work in uTorrent I had to remove the \ before the $. The script above works perfect in uTorrent for my naming scheme.
For it to work in uTorrent I had to remove the \ before the $. The script above works perfect in uTorrent for my naming scheme.
G:\New Movies\Caddyshack (1980) [1080p]\Caddyshack (1980).mp4
Re: Combine amc and watcher scripts
Yeah, but now you have the cmdline String in the Groovy code so it needs to be Groovy String escaped, not Windows CMD escaped, or possibly both.
Check the amc output and see what amc thinks you have passed in, you should see the issue right away which part doesn't get passed along as you had thought.
Check the amc output and see what amc thinks you have passed in, you should see the issue right away which part doesn't get passed along as you had thought.
Please read the FAQ and How to Request Help.
Re: Combine amc and watcher scripts
This is what is in my amc.log.
It doesn't tell me that it has renamed anything but the file is being renamed.Jan 20, 2014 3:47:18 PM java.util.prefs.WindowsPreferences <init>
WARNING: Could not open/create prefs root node Software\JavaSoft\Prefs at root 0x80000002. Windows RegCreateKeyEx(...) returned error code 5.
Parameter: seriesFormat = TV/{n}/{'Season '+s.pad (1)}/{s00e00} {t}/{n} {s00e00} {t}
Parameter: movieFormat = New Movies/{n} ({y}) {[$vf]}/{n} ({y})
Parameter: clean = y
Parameter: plex = localhost
Argument: G:\Watched
Done ヾ(@⌒ー⌒@)ノ
Re: Combine amc and watcher scripts
Then you're confusing something, running multiple watchers or something, I donno, I can only tell you that in this run you show me here nothing has been renamed.
EDIT: This is not valid format code:
NO
YES (String expression)
YES (Array expression)
EDIT: This is not valid format code:
NO
Code: Select all
{[$vf]}
Code: Select all
{"[$vf]"}
Code: Select all
{[vf]}
Please read the FAQ and How to Request Help.
Re: Combine amc and watcher scripts
It's working now.
got it working.
It's possible I had multiple watching scripts running but I'm not sure.
Thanks for all your help.
Code: Select all
{[vf]}
It's possible I had multiple watching scripts running but I'm not sure.
Thanks for all your help.