1
0
mirror of https://github.com/mitb-archive/filebot synced 2024-12-25 01:08:52 -05:00
filebot/website/scripts/mi.groovy
Reinhard Pointner 6d341807d4 * simplify syntax for passing in script variables
=> changed -Xa=x -Xb=y... to --def a=x b=y ...
2012-07-28 21:17:29 +00:00

25 lines
828 B
Groovy

// filebot -script fn:mi /path/to/media/ "MediaIndex.csv"
/*
* Print media info of all video files to CSV file
*/
def model = 'Name;Container;Resolution;Video Codec;Video Format;Audio Codec;Audio Format;Audio Language(s);Duration;File Size;Path'
def template = '{fn};{cf};{resolution};{vc};{vf};{ac};{af};{media.AudioLanguageList};{media.DurationString3};{file.length()};{file.getCanonicalPath()}'
// open destination file (writing files requires -trust-script)
args[1].withWriter{ output ->
// print header
output.writeLine(model)
// print info for each video file (sorted by filename)
args[0].getFiles{ it.isVideo() }.sort{ a, b -> a.name.compareToIgnoreCase(b.name) }.each{
def mi = getMediaInfo(file:it, format:template)
// print to console
println mi
// append to file
output.writeLine(mi)
}
}