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