parent
5f96b603a8
commit
3615e60e5b
3 changed files with 10 additions and 2 deletions
|
@ -40,6 +40,7 @@ class Module(object):
|
||||||
self.id = self.name
|
self.id = self.name
|
||||||
self._next = int(time.time())
|
self._next = int(time.time())
|
||||||
self._default_interval = 0
|
self._default_interval = 0
|
||||||
|
self.success = True
|
||||||
|
|
||||||
self._configFile = None
|
self._configFile = None
|
||||||
for cfg in [os.path.expanduser("~/.bumblebee-status.conf"), os.path.expanduser("~/.config/bumblebee-status.conf")]:
|
for cfg in [os.path.expanduser("~/.bumblebee-status.conf"), os.path.expanduser("~/.config/bumblebee-status.conf")]:
|
||||||
|
@ -80,7 +81,12 @@ class Module(object):
|
||||||
def update_wrapper(self, widgets):
|
def update_wrapper(self, widgets):
|
||||||
if self._next > int(time.time()):
|
if self._next > int(time.time()):
|
||||||
return
|
return
|
||||||
self.update(self._widgets)
|
try:
|
||||||
|
self.update(self._widgets)
|
||||||
|
self.success = True
|
||||||
|
except Exception as e:
|
||||||
|
log.error("failed to update module {}: {}".format(self.name, str(e)))
|
||||||
|
self.success = False
|
||||||
self._next += int(self.parameter("interval", self._default_interval))*60
|
self._next += int(self.parameter("interval", self._default_interval))*60
|
||||||
|
|
||||||
def interval(self, intvl):
|
def interval(self, intvl):
|
||||||
|
|
|
@ -34,6 +34,8 @@ def getfromkrak(coin, currency):
|
||||||
krakenget = requests.get('https://api.kraken.com/0/public/Ticker?pair='+epair).json()
|
krakenget = requests.get('https://api.kraken.com/0/public/Ticker?pair='+epair).json()
|
||||||
except (RequestException, Exception):
|
except (RequestException, Exception):
|
||||||
return "No connection"
|
return "No connection"
|
||||||
|
if not 'result' in krakenget:
|
||||||
|
return "No data"
|
||||||
kethusdask = float(krakenget['result'][tickname]['a'][0])
|
kethusdask = float(krakenget['result'][tickname]['a'][0])
|
||||||
kethusdbid = float(krakenget['result'][tickname]['b'][0])
|
kethusdbid = float(krakenget['result'][tickname]['b'][0])
|
||||||
return coin+": "+str((kethusdask+kethusdbid)/2)[0:6]
|
return coin+": "+str((kethusdask+kethusdbid)/2)[0:6]
|
||||||
|
|
|
@ -117,7 +117,7 @@ class I3BarOutput(object):
|
||||||
})
|
})
|
||||||
width = self._theme.minwidth(widget)
|
width = self._theme.minwidth(widget)
|
||||||
self._widgets.append({
|
self._widgets.append({
|
||||||
u"full_text": full_text,
|
u"full_text": full_text
|
||||||
"color": self._theme.fg(widget),
|
"color": self._theme.fg(widget),
|
||||||
"background": self._theme.bg(widget),
|
"background": self._theme.bg(widget),
|
||||||
"separator_block_width": self._theme.separator_block_width(widget),
|
"separator_block_width": self._theme.separator_block_width(widget),
|
||||||
|
|
Loading…
Reference in a new issue