From f1d7f8f8199b280cd32dff2dcc0e062f7f1179c6 Mon Sep 17 00:00:00 2001 From: Andreas Demmelbauer Date: Sun, 22 Nov 2020 18:36:55 +0100 Subject: [PATCH] add userinteraction check for timeout --- discobert.py | 6 +++++- oe1journal.py | 7 +++++++ remotes/.Sony-RM-V33E.lircd.conf.swp | Bin 0 -> 12288 bytes requirements.txt | 1 + 4 files changed, 13 insertions(+), 1 deletion(-) create mode 100644 oe1journal.py create mode 100644 remotes/.Sony-RM-V33E.lircd.conf.swp diff --git a/discobert.py b/discobert.py index 605b3ee..3d539d8 100644 --- a/discobert.py +++ b/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) diff --git a/oe1journal.py b/oe1journal.py new file mode 100644 index 0000000..7df4b1c --- /dev/null +++ b/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')) diff --git a/remotes/.Sony-RM-V33E.lircd.conf.swp b/remotes/.Sony-RM-V33E.lircd.conf.swp new file mode 100644 index 0000000000000000000000000000000000000000..1c81835a0dbe9fa049a4ea2fd36c3d3fab0523f6 GIT binary patch literal 12288 zcmeI2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aZI`is0FTgf_y7O^ literal 0 HcmV?d00001 diff --git a/requirements.txt b/requirements.txt index 793f8bd..d907ff6 100644 --- a/requirements.txt +++ b/requirements.txt @@ -34,3 +34,4 @@ virtualenv==15.1.0 Werkzeug==0.14.1 wiringpi==2.46.0 youtube-dl==2019.3.18 +twisted