diff options
| author | Christopher Davis <loafier@gmail.com> | 2006-08-18 06:57:46 +0000 |
|---|---|---|
| committer | Christopher Davis <loafier@gmail.com> | 2006-08-18 06:57:46 +0000 |
| commit | 0fe369309b7bebdabc6899ae1106c9dee4ff2b45 (patch) | |
| tree | 8bab1e185bd70e8956b4aa01b1dc2c9e6ae8e173 /scripts/df.py | |
| parent | fbad6a9f89e360727e42820250c8bdbc8e820743 (diff) | |
| download | irssi-python-0fe369309b7bebdabc6899ae1106c9dee4ff2b45.tar.gz irssi-python-0fe369309b7bebdabc6899ae1106c9dee4ff2b45.tar.xz irssi-python-0fe369309b7bebdabc6899ae1106c9dee4ff2b45.zip | |
added more scripts
git-svn-id: http://svn.irssi.org/repos/irssi-python@4319 dbcabf3a-b0e7-0310-adc4-f8d773084564
Diffstat (limited to 'scripts/df.py')
| -rw-r--r-- | scripts/df.py | 41 |
1 files changed, 41 insertions, 0 deletions
diff --git a/scripts/df.py b/scripts/df.py new file mode 100644 index 0000000..19ff57b --- /dev/null +++ b/scripts/df.py @@ -0,0 +1,41 @@ +""" + Translation of script by Jochem Meyers +""" + +import irssi +import os + +output = '' + +def get_disk_info(): + fp = os.popen('/bin/df -h') + lines = fp.readlines() + ret = [] + + #dev, size, used, avail, pct, mnt_on + maxm = irssi.settings_get_int('df_max_mounts') + for line in lines[1:maxm + 1]: + ret.append(line.split()) + + return ret + +def sb_df(item, get_size): + item.default_handler(get_size, '{sb %s}' % output) + +def refresh_df(): + global output + + tmp = [] + for dev, size, used, avail, pct, mnt_on in get_disk_info(): + tmp.append(' [%s: A: %s U%%%%: %s]' % (dev, avail, pct)) + + output = 'DF' + ''.join(tmp) + irssi.statusbar_items_redraw('df') + irssi.timeout_add(irssi.settings_get_int('df_refresh_time') * 1000, refresh_df) + + return False + +irssi.statusbar_item_register('df', func=sb_df) +irssi.settings_add_int('misc', 'df_refresh_time', 60) +irssi.settings_add_int('misc', 'df_max_mounts', 6) +refresh_df() |
