def index(device, romtype, incrementalversion): after = request.args.get("after") version = request.args.get("version") roms = Rom.get_roms(device=device, romtype=romtype, before=app.config['BUILD_SYNC_TIME']) if after: roms = roms(datetime__gt=after) if version: roms = roms(version=version) roms = roms.order_by('datetime') data = [] for rom in roms: data.append({ "id": str(rom.id), "url": rom.url, "romtype": rom.romtype, "datetime": int(time.mktime(rom.datetime.timetuple())), "version": rom.version, "filename": rom.filename }) return jsonify({'response': data})
def web_device(device): devices = sorted([x for x in Device.get_devices() if x['model'] in Rom.get_devices()], key=lambda device: device['model']) oems = sorted(list(set([x['oem'] for x in devices]))) roms = Rom.get_roms(device=device, before=app.config['BUILD_SYNC_TIME']) active_oem = [x['oem'] for x in devices if x['model'] == device] active_oem = active_oem[0] if active_oem else None return render_template("device.html", active_oem=active_oem, active_device=device, oems=oems, devices=devices, roms=roms)