mirror of
https://github.com/mitb-archive/filebot
synced 2024-11-10 19:35:15 -05:00
* add Extended Attribute status to sysinfo
* make cleaner exts/terms/maxsize customizable via --def
This commit is contained in:
parent
e277ea2af3
commit
c7033f330c
@ -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
|
||||
}
|
||||
|
||||
|
@ -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
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user