浏览代码

add userinteraction check for timeout

master
Andreas Demmelbauer 4 年前
父节点
当前提交
f1d7f8f819
共有 4 个文件被更改,包括 13 次插入1 次删除
  1. +5
    -1
      discobert.py
  2. +7
    -0
      oe1journal.py
  3. 二进制
     
  4. +1
    -0
      requirements.txt

+ 5
- 1
discobert.py 查看文件

@@ -335,6 +335,7 @@ def closeService(sleepsecs=0):
sleep(0.1)
stopMusic()
inUseBefore = False # Pfusch pfusch!
hadUserInteraction = False # reset variable
setMode('off')
sleep(sleepsecs)

@@ -419,6 +420,7 @@ timeout = 5 * 60 - 5 # timeout since last user interaction
defaultvolume = 90 # Volume when user enters the toilet
volume = 90 # Global for actual volume
uservolume = 90 # Global for user volume (ignores mute state)
hadUserInteraction = False #

setSun('off')

@@ -447,7 +449,8 @@ while True:
lastUsed = time.time()
inUse = True
else:
if(time.time() > lastUsed + timeout):
# Auto timeout
if(time.time() > lastUsed + timeout and not hadUserInteraction):
inUse = False


@@ -457,6 +460,7 @@ while True:

if remotesignal:
lastUsed = time.time() # user is active!
hadUserInteraction = True
inUse = True
for code in remotesignal:
print('received code:', code)


+ 7
- 0
oe1journal.py 查看文件

@@ -0,0 +1,7 @@
import requests
from xml.etree import ElementTree as ET

podcast = 'https://files.orf.at/podcast/oe1/oe1_journale.xml'
podcast_string = requests.get(podcast).text
tree = ET.fromstring(podcast_string)
print(tree.find('.//enclosure').get('url'))

二进制
查看文件


+ 1
- 0
requirements.txt 查看文件

@@ -34,3 +34,4 @@ virtualenv==15.1.0
Werkzeug==0.14.1
wiringpi==2.46.0
youtube-dl==2019.3.18
twisted

正在加载...
取消
保存