Created
November 26, 2013 02:12
-
-
Save joerodriguez/7652481 to your computer and use it in GitHub Desktop.
filebot movie renamer
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// PERSONALIZED SETTINGS | |
def movieDir = '''/in/Movies''' | |
def movieFormat = '''/out/Movies/{n} ({y})/{n} ({y}){" CD$pi"}''' | |
// ignore chunk, part, par and hidden files | |
def incomplete(f) { f.name =~ /[.]incomplete|[.]chunk|[.]par$|[.]dat$/ } | |
// extract completed multi-volume rar files | |
[movieDir].getFolders{ !it.hasFile{ incomplete(it) } && it.hasFile{ it =~ /[.]rar$/ } }.each{ dir -> | |
// extract all archives found in this folder | |
def paths = extract(folder:dir) | |
// delete original archive volumes after successful extraction | |
if (paths != null && !paths.isEmpty()) { | |
dir.listFiles{ it =~ /[.]rar$|[.]r[\d]+$/ }*.delete() | |
} | |
} | |
movieDir.getFolders{ !it.hasFile{ incomplete(it) } && it.hasFile{ it.isVideo() } }.each{ dir -> | |
println "Processing $dir" | |
def files = dir.listFiles{ it.isVideo() } | |
// sort movies / subtitles | |
rename(file:files, db:'TheMovieDB', format:movieFormat) | |
// fetch subtitles | |
files += getSubtitles(file:files) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment