Page 1 of 2
Script to replace (Event Ghost, SCRU, theRenamer)
Posted: 05 Sep 2012, 05:43
by sam829
I have been using SCRU and theRenamer, tied together with Event Ghost and recently someone suggested I have a look at Filebot to make things more efficient.
Below is a run down of what I am currently working with. I'd like to know if what I'm even trying to do is possible with Filebot. If so a helping hand will certainly earn continued donations to encourage future project development. So, as an early thank you to the developer I sent a few coffee's your way.
Directory Structure:
- Incomplete
- Complete
- TV Complete
- Movies Complete
Process:
- Files are being transferred into incomplete
- Moved to complete, into their appropriate folders
- \Complete\TV
- \Complete\Movies
- Extracted from their above folders into
- EX.) \Complete\TV --> \TV Complete
- EX.) \Complete\Movies --> \Movies Complete
- theRenamer monitors TV Complete and Movies Complete
- Renames the files and moves them to my NAS (Synology DS212) into the appropriate folders
- \\ds212\Movies
- \\ds212\TV
Thank you kindly for your time and patience!
Re: Script to replace (Event Ghost, SCRU, theRenamer)
Posted: 05 Sep 2012, 09:49
by rednoah
Not sure how experience you have with scripting, but it shouldn't be that hard, probably mostly copy and paste.
These two scripts can serve as reference and contain all the functions you might need:
http://filebot.sourceforge.net/forums/v ... =4&t=5#p52
http://filebot.sourceforge.net/forums/v ... =215#p1561
This seems like a good example. Let me know if you need any help.
Re: Script to replace (Event Ghost, SCRU, theRenamer)
Posted: 05 Sep 2012, 10:17
by rednoah
These scripts you might be able to use right out of the box:
http://filebot.sourceforge.net/forums/v ... 4&t=5#p132
Try this:
Code: Select all
filebot -script fn:housekeeping -extract -rename 'E:/Complete/TV' --output '\\ds212/TV' --format "{n}/Season {s}/{n} - {sxe} - {t}" --db TheTVDB
Re: Script to replace (Event Ghost, SCRU, theRenamer)
Posted: 05 Sep 2012, 16:24
by sam829
@rednoah
Thank you for your quick response. Although, I'm not the most familiar with scripting. Hopefully, I'll learn something and be able to contribute help to those with similar questions.
How can I execute the scripts automatically? I do understand though how to run them from the CLI manually.
Code: Select all
filebot -script fn:housekeeping -extract -rename 'E:/Complete/TV' --output '\\ds212/TV' --format "{n}/Season {s}/{n} - {sxe} - {t}" --db TheTVDB
^^ I'm assuming I'd have to use two scripts, one for \Complete\TV and one for \Complete\Movies?
My apologies if I'm testing your patience. Once I wrap my head around this, everything will be smooth sailing.
EDIT: Also, is it possible to add the watch.groovy script to check for file modification?
Re: Script to replace (Event Ghost, SCRU, theRenamer)
Posted: 05 Sep 2012, 17:08
by rednoah
1. Yep with the watcher/housekeeping scripts you'd run two filebot instances running the same script but with different arguments for TV Shows / Movie mode respectively.
2. These two scripts run indefinitely, just start them and let it run.
3. watch/housekeeping should both work, just try it. Check that other thread for details on those two scripts.
Code: Select all
filebot -script fn:housekeeping ...
Re: Script to replace (Event Ghost, SCRU, theRenamer)
Posted: 05 Sep 2012, 17:11
by sam829
Code: Select all
c:\Program Files\FileBot>filebot -script fn:housekeeping -extract -rename 'M:\Complete\TV' --output '\\ds212\TV' --format "{n}/Season {s}/{n} - {sxe} - {t}" --db TheTVDB
Sep 05, 2012 12:55:22 PM net.sourceforge.filebot.cli.ArgumentBean getFiles
WARNING: The filename, directory name, or volume label syntax is incorrect
Press ENTER to abort
Done ?(?????)?
Error I receive when running the script.
Re: Script to replace (Event Ghost, SCRU, theRenamer)
Posted: 06 Sep 2012, 00:49
by sam829
I'm a bit slow, fixed the above issue.
However, the extracted video I get comes up as broken/incomplete in VLC. This does not happen when I manually extract the files.
EDIT: It appears that it's trying to complete the process before the multi part RAR's are finished...
Re: Script to replace (Event Ghost, SCRU, theRenamer)
Posted: 06 Sep 2012, 01:03
by rednoah
Does that happen for any archive or only that one? Could it be that filebot runs before things have been moved completely, i.e. running -extract on an incomplete file? Are you on 32 or 64 bit? I'm developing on 32bit Win7, never had any problems.
Re: Script to replace (Event Ghost, SCRU, theRenamer)
Posted: 06 Sep 2012, 01:06
by rednoah
Make sure your download folders and your 'completed' folder are on the same harddrive, that way moving files/folders should be instant. Or you can try fn:watcher which should be able to detect that there's still copy/move operations going on.
Re: Script to replace (Event Ghost, SCRU, theRenamer)
Posted: 06 Sep 2012, 01:14
by sam829
I fixed the issue by increasing 'watchman.commitDelay = 10 * 1000' //default = 5
However what I'm noticing is that the if a program moves files from /Incomplete --> /Complete/TV the script does not pick up on the moved files.
EX.) uTorrent downloads into Incomplete, Moves to complete (based on persistent labels Movies|TV|etc.)
If I transfer straight into /Complete/TV, watcher picks up and successfully carries out the script.
EX.) Usenet client downloads into a specified folder (chosen by user)
The files I chose to transfer were identical to ensure there was little to no chance of their being an issue.
Soo close
Hopefully once this is sorted doing the same for movies will be a breeze only having to change a few parameters.
Re: Script to replace (Event Ghost, SCRU, theRenamer)
Posted: 06 Sep 2012, 04:57
by rednoah
I've noticed this problem but I have no idea how to fix it, might be and underlying Windows-Java problem. Especially if a folder is moved as a whole, I do get the event, but at that time the folder is empty, but if i step through in debug mode it works, some sort of race-condition with how windows moves files and sends events.
So far I don't have a reliable fix for this, if folders files are moved one by one it always works as far as I've tested.
Re: Script to replace (Event Ghost, SCRU, theRenamer)
Posted: 06 Sep 2012, 05:04
by sam829
Is it possible to change my configuration slightly to alleviate the issue. Along the lines of your full automated script
http://filebot.sourceforge.net/forums/v ... =215#p1561
EDIT: The ultimate goal is to have the files end up on my NAS in their respective folders. The method of getting there doesn't matter as long as it's automated. I see that in your automated script you are able to distinguish between the two. Would you be willing to assist me in customizing it to my needs? If your running low on coffee say so

Re: Script to replace (Event Ghost, SCRU, theRenamer)
Posted: 06 Sep 2012, 06:56
by rednoah
Sure, the watcher script tries to use filesystem events to get notified about newly finished downloads. Most tools like utorrent, deluge, etc have an option to just run a program on newly downloaded files. That'll work best.
The utorrent integration script is pretty flexible, it's designed for utorrent, but it's still just a cmdline call, any application can call it and hand in cmdline arguments. Just need to figure it out for each tool you're using. The cmdline usage should be pretty self-explanatory, but if you need help just let me know.
e.g.
Code: Select all
filebot -script fn:utorrent-postprocess --output '\\ds212\Movies' --action copy --conflict override -non-strict --def subtitles=y artwork=y 'ut_dir=<NEW_MOVIE_DIR>' 'ut_kind=multi' 'ut_label=Movie'
Re: Script to replace (Event Ghost, SCRU, theRenamer)
Posted: 06 Sep 2012, 20:01
by sam829
Thank you for your reply.
However, I've found some info that may or not be a look in the right direction.
http://jnotify.sourceforge.net/
http://java.dzone.com/articles/using-ja ... tchservice
Re: Script to replace (Event Ghost, SCRU, theRenamer)
Posted: 07 Sep 2012, 00:06
by rednoah
watcher.groovy is already based in the Java 7 WatchService. Here is what happens, files get moved, no problem. Folder gets moved, filebot registers a new WatchService for that folder. Here's the catch, when FileBot gets the event that a new folder is created, that folder is still empty! But the new registered WatchService also never gets events about files being moved at a later point, even though the folder does contain files. Basically when a whole folder is moved, the files in the folder elude the WatchService. Not sure if I can fix that or if that's a WatchService bug on the windows implementation.
Re: Script to replace (Event Ghost, SCRU, theRenamer)
Posted: 07 Sep 2012, 06:49
by sam829
I'd certainly help fund your troubles along the way for coming up with a working solution.
EDIT: Things are finally to a satisfactory point. A bit further and you'll be leaving similar packages in the dust. Much respect to you kind sir!
Re: Script to replace (Event Ghost, SCRU, theRenamer)
Posted: 11 Sep 2012, 02:18
by sam829
I decided to tinker with adding artwork to my movies just to speed up the process on my Boxee Box's.
Code: Select all
filebot -script fn:artwork.tmdb -rename M:/MoviesComplete --output \\ds212/Movies --format "{n} ({y})/{n} ({y}){"CD$pi"}" -non-strict --db TheMovieDB
I tried maybe a half dozen different movies and for some reason it would would come up with "Movie Not Found". I tried IMDB, and THEMVDB.
However, unless I gave the parent folder a near exact naming; Goats, instead of groupname-goats-1080p it would not find the movie. Am I missing something?
Thank you once again!
Re: Script to replace (Event Ghost, SCRU, theRenamer)
Posted: 11 Sep 2012, 02:40
by rednoah
Look into the script. Unless you specify --q it'll just use the folder name as search query.That means that movies are expected to be organized into folders and movie is determined using the name of the parent folder of each video file.
Also --db TheMovieDB|IMDb is useless in this case, the script will always work with TheMovieDB.
EDIT: Of course you can always tweak the script to figure out the query some other way, doesn't have to be the parent folders.

