Compare commits
No commits in common. "f96c7224a7aca557cad86143c691ac7c4058525a" and "0ce42b645a2b5ba29eb7426dad563a844a9f1fae" have entirely different histories.
f96c7224a7
...
0ce42b645a
3 changed files with 12 additions and 16 deletions
|
|
@ -12,8 +12,6 @@ font = 'Menlo'
|
||||||
font_size = 28
|
font_size = 28
|
||||||
# 30 for chinese
|
# 30 for chinese
|
||||||
|
|
||||||
letter_offset = False
|
|
||||||
|
|
||||||
conf = os.path.expanduser('~/.config/cdosea.json')
|
conf = os.path.expanduser('~/.config/cdosea.json')
|
||||||
if os.path.exists(conf):
|
if os.path.exists(conf):
|
||||||
with open(conf) as fd:
|
with open(conf) as fd:
|
||||||
|
|
|
||||||
|
|
@ -1,8 +1,7 @@
|
||||||
#!/usr/bin/python3
|
#!/usr/bin/python3
|
||||||
import os
|
|
||||||
import string
|
|
||||||
import subprocess
|
import subprocess
|
||||||
import sys
|
import sys
|
||||||
|
import os
|
||||||
import time
|
import time
|
||||||
|
|
||||||
import ox
|
import ox
|
||||||
|
|
@ -96,35 +95,33 @@ def fade_to(target, duration):
|
||||||
CURRENT_STATE = sender[1].dmx_data[:16]
|
CURRENT_STATE = sender[1].dmx_data[:16]
|
||||||
time.sleep(step)
|
time.sleep(step)
|
||||||
steps -= 1
|
steps -= 1
|
||||||
CURRENT_STATE = sender[1].dmx_data = [0] * 16
|
|
||||||
time.sleep(1)
|
time.sleep(1)
|
||||||
sender.stop()
|
sender.stop()
|
||||||
|
|
||||||
|
|
||||||
def switch(state):
|
def switch(state):
|
||||||
|
lights, duration = LIGHTS[state]
|
||||||
if config.lanbox:
|
if config.lanbox:
|
||||||
import lanbox
|
import lanbox
|
||||||
lb = lanbox.Lanbox()
|
lb = lanbox.Lanbox()
|
||||||
|
#lb.getChannels(lights)
|
||||||
|
#lb.fadeTo(lights, fade)
|
||||||
lb.layerGo(state)
|
lb.layerGo(state)
|
||||||
else:
|
else:
|
||||||
lights, duration = LIGHTS[state]
|
|
||||||
brightness = lights['7']
|
brightness = lights['7']
|
||||||
fade_to(brightness, duration)
|
fade_to(brightness, duration)
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
path = sys.argv[1]
|
path = sys.argv[1]
|
||||||
no_sleep = len(sys.argv) > 2 and sys.argv[2] == "no-sleep"
|
no_sleep = len(sys.argv) > 2
|
||||||
|
|
||||||
n = int(os.path.getctime(path) - 1495280000) % 1000
|
n = int(os.path.getctime(path) - 1495280000)
|
||||||
info = ox.avinfo(path)
|
info = ox.avinfo(path)
|
||||||
duration = info.get('duration', 0)
|
duration = info.get('duration', 0)
|
||||||
|
|
||||||
seq = random(n * 100)
|
seq = random(n * 1000)
|
||||||
pos = 0
|
pos = 0
|
||||||
lights = []
|
lights = []
|
||||||
letter_offset = 0
|
|
||||||
if config.letter_offset:
|
|
||||||
letter_offset = 11 + string.ascii_lowercase.index(letter) * 10
|
|
||||||
while pos < duration - 15:
|
while pos < duration - 15:
|
||||||
sleep = seq() + 15
|
sleep = seq() + 15
|
||||||
light = seq()
|
light = seq()
|
||||||
|
|
@ -132,6 +129,5 @@ if __name__ == '__main__':
|
||||||
break
|
break
|
||||||
if not no_sleep:
|
if not no_sleep:
|
||||||
time.sleep(sleep)
|
time.sleep(sleep)
|
||||||
print("letter", letter, "offset", letter_offset, "light", light, "cue", letter_offset + light)
|
switch(light)
|
||||||
switch(light + letter_offset)
|
|
||||||
pos += sleep
|
pos += sleep
|
||||||
|
|
|
||||||
|
|
@ -1,10 +1,12 @@
|
||||||
from mpmath import mp
|
from mpmath import mp
|
||||||
|
mp.dps = 10000
|
||||||
|
PI = str(mp.pi).replace('.', '')
|
||||||
|
|
||||||
class random(object):
|
class random(object):
|
||||||
|
PI = str(mp.pi).replace('.', '')
|
||||||
|
|
||||||
def __init__(self, offset=0):
|
def __init__(self, offset=0):
|
||||||
self.position = offset
|
self.position = offset
|
||||||
mp.dps = 10000 + offset
|
|
||||||
self.PI = str(mp.pi).replace('.', '')
|
|
||||||
self.numbers = list(map(int, self.PI[offset:]))
|
self.numbers = list(map(int, self.PI[offset:]))
|
||||||
|
|
||||||
def __call__(self):
|
def __call__(self):
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue