kete: rename indices/index to timestamp

That's what it is, it hasn't been an index for a while now.
This commit is contained in:
Peter Hutterer 2018-02-19 10:47:02 +10:00
parent 81d20a5193
commit e0949a2a5e
1 changed files with 8 additions and 8 deletions

View File

@ -270,8 +270,8 @@ class TuhiKeteDevice(_DBusObject):
self.proxy.StopLive() self.proxy.StopLive()
self.live = False self.live = False
def json(self, index): def json(self, timestamp):
return self.proxy.GetJSONData('(u)', index) return self.proxy.GetJSONData('(u)', timestamp)
def _on_signal_received(self, proxy, sender, signal, parameters): def _on_signal_received(self, proxy, sender, signal, parameters):
if signal == 'ButtonPressRequired': if signal == 'ButtonPressRequired':
@ -545,7 +545,7 @@ class Fetcher(Worker):
def __init__(self, manager, args): def __init__(self, manager, args):
super(Fetcher, self).__init__(manager) super(Fetcher, self).__init__(manager)
self.device = None self.device = None
self.indices = None self.timestamps = None
address = args.address address = args.address
index = args.index index = args.index
@ -562,19 +562,19 @@ class Fetcher(Worker):
index = int(index) index = int(index)
if index not in self.device.drawings_available: if index not in self.device.drawings_available:
raise ValueError() raise ValueError()
self.indices = [index] self.timestamps = [index]
except ValueError: except ValueError:
logger.error(f'Invalid index {index}') logger.error(f'Invalid index {index}')
return return
else: else:
self.indices = self.device.drawings_available self.timestamps = self.device.drawings_available
def run(self): def run(self):
if self.device is None or self.indices is None: if self.device is None or self.timestamps is None:
return return
for idx in self.indices: for ts in self.timestamps:
jsondata = self.device.json(idx) jsondata = self.device.json(ts)
data = json.loads(jsondata) data = json.loads(jsondata)
t = time.localtime(data['timestamp']) t = time.localtime(data['timestamp'])
t = time.strftime('%Y-%m-%d-%H-%M', t) t = time.strftime('%Y-%m-%d-%H-%M', t)