Re: Script to replace (Event Ghost, SCRU, theRenamer)
Posted: 13 Sep 2012, 18:55
by sam829
I've spent the better part of the last 72 hrs, sifting through example scripts and reading over the beginners guide @ '
http://groovy.codehaus.org/' and I'd say I'm further away then I was before I started.
If you have the time maybe you could point me in the right direction. Not asking you to write a script for me, just a nudge to get the ball rolling.
I'm trying to 'getFiles', rather than 'getFolders'.
I've been tinkering with 'sort.groovvy' in attempts to create a script to:
1. Rename (Files)
2. Send email upon competition
^I'm not even sure if I'm on the same planet
http://groovy.codehaus.org/api/groovy/l ... File%28%29
Re: Script to replace (Event Ghost, SCRU, theRenamer)
Posted: 14 Sep 2012, 05:27
by rednoah
Have a look at this as an example:
Code: Select all
def input = args.getFiles{ it.isVideo() }
input.each{ println "input: $it" }
def output = rename(file:input)
output.each{ println "output: $it" }
include('fn:lib/ant')
sendGmail(subject:'FileBot [test]', message:output.join('\n'), to:'[email protected]', user:'you', password:'12345')
Re: Script to replace (Event Ghost, SCRU, theRenamer)
Posted: 14 Sep 2012, 05:31
by rednoah
Judging by that link (that is kinda on the planet but on a different continent...) you missed the parts where filebot adds lots useful stuff to the groovy runtime.
Many functions that you see in filebot scripts may not be part of Groovy, but predefined by filebot.
=>
http://sourceforge.net/p/filebot/code/H ... force=True
Re: Script to replace (Event Ghost, SCRU, theRenamer)
Posted: 17 Sep 2012, 02:02
by sam829
Thank you for the info above. Finally got me over that hump
Code: Select all
C:\Windows\system32>filebot -rename M:/TVComplete --output \\ds212/TV --format "{n}/Season {s}/{n} {sxe} {t}" -non-strict --db TheTVDB
Rename episodes using [TheTVDB]
Auto-detected query: [Diners Drive Ins and Dives]
Failed to fetch episode data: [Diners Drive Ins and Dives]
Exception: Unable to match files to episode data
Failure (°_°)
It's happening with less popular titled shows? Any thoughts?
Re: Script to replace (Event Ghost, SCRU, theRenamer)
Posted: 17 Sep 2012, 03:19
by rednoah
If you add it to thetvdb I'm sure others would appreciate it.

Re: Script to replace (Event Ghost, SCRU, theRenamer)
Posted: 17 Sep 2012, 05:27
by sam829
It is on the theTVDB
http://thetvdb.com/?tab=series&id=82918
When issues like this occur I end up just firing 'theRenamer', which is using theTVDB as it's source as well.
Which leads me to believe there is something in the way Filebot is detecting the file name that is causing the unable to match episode data.
I've begun to grow rather fond of Filebot and would prefer to not to have to switch on and off.

Re: Script to replace (Event Ghost, SCRU, theRenamer)
Posted: 17 Sep 2012, 05:36
by sam829
Code: Select all
Failed to fetch episode data: [Diners Drive Ins and Dives]
<--- Output being displayed by Filebot (From Above)
Diners, Drive-ins and Dives <--- Name of file and title on theTVDB
Would characters such as ( , - ) cause problems?