diff --git a/wibe.py b/wibe.py index fefa920..f7035fe 100644 --- a/wibe.py +++ b/wibe.py @@ -29,9 +29,9 @@ def main(token, ip='192.168.3.42', bri=51): #pprint(curTrack) #pprint(feat) #pprint(palette) - speed = min(int((feat['tempo']/60)**3)*8,255) - power = 16 + int(feat['energy'])*64 - pprint(requests.post(url, json={"seg": [{"col": palette, "pal": wledPalettes['colorGradient'], 'sx': speed, 'ix': power}]}).json()) + speed = min(int((feat['tempo']/30*feat['energy'])**2.0)*10,255) + power = min(8 + int(((feat['energy']*10)**2.0)*0.5),255) + pprint(requests.post(url, json={"seg": [{"col": palette, "pal": wledPalettes['colorsOnly'], 'sx': speed, 'ix': power}]}).json()) time.sleep(3) time.sleep(1) @@ -39,7 +39,7 @@ def getPalette(curTrack,numColors): imgStream = requests.get(curTrack["album"]["images"][-1]["url"]).content #Get the lowest res cover imgFile = io.BytesIO(imgStream) print("[i] Generating palette") - palette = [normalizeColor([col.rgb[c] for c in range(3)]+[0]) for col in sorted(colorgram.extract(imgFile, numColors), key=lambda c: c.hsl.h)] #c.proportion + palette = [normalizeColor([col.rgb[c] for c in range(3)]+[0]) for col in sorted(colorgram.extract(imgFile, numColors), key=lambda c: c.proportion + 0*c.hsl.h)] return palette def normalizeColor(rgbw):