From c7033f330c5188a6f357975ebeffc3f36eee5c4e Mon Sep 17 00:00:00 2001 From: Reinhard Pointner Date: Sat, 27 Oct 2012 12:39:52 +0000 Subject: [PATCH] * add Extended Attribute status to sysinfo * make cleaner exts/terms/maxsize customizable via --def --- website/scripts/cleaner.groovy | 11 +++++++---- website/scripts/sysinfo.groovy | 22 ++++++++++++++++++++++ 2 files changed, 29 insertions(+), 4 deletions(-) diff --git a/website/scripts/cleaner.groovy b/website/scripts/cleaner.groovy index 51342f71..9d2f6ff4 100644 --- a/website/scripts/cleaner.groovy +++ b/website/scripts/cleaner.groovy @@ -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) } @@ -14,7 +17,7 @@ def clean(f) { println "Delete $f" // do a dry run via --action test - if (_args.action == 'test') { + if (_args.action == 'test') { return false } diff --git a/website/scripts/sysinfo.groovy b/website/scripts/sysinfo.groovy index 089b591d..dabb0ec2 100644 --- a/website/scripts/sysinfo.groovy +++ b/website/scripts/sysinfo.groovy @@ -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