Parcourir la source

remove sound

master
Andreas Demmelbauer il y a 5 ans
Parent
révision
5118e4c68e
2 fichiers modifiés avec 39 ajouts et 10 suppressions
  1. +14
    -10
      discobert.py
  2. +25
    -0
      lircrc

+ 14
- 10
discobert.py Voir le fichier

@@ -23,13 +23,13 @@ class Simple(resource.Resource):
def render_GET(self, request):
statustext = ""
if inUse:
statustext = "Disco in use!"
statustext = "true"
else:
statustext = "Ready to Disco!"
html = '<html><body style="min-height:100vh;display:flex;flex-grow:1;align-items:center;justify-content:center;"><div style="display:flex;font-size:10vw">%s</div></body></html>' % statustext
statustext = "false"
html = '[{"inuse":"%s"}]' % statustext
return html.encode('utf-8')


# GPIO
pin_kugel = 2 # Input: dico ball + DMX on/off
pin_sun = 4 # Input: light bulb on/off
@@ -324,6 +324,10 @@ def startTimeoutCountdown():
tts.say('Shutting down now.', 'en')
closeService()

def inactiveShutdown():
closeService()


def closeService(sleepsecs=0):
setSun('off')
sleep(0.3)
@@ -373,7 +377,7 @@ def setOnOff():
initService()

def doorShutdown():
tts.say(random.choice(bye_sayings), "en")
#tts.say(random.choice(bye_sayings), "en")
# sleep to give user some time to close the door
# (pir sensor also stays up for 2 sec)
closeService(5)
@@ -409,7 +413,6 @@ reactor.listenTCP(8080, site)
reactor.startRunning(False)


lirc.init("disco", "~/discobert/lircrc", blocking=False)

starttime = time.time() # helper for doorshutdown
lastUsed = time.time() # helper for timeout
@@ -425,6 +428,7 @@ setSun('off')

print(timestamp(), "Ready!")

lirc.init("disco", "~/discobert/lircrc", blocking=False)

# Main event loop ...
while True:
@@ -453,7 +457,7 @@ while True:


remotesignal = lirc.nextcode()
#print('remotesignal: ', remotesignal)
print('remotesignal: ', remotesignal)

if remotesignal:
lastUsed = time.time() # user is active!
@@ -517,19 +521,19 @@ while True:
tour()



if(inUseBefore != inUse):
print(timestamp(), "State change inUse:", inUseBefore, inUse)
if inUse:
initService()
else:
startTimeoutCountdown()
inactiveShutdown()
#startTimeoutCountdown()
inUseBefore = inUse

# Webserver
reactor.iterate()


lirc.deinit() # Clean up lirc


dev.close()

+ 25
- 0
lircrc Voir le fichier

@@ -2,54 +2,63 @@ begin
button = KEY_STARTPHONO
prog = disco
config = mode_disco
repeat = 20
end

begin
button = KEY_STOPPHONO
prog = disco
config = mode_work
repeat = 20
end

begin
button = KEY_TAPE
prog = disco
config = mode_power
repeat = 20
end

begin
button = KEY_1
prog = disco
config = mode_music_play_1
repeat = 20
end

begin
button = KEY_2
prog = disco
config = mode_music_play_2
repeat = 20
end

begin
button = KEY_3
prog = disco
config = mode_music_play_3
repeat = 20
end

begin
button = KEY_4
prog = disco
config = mode_music_play_4
repeat = 20
end

begin
button = KEY_5
prog = disco
config = mode_music_play_5
repeat = 20
end

begin
button = KEY_STOP
prog = disco
config = mode_music_stop
repeat = 20
end


@@ -58,6 +67,7 @@ begin
button = KEY_CD
prog = disco
config = mode_help
repeat = 20
end


@@ -65,12 +75,14 @@ begin
button = KEY_VCR2
prog = disco
config = mode_play_fm4
repeat = 20
end

begin
button = KEY_VCR
prog = disco
config = mode_play_oe1
repeat = 20
end


@@ -78,60 +90,70 @@ begin
button = KEY_STOPCD
prog = disco
config = mode_music_stop
repeat = 20
end

begin
button = KEY_RECORD
prog = disco
config = mode_music_info
repeat = 20
end

begin
button = KEY_PAUSE
prog = disco
config = mode_music_pause
repeat = 20
end

begin
button = KEY_PLAY
prog = disco
config = mode_music_play
repeat = 20
end

begin
button = KEY_REWIND
prog = disco
config = mode_music_rewind
repeat = 20
end

begin
button = KEY_BACK
prog = disco
config = mode_music_back
repeat = 20
end

begin
button = KEY_FORWARD
prog = disco
config = mode_music_forward
repeat = 20
end

begin
button = KEY_FASTFORWARD
prog = disco
config = mode_music_fastforward
repeat = 20
end

begin
button = KEY_NEXT
prog = disco
config = mode_music_next
repeat = 20
end

begin
button = KEY_PREVIOUS
prog = disco
config = mode_music_previous
repeat = 20
end

begin
@@ -139,6 +161,7 @@ begin
prog = disco
repeat = 2
config = mode_volume_up
repeat = 20
end

begin
@@ -146,10 +169,12 @@ begin
prog = disco
repeat = 2
config = mode_volume_down
repeat = 20
end

begin
button = KEY_MUTE
prog = disco
config = mode_music_mute
repeat = 20
end

Chargement…
Annuler
Enregistrer