Skip to content

Commit

Permalink
better handling of null source. bumped patch version
Browse files Browse the repository at this point in the history
  • Loading branch information
jonahshader committed Jan 2, 2023
1 parent 835e836 commit 243402b
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 14 deletions.
30 changes: 17 additions & 13 deletions src/app/polling.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,8 @@ def poll():
if zone is not None:
source_id = zone['source_id']
source = get_source(source_id)
if source is None:
return
source_name = source['name']
_audioconf.stream_id = api.get_stream_id_from_source_dict(source)
stream = api.get_stream(_audioconf.stream_id)
Expand All @@ -64,6 +66,8 @@ def poll():
try:
source_id = group['source_id']
source = get_source(source_id)
if source is None:
return
# if success, we are no longer waiting on the user to fix the invalid group
_awaiting_user_input = False
print('group valid')
Expand All @@ -75,13 +79,12 @@ def poll():
displayserial.change_page(displayserial.GROUP_INVALID_PAGE_NAME)
_awaiting_user_input = True

if source is not None:
new_stream_id = api.get_stream_id_from_source_dict(source)
if new_stream_id is not None:
_audioconf.stream_id = new_stream_id
stream = api.get_stream(_audioconf.stream_id)
else:
_audioconf.stream_id = -1
new_stream_id = api.get_stream_id_from_source_dict(source)
if new_stream_id is not None:
_audioconf.stream_id = new_stream_id
stream = api.get_stream(_audioconf.stream_id)
else:
_audioconf.stream_id = -1

if not _skip_next_vol_f:
poll_vol_f(group)
Expand Down Expand Up @@ -166,12 +169,13 @@ def poll_stream_name(stream, source):
global stream_type
new_stream_type = None
new_stream_name = ''
if source['input'].startswith('local'):
new_stream_type = 'rca'
new_stream_name = source['name']
elif stream is not None:
new_stream_name = stream['name']
new_stream_type = stream['type']
if stream is not None:
if source['input'].startswith('local'):
new_stream_type = 'rca'
new_stream_name = source['name']
else:
new_stream_name = stream['name']
new_stream_type = stream['type']
if new_stream_name != stream_name:
stream_name = new_stream_name
send_stream_name(stream_name)
Expand Down
2 changes: 1 addition & 1 deletion src/app/sysconsts.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import json

VERSION = '0.2.14'
VERSION = '0.2.15'
MIN_AMPLIPI_VERSION = '0.1.7'

WALL_PANEL_REPO = 'micro-nova/AmpliPiWallPanel'
Expand Down

0 comments on commit 243402b

Please sign in to comment.