* add Extended Attribute status to sysinfo

* make cleaner exts/terms/maxsize customizable via --def
This commit is contained in:
Reinhard Pointner 2012-10-27 12:39:52 +00:00
parent e277ea2af3
commit c7033f330c
2 changed files with 29 additions and 4 deletions

View File

@ -4,9 +4,12 @@
* Delete orphaned "clutter" files like nfo, jpg, etc and sample files
*/
def isClutter(f) {
def blacklist = f.path =~ /\b(?i:sample|trailer|extras|deleted.scenes|music.video|scrapbook)\b/ && f.length() < 100 * 1024 * 1024
def extension = f.hasExtension("jpg", "jpeg", "png", "gif", "nfo", "xml", "htm", "html", "log", "srt", "sub", "idx", "md5", "sfv", "txt", "rtf", "url", "db", "dna")
return blacklist || extension // path contains blacklisted terms or extension is blacklisted
def exts = tryQuietly{ exts } ?: /jpg|jpeg|png|gif|nfo|xml|htm|html|log|srt|sub|idx|md5|sfv|txt|rtf|url|db|dna|log/
def terms = tryQuietly{ terms } ?: /sample|trailer|extras|deleted.scenes|music.video|scrapbook/
def maxsize = tryQuietly{ maxsize as Long } ?: 100 * 1024 * 1024
// path contains blacklisted terms or extension is blacklisted
return f.extension ==~ "(?i)($exts)" || (f.path =~ "(?i)\\b($terms)\\b" && f.length() < maxsize)
}

View File

@ -20,6 +20,28 @@ try {
println error
}
// Extended File Attributes
try {
print 'Extended Attributes: '
if (net.sourceforge.filebot.Settings.useExtendedFileAttributes()){
// create new temp file
def f = new File('.xattr-test')
f.createNewFile() && f.deleteOnExit()
// xattr write, read and verify
def xattr = new net.sourceforge.filebot.media.MetaAttributes(f)
def payload = new Date()
xattr.setMetaData(payload)
assert xattr.getMetaData() == payload
println "OK"
} else {
println "DISABLED"
}
} catch(Throwable error) {
println error
}
// Java(TM) SE Runtime Environment 1.6.0_30 (headless)
println net.sourceforge.filebot.Settings.javaRuntimeIdentifier