mirror of
https://github.com/mitb-archive/filebot
synced 2024-12-25 01:08:52 -05:00
* 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.*;
|
import static com.sun.jna.Platform.*;
|
||||||
|
|
||||||
def execute(String... args) {
|
def execute(String... args) {
|
||||||
def cmd = args.toList()
|
if (!_args.trustScript) {
|
||||||
|
_log.severe("Execute failed: Script is not trusted");
|
||||||
|
return -1
|
||||||
|
}
|
||||||
|
|
||||||
|
def cmd = args.toList()
|
||||||
if (isWindows()) {
|
if (isWindows()) {
|
||||||
cmd = ["cmd", "/c"] + cmd;
|
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
|
* Print media info for all video files using given or default format pattern
|
||||||
@ -6,4 +6,4 @@
|
|||||||
args.getFiles()
|
args.getFiles()
|
||||||
.findAll { it.isVideo() }
|
.findAll { it.isVideo() }
|
||||||
.sort { a, b -> a.name.compareTo(b.name) }
|
.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
|
// Settings
|
||||||
def source = "X:/source"
|
def episodeDir = "X:/in/TV"
|
||||||
def target = "Y:/target"
|
def movieDir = "X:/in/Movies"
|
||||||
|
|
||||||
def episodeFormat = "{n}{'/Season '+s}/{episode}"
|
def episodeFormat = "X:/out/TV/{n}{'/Season '+s}/{episode}"
|
||||||
def movieFormat = "{movie}/{movie}"
|
def movieFormat = "X:/out/Movies/{movie}/{movie}"
|
||||||
|
|
||||||
def exclude(file) {
|
def exclude(f) { f =~ /\p{Punct}(chunk|part)/ }
|
||||||
file =~ /\p{Punct}chunk/
|
|
||||||
|
// 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
|
* Fetch subtitles and sort into folders
|
||||||
*/
|
*/
|
||||||
"$source/TV".eachMediaFolder() { dir ->
|
episodeDir.eachMediaFolder() { dir ->
|
||||||
def files = dir.listFiles { !exclude(it) }
|
def files = dir.listFiles { !exclude(it) }
|
||||||
|
|
||||||
// fetch subtitles
|
// fetch subtitles
|
||||||
files += getSubtitles(file:files)
|
files += getSubtitles(file:files)
|
||||||
|
|
||||||
// sort episodes / subtitles
|
// 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) }
|
def files = dir.listFiles { !exclude(it) }
|
||||||
|
|
||||||
// fetch subtitles
|
// fetch subtitles
|
||||||
files += getSubtitles(file:files)
|
files += getSubtitles(file:files)
|
||||||
|
|
||||||
// sort movies / subtitles
|
// 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 {
|
args.eachMediaFolder {
|
||||||
getMissingSubtitles(folder:it)
|
getMissingSubtitles(folder:it)
|
||||||
rename(folder:it)
|
def renamedFiles = rename(folder:it)
|
||||||
compute(file:it.listFiles().findAll{ it.isVideo() })
|
compute(file:renamedFiles.findAll{ it.isVideo() })
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user