Demote start control to warning
This commit is contained in:
parent
8f5dcccf70
commit
c3f6423771
1 changed files with 10 additions and 4 deletions
|
@ -19,13 +19,19 @@ def is_writable(d):
|
||||||
return os.access(d, os.W_OK)
|
return os.access(d, os.W_OK)
|
||||||
|
|
||||||
|
|
||||||
|
def check_remote_store(url: str) -> None:
|
||||||
|
try:
|
||||||
|
with urllib.request.urlopen(url) as req:
|
||||||
|
if req.code not in OK_CODES:
|
||||||
|
logger.warn(f"Audio input {url} not responding")
|
||||||
|
except Exception as e:
|
||||||
|
logger.warn(f"Audio input {url} not accessible: {e}")
|
||||||
|
|
||||||
|
|
||||||
def pre_check_permissions():
|
def pre_check_permissions():
|
||||||
audio_input = get_config()["AUDIO_INPUT"]
|
audio_input = get_config()["AUDIO_INPUT"]
|
||||||
if audio_input.startswith("http://") or audio_input.startswith("https://"):
|
if audio_input.startswith("http://") or audio_input.startswith("https://"):
|
||||||
with urllib.request.urlopen(audio_input) as req:
|
check_remote_store(audio_input)
|
||||||
if req.code not in OK_CODES:
|
|
||||||
yield f"Audio input {audio_input} not accessible"
|
|
||||||
sys.exit(10)
|
|
||||||
else:
|
else:
|
||||||
if is_writable(audio_input):
|
if is_writable(audio_input):
|
||||||
yield "Audio input '%s' writable" % audio_input
|
yield "Audio input '%s' writable" % audio_input
|
||||||
|
|
Loading…
Reference in a new issue