* update script samples
This commit is contained in:
parent
151c43028d
commit
dced0140d6
|
@ -42,8 +42,12 @@ List.metaClass.mapByExtension = { mapByExtension(delegate) }
|
|||
import static com.sun.jna.Platform.*;
|
||||
|
||||
def execute(String... args) {
|
||||
if (!_args.trustScript) {
|
||||
_log.severe("Execute failed: Script is not trusted");
|
||||
return -1
|
||||
}
|
||||
|
||||
def cmd = args.toList()
|
||||
|
||||
if (isWindows()) {
|
||||
cmd = ["cmd", "/c"] + cmd;
|
||||
}
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
// filebot -script "http://filebot.sourceforge.net/data/shell/mi.groovy" --format "{fn} [{resolution} {af} {vc} {ac}]" <folder>
|
||||
// filebot -script "http://filebot.sourceforge.net/data/shell/mi.groovy" <folder>
|
||||
|
||||
/*
|
||||
* Print media info for all video files using given or default format pattern
|
||||
|
@ -6,4 +6,4 @@
|
|||
args.getFiles()
|
||||
.findAll { it.isVideo() }
|
||||
.sort { a, b -> a.name.compareTo(b.name) }
|
||||
.each { println getMediaInfo(file:it) }
|
||||
.each { println getMediaInfo(file:it, format:"{fn} [{resolution} {af} {vc} {ac}]") }
|
||||
|
|
|
@ -1,19 +0,0 @@
|
|||
// 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)
|
||||
}
|
|
@ -1,33 +1,39 @@
|
|||
// Settings
|
||||
def source = "X:/source"
|
||||
def target = "Y:/target"
|
||||
def episodeDir = "X:/in/TV"
|
||||
def movieDir = "X:/in/Movies"
|
||||
|
||||
def episodeFormat = "{n}{'/Season '+s}/{episode}"
|
||||
def movieFormat = "{movie}/{movie}"
|
||||
def episodeFormat = "X:/out/TV/{n}{'/Season '+s}/{episode}"
|
||||
def movieFormat = "X:/out/Movies/{movie}/{movie}"
|
||||
|
||||
def exclude(file) {
|
||||
file =~ /\p{Punct}chunk/
|
||||
def exclude(f) { f =~ /\p{Punct}(chunk|part)/ }
|
||||
|
||||
// run cmdline unrar / unzip (require -trust-script)
|
||||
[episodeDir, movieDir].getFiles().findAll{ !exclude(it) && it.hasExtension('zip') }.each {
|
||||
execute("unzip", it.getAbsolutePath());
|
||||
}
|
||||
[episodeDir, movieDir].getFiles().findAll{ !exclude(it) && it.hasExtension('rar') }.each {
|
||||
execute("unrar", "-x", it.getAbsolutePath());
|
||||
}
|
||||
|
||||
/*
|
||||
* Fetch subtitles and sort into folders
|
||||
*/
|
||||
"$source/TV".eachMediaFolder() { dir ->
|
||||
episodeDir.eachMediaFolder() { dir ->
|
||||
def files = dir.listFiles { !exclude(it) }
|
||||
|
||||
// fetch subtitles
|
||||
files += getSubtitles(file:files)
|
||||
|
||||
// sort episodes / subtitles
|
||||
rename(file:files, db:'TVRage', format:"$target/TV/$episodeFormat")
|
||||
rename(file:files, db:'TVRage', format:episodeFormat)
|
||||
}
|
||||
|
||||
"$source/Movies".eachMediaFolder() { dir ->
|
||||
movieDir.eachMediaFolder() { dir ->
|
||||
def files = dir.listFiles { !exclude(it) }
|
||||
|
||||
// fetch subtitles
|
||||
files += getSubtitles(file:files)
|
||||
|
||||
// sort movies / subtitles
|
||||
rename(file:files, db:'TheMovieDB', format:"$target/Movies/$movieFormat")
|
||||
rename(file:files, db:'OpenSubtitles', format:movieFormat)
|
||||
}
|
||||
|
|
|
@ -5,6 +5,6 @@
|
|||
*/
|
||||
args.eachMediaFolder {
|
||||
getMissingSubtitles(folder:it)
|
||||
rename(folder:it)
|
||||
compute(file:it.listFiles().findAll{ it.isVideo() })
|
||||
def renamedFiles = rename(folder:it)
|
||||
compute(file:renamedFiles.findAll{ it.isVideo() })
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue