forked from filebot/scripts
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsysinfo.groovy
112 lines (95 loc) · 3.02 KB
/
sysinfo.groovy
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
// filebot -script fn:sysinfo
// FileBot 2.62 (r993)
println Settings.getApplicationIdentifier()
// JNA Native: 3.5.0
try {
print 'JNA Native: '
println com.sun.jna.Native.nativeVersion
} catch(Throwable error) {
println error.cause
}
// MediaInfo: MediaInfoLib - v0.7.48
try {
print 'MediaInfo: '
println MediaInfo.version()
} catch(Throwable error) {
println error.cause
}
// 7-Zip-JBinding: OK
try {
if (System.getProperty('net.filebot.Archive.extractor') != 'SevenZipExecutable') {
print '7-Zip-JBinding: '
net.filebot.archive.SevenZipLoader.requireNativeLibraries() // try to load 7-Zip-JBinding native libs (default)
println 'OK'
} else {
print 'p7zip: '
println System.getProperty('net.filebot.Archive.7z', '7z').execute().text.match(/^p7zip(.+)$/).trim()
}
} catch(Throwable error) {
println error
}
// chromaprint-tools
try {
print 'chromaprint-tools: '
def fpcalc = AcoustID.getChromaprintCommand()
def version = [fpcalc, '-version'].execute().text.trim() ?: 'fpcalc -version failed'
println "$version ($fpcalc)"
} catch(Throwable error) {
println error
}
// Extended File Attributes
try {
print 'Extended Attributes: '
if (Settings.useExtendedFileAttributes()){
// create new temp file
def f = new File(Settings.getApplicationFolder(), '.xattr-test')
f.createNewFile() && f.deleteOnExit()
// xattr write, read and verify
def xattr = new MetaAttributes(f)
def payload = new Date()
xattr.setObject(payload)
assert xattr.getObject() == payload
println 'OK'
} else {
println 'DISABLED'
}
} catch(Throwable error) {
println error
}
// GIO and GVFS
try {
if (Settings.useGVFS()) {
print 'GVFS: '
assert net.filebot.gio.GVFS.defaultVFS != null
println 'OK'
}
} catch(Throwable error) {
println error
}
// Groovy Engine: 2.1.7
println 'Groovy Engine: ' + groovy.lang.GroovySystem.version
// Java(TM) SE Runtime Environment 1.6.0_30 (headless)
println 'JRE: ' + Settings.getJavaRuntimeIdentifier()
// 32-bit Java HotSpot(TM) Client VM
println String.format('JVM: %d-bit %s', com.sun.jna.Platform.is64Bit() ? 64 : 32, _system['java.vm.name'])
// CPU/MEM: 4 Core / 1 GB Max Memory / 15 MB Used Memory
println String.format('CPU/MEM: %s Core / %s Max Memory / %s Used Memory', Runtime.runtime.availableProcessors(), org.apache.commons.io.FileUtils.byteCountToDisplaySize(Runtime.runtime.maxMemory()), org.apache.commons.io.FileUtils.byteCountToDisplaySize(Runtime.runtime.totalMemory() - Runtime.runtime.freeMemory()))
// Windows 7 (x86)
println String.format('OS: %s (%s)', _system['os.name'], _system['os.arch'])
// print uname -a if available
try {
println String.format('uname: %s', ['uname', '-a'].execute().text.trim())
} catch(Throwable error) {
// ignore
}
// check for updates
try {
def update = new XmlSlurper().parse('http://app.filebot.net/update.xml')
def latestRev = update.revision.text() as int
def latestApp = update.name.text()
if (latestRev > Settings.getApplicationRevisionNumber()) {
println "\n--- UPDATE AVAILABLE: $latestApp (r$latestRev) ---\n"
}
} catch(Throwable error) {
// ignore
}