def rents(): devices = device.get_devices() all_customers = customers.get_customers() all_rents = rent.get_rents() return render_template("/rents.html", devices=devices, customers=all_customers, rents=all_rents)
def __init__(self): threading.Thread.__init__(self) self.devices = get_devices() self.keyfile = ".keymap" # Arquivo padrĂ£o para o mapa de caracteres self.keymap = KeyMap(self.devices) self.listener = Listener(self.devices) self.history = History() self.lock = False self.listen() self.copy = False
def adbc(host): if host is None: host = input('please input android device ip or host name: ') if host == '': print('ERROR: empty ip or host name!') exit() dev_list = device.get_devices() target = '' serial = '' for dev in dev_list: if dev.find_host(host): target = str(dev.device) # print(target) serial = '-s ' + target + ' ' break if target: # disconnect os.system(ADB + ' disconnect' + ' ' + target) # connect os.system('sleep 1') os.system(ADB + ' connect ' + host) # root os.system('sleep 1') os.system(ADB + ' ' + serial + 'root') # reconnect os.system('sleep 1') os.system(ADB + ' connect ' + host) # remount os.system('sleep 1') os.system(ADB + ' ' + serial + 'remount') # remount /tvservice os.system('sleep 1') cmd = ADB + ' ' + serial + 'shell mount -o rw,remount' + ' /tvservice' print(cmd) os.system(cmd) # remount /tvconfig os.system('sleep 1') cmd = ADB + ' ' + serial + 'shell mount -o rw,remount' + ' /tvconfig' print(cmd) os.system(cmd) pass
def client_closed(self, client): """ Callback when a client disconnects. """ log.info('Client disconnected: %s', client) if client in self._clients: self._clients.remove(client) else: for device in get_devices(): if device.client == client: remove_device(device) break else: log.error('unable to find device %s' % client)
def resolve(recordings, schedule): """ Scan the schedule for conflicts. A conflict is a list of recordings with overlapping times. """ log.info('start conflict resolving') devices = [ DeviceSchedule() ] for p in get_devices(): devices.append(DeviceSchedule(p)) devices.sort(lambda l, o: cmp(o.rating,l.rating)) # Sort by start time recordings = recordings[:] recordings.sort( lambda l, o: cmp(l.start - l.start_padding, o.start - o.start_padding)) # all conflicts found conflicts = [] # recordings already scanned scanned = [] # Check all recordings in the list for conflicts for r in recordings: if r in scanned: # Already marked as conflict continue current = [] # Set stop time for the conflict area to current stop time. The # start time doesn't matter since the recordings are sorted by # start time and this is the first stop = r.stop + r.stop_padding while True: for c in recordings[recordings.index(r)+1:]: # Check all recordings after the current 'r' if the # conflict if c in scanned: # Already marked as conflict continue if c.start - c.stop_padding < stop: # Found a conflict here. Mark the item as conflict and # add to the current conflict list current.append(c) scanned.append(c) # Get new stop time and repeat the scanning with it # starting from 'r' + 1 stop = max(stop, c.stop + c.stop_padding) break else: # No new conflicts found, the while True is done break if current: # Conflict found. Mark the current 'r' as conflict and # add it to the conflict list. 'current' will be reset to # [] for the next scanning to get groups of conflicts conflicts.append([ r ] + current) # resolve conflicts while conflicts: conflict = conflicts.pop(0) # some ugly debug log.debug('found conflict:\n %s', '\n '.join([ str(x) for x in conflict ] )) # check all possible solutions for this conflict check_recursive(devices, [], conflict, 0, schedule) yield kaa.NotFinished # done, run callback log.info('finished conflict resolving') yield schedule
def resolve(recordings, schedule): """ Scan the schedule for conflicts. A conflict is a list of recordings with overlapping times. """ log.info('start conflict resolving') devices = [DeviceSchedule()] for p in get_devices(): devices.append(DeviceSchedule(p)) devices.sort(lambda l, o: cmp(o.rating, l.rating)) # Sort by start time recordings = recordings[:] recordings.sort( lambda l, o: cmp(l.start - l.start_padding, o.start - o.start_padding)) # all conflicts found conflicts = [] # recordings already scanned scanned = [] # Check all recordings in the list for conflicts for r in recordings: if r in scanned: # Already marked as conflict continue current = [] # Set stop time for the conflict area to current stop time. The # start time doesn't matter since the recordings are sorted by # start time and this is the first stop = r.stop + r.stop_padding while True: for c in recordings[recordings.index(r) + 1:]: # Check all recordings after the current 'r' if the # conflict if c in scanned: # Already marked as conflict continue if c.start - c.stop_padding < stop: # Found a conflict here. Mark the item as conflict and # add to the current conflict list current.append(c) scanned.append(c) # Get new stop time and repeat the scanning with it # starting from 'r' + 1 stop = max(stop, c.stop + c.stop_padding) break else: # No new conflicts found, the while True is done break if current: # Conflict found. Mark the current 'r' as conflict and # add it to the conflict list. 'current' will be reset to # [] for the next scanning to get groups of conflicts conflicts.append([r] + current) # resolve conflicts while conflicts: conflict = conflicts.pop(0) # some ugly debug log.debug('found conflict:\n %s', '\n '.join([str(x) for x in conflict])) # check all possible solutions for this conflict check_recursive(devices, [], conflict, 0, schedule) yield kaa.NotFinished # done, run callback log.info('finished conflict resolving') yield schedule
def devices(): all_devices = device.get_devices() return render_template("devices.html", devices=all_devices)
def services(): devices = device.get_devices() services = service.get_services() return render_template("/add_service.html", devices=devices, services=services)