Thanks rednoah. It works great!
I thought I would share my scripts with everone.
I use uTorrent and a watch folder. The output of both scripts is same. Here is what the scripts do.
- Places the file on the drive with the most space.
Checks to see if the file already exists.
Makes a "collection" folder if there is one.
Moves "The, A" to the end.
Keeps 3D in the name if it is there.
Keeps "Extended, Unrated,etc..." in the name if it is there.
Places the resolution in the folder name.
Watch folder checks every 5 seconds to see if a file has been added.
Extracts files
Deletes any extra folders/files.
Sends a pushbullet notification when completed.
Notifies Plex.
This is the output for movies.
H:\Movies\Die Hard Collection\Live Free or Die Hard 3D (Extended) (2007) [1080p]\Live Free or Die Hard 3D (Extended) (2007).mp4
or
D:\Movies\47 Ronin (2013) [1080p]\47 Ronin (2013).mp4
This is the output for TV Shows.
G:\TV\Arrested Development\Season 3\S03E03 Forget Me Now.mkv
Here is my uTorrent script:
Code: Select all
filebot -script fn:amc --output "E:/" --log-file amc.log --action move --conflict auto -non-strict --def "seriesFormat={[\"E:\", \"F:\", \"G:\", \"H:\"].collect{ drive -> def a=n; return new File(drive+\"/TV/\", a)}.sort{ a,b -> a.exists() <=> b.exists() ?: a.diskSpace <=> b.diskSpace }.last()}/{episode.special ? \"Season \"+s.pad(2) : \"Season \"+s.pad(1)}/{s00e00} {t}" "movieFormat={['E:', 'F:', 'H:'].collect{ new File(it+'/Movies/'+any{collection+'/'}{''}) }.sort{ a,b -> a.exists() <=> b.exists() ?: a.diskSpace <=> b.diskSpace }.last()}/{n.replaceFirst(/^(?i)(The|A|An)\s(.+)/, /$2, $1/)} {fn.contains('3d') || fn.contains('3D') || fn.contains('3-D') ? ' '+'3D':\"\"}{' (' + fn.matchAll(/extended|uncensored|remastered|unrated|uncut|directors.cut|special.edition/)*.upperInitial()*.lowerTrail().sort().join(', ').replaceAll(/[._]/, \" \") + ')'} ({y}) {\"[$vf]\"}/{n} {fn.contains('3d') || fn.contains('3D') || fn.contains('3-D') ? ' '+'3D':\"\"}{' (' + fn.matchAll(/extended|uncensored|remastered|unrated|uncut|directors.cut|special.edition/)*.upperInitial()*.lowerTrail().sort().join(', ').replaceAll(/[._]/, \" \") + ')'} ({y})" --def deleteAfterExtract=y --def clean=y --def plex=localhost --def pushbullet=******************** "ut_label=%L" "ut_state=%S" "ut_title=%N" "ut_kind=%K" "ut_file=%F" "ut_dir=%D"
My watch folder script is placed in a batch file. I have the the batch file set to start whenever the computer is restarted.
Here is the watch folder script:
Code: Select all
def watchman = args[0].watch { changes ->
execute('''filebot -script fn:amc -non-strict --output "E:/" "G:/Watched" --log-file amc.log --action move --conflict auto --def "seriesFormat={['E:', 'F:', 'G:', 'H:'].collect{ drive -> def a=n; return new File(drive+'/TV/', a)}.sort{ a,b -> a.exists() <=> b.exists() ?: a.diskSpace <=> b.diskSpace }.last()}/{episode.special ? 'Season '+s.pad(2) : 'Season '+s.pad(1)}/{s00e00} {t}" \"movieFormat={['E:', 'F:', 'G:', 'H:'].collect{ new File(it+'/Movies/'+any{collection+'/'}{''}) }.sort{ a,b -> a.exists() <=> b.exists() ?: a.diskSpace <=> b.diskSpace }.last()}/{n.replaceFirst(/^(?i)(The|A|An)\\s(.+)/, /$2, $1/)} {fn.contains('3D') || fn.contains('3-D') ? ' '+'3D':''}{' (' + fn.matchAll(/extended|uncensored|remastered|unrated|uncut|directors.cut|special.edition/)*.upperInitial()*.lowerTrail().sort().join(', ').replaceAll(/[._]/, ' ') + ')'} ({y}) {[vf]}/{n}{fn.contains('3D') || fn.contains('3-D') ? ' '+'3D':''}{' (' + fn.matchAll(/extended|uncensored|remastered|unrated|uncut|directors.cut|special.edition/)*.upperInitial()*.lowerTrail().sort().join(', ').replaceAll(/[._]/, ' ') + ')'} ({y})\" \"musicFormat=Music/{n}/{\$album/}{\${pi.pad(2)}. } {t}\" --def plex=localhost --def clean=y --def deleteAfterExtract=y''')
}
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