* added new example script
This commit is contained in:
parent
38d9903d0f
commit
ba119efdde
|
@ -8,6 +8,7 @@ File.metaClass.isSubtitle = { _types.getFilter("subtitle").accept(delegate) }
|
|||
File.metaClass.isVerification = { _types.getFilter("verification").accept(delegate) }
|
||||
|
||||
File.metaClass.hasFile = { c -> isDirectory() && listFiles().find{ c.call(it) }}
|
||||
File.metaClass.plus = { path -> new File(delegate, path) }
|
||||
|
||||
File.metaClass.getFiles = { def files = []; traverse(type:FILES) { files += it }; return files }
|
||||
List.metaClass.getFiles = { findResults{ it.getFiles() }.flatten().unique() }
|
||||
|
@ -15,9 +16,12 @@ List.metaClass.getFiles = { findResults{ it.getFiles() }.flatten().unique() }
|
|||
File.metaClass.getFolders = { def folders = []; traverse(type:DIRECTORIES, visitRoot:true) { folders += it }; return folders }
|
||||
List.metaClass.getFolders = { findResults{ it.getFolders() }.flatten().unique() }
|
||||
|
||||
File.metaClass.eachMediaFolder = { c -> getFolders().findAll{ it.hasFile{ it.isVideo() } }.each(c) }
|
||||
List.metaClass.eachMediaFolder = { c -> getFolders().findAll{ it.hasFile{ it.isVideo() } }.each(c) }
|
||||
|
||||
|
||||
def require(cond) {
|
||||
if (!cond()) throw new Exception('Require failed')
|
||||
}
|
||||
|
||||
|
||||
def rename(args) { args = _defaults(args)
|
||||
|
|
|
@ -0,0 +1,19 @@
|
|||
// filebot -script "http://filebot.sourceforge.net/data/shell/mvrn.groovy" --format "{n}/{n} - {'S'+s.pad(2)}E{e.pad(2)} - {t}" --db thetvdb <source folder> <destination folder>
|
||||
|
||||
// sanity check
|
||||
require { args.size == 2 && _args.format && _args.db }
|
||||
|
||||
// handle arguments
|
||||
def source = args[0]
|
||||
def destination = args[1] + _args.format
|
||||
|
||||
println 'Source Folder: ' + source
|
||||
println 'Target Format: ' + destination.path
|
||||
|
||||
/*
|
||||
* Move/Rename videos from source folder into destination folder
|
||||
*/
|
||||
source.eachMediaFolder {
|
||||
println 'Processing ' + it
|
||||
rename(folder:it, format:destination.path, db:_args.db)
|
||||
}
|
Loading…
Reference in New Issue