Fancier Stuff
This commit is contained in:
parent
fc728c3da2
commit
15708ceb9b
8
wibe.py
8
wibe.py
@ -29,9 +29,9 @@ def main(token, ip='192.168.3.42', bri=51):
|
|||||||
#pprint(curTrack)
|
#pprint(curTrack)
|
||||||
#pprint(feat)
|
#pprint(feat)
|
||||||
#pprint(palette)
|
#pprint(palette)
|
||||||
speed = min(int((feat['tempo']/60)**3)*8,255)
|
speed = min(int((feat['tempo']/30*feat['energy'])**2.0)*10,255)
|
||||||
power = 16 + int(feat['energy'])*64
|
power = min(8 + int(((feat['energy']*10)**2.0)*0.5),255)
|
||||||
pprint(requests.post(url, json={"seg": [{"col": palette, "pal": wledPalettes['colorGradient'], 'sx': speed, 'ix': power}]}).json())
|
pprint(requests.post(url, json={"seg": [{"col": palette, "pal": wledPalettes['colorsOnly'], 'sx': speed, 'ix': power}]}).json())
|
||||||
time.sleep(3)
|
time.sleep(3)
|
||||||
time.sleep(1)
|
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
|
imgStream = requests.get(curTrack["album"]["images"][-1]["url"]).content #Get the lowest res cover
|
||||||
imgFile = io.BytesIO(imgStream)
|
imgFile = io.BytesIO(imgStream)
|
||||||
print("[i] Generating palette")
|
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
|
return palette
|
||||||
|
|
||||||
def normalizeColor(rgbw):
|
def normalizeColor(rgbw):
|
||||||
|
Loading…
Reference in New Issue
Block a user