blob: 0b6d82a5f6e54d7421e2d8ea49421a295ecbedc3 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
|
import plugins
FILECAT_DEFAULTS = {
'filename': '/etc/hostname', 'title': 'CAT',
'freq': 60, 'nofile': 'unavailable'
}
class PluginThread(plugins.PluginThreadCommon):
def __init__(self, config):
super(PluginThread, self).__init__(config, FILECAT_DEFAULTS)
self.hide = False
def main(self):
try:
with open(self.conf['filename'], 'r') as datafile:
contents = datafile.read().strip()
urgent = False
except FileNotFoundError:
contents = self.conf['nofile']
urgent = True
self.format_status(contents, urgent)
|