visualizer improvments
This commit is contained in:
parent
2bb8739b38
commit
3dde78fbae
@ -17,7 +17,7 @@ autosens = 1
|
||||
|
||||
# Manual sensitivity in %. Autosens must be turned off for this to take effect.
|
||||
# 200 means double height. Accepts only non-negative values.
|
||||
; sensitivity = 100
|
||||
; sensitivity = 100
|
||||
|
||||
# The number of bars (0-200). 0 sets it to auto (fill up console).
|
||||
# Bars' width and space between bars in number of characters.
|
||||
|
||||
@ -37,18 +37,28 @@ def helpmenu():
|
||||
print("-s <hex-color> set static color")
|
||||
print("-v visualizer")
|
||||
|
||||
def base_color(r,g,b):
|
||||
min_value = min([r,g,b])
|
||||
return r//min_value, g//min_value, b//min_value
|
||||
|
||||
def visualizer(color):
|
||||
r,g,b = hex_to_rgb(color)
|
||||
r_base,g_base,b_base = base_color(r,g,b)
|
||||
cava = subprocess.Popen(["cava", "-p", "/etc/lc/cava.conf"], stdout=subprocess.PIPE)
|
||||
sed = subprocess.Popen(["sed", "-u", "s/;.*;$//"], stdin=cava.stdout, stdout=subprocess.PIPE)
|
||||
#subprocess.Popen([sys.argv[0]], stdin=sed.stdout, shell=False)
|
||||
for line in sed.stdout:
|
||||
line = int(line)
|
||||
r,g,b = hex_to_rgb(color)
|
||||
r = int(r*(line/1000))
|
||||
g = int(g*(line/1000))
|
||||
b = int(b*(line/1000))
|
||||
hex_color = rgb_to_hex(r,g,b)
|
||||
print(r,g,b)
|
||||
r_out = int(r*(line/1000))
|
||||
g_out = int(g*(line/1000))
|
||||
b_out = int(b*(line/1000))
|
||||
# print(line, ',', r_out,g_out,b_out, ' | ', r,g,b)
|
||||
print(r_out,g_out,b_out)
|
||||
if r_out < r_base or g_out < g_base or b_out < b_base:
|
||||
r_out = r_base
|
||||
g_out = g_base
|
||||
b_out = b_base
|
||||
hex_color = rgb_to_hex(r_out,g_out,b_out)
|
||||
send(hex_color)
|
||||
cava.stdout.close()
|
||||
sed.stdout.close()
|
||||
@ -112,7 +122,7 @@ def ambient_light():
|
||||
#GNOMEScreencast.Screencast('/tmp/a', {})
|
||||
#GNOMEScreencast.StopScreencast()
|
||||
#time.sleep(1)
|
||||
|
||||
|
||||
amp = [1,1,0.8]
|
||||
counter = 0
|
||||
start_time = time.time()
|
||||
@ -159,7 +169,7 @@ def ambient_light():
|
||||
_r,_g,_b = vibrant(r,g,b)
|
||||
|
||||
time.sleep(0.05)
|
||||
|
||||
|
||||
|
||||
def rgb_to_hex(r,g,b):
|
||||
return "%02x%02x%02x" % (r,g,b)
|
||||
|
||||
Loading…
Reference in New Issue
Block a user