Skip to content

Commit f4befce

Browse files
Pass a fully formed object to VolumeSynchronizer instead of the constructor and the kwargs, update documentation
1 parent 0c4418c commit f4befce

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

streams/spotify_volume_handler.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ def __init__(self, api_port: int):
2525
super().__init__()
2626

2727
async def watch_vol(self):
28-
"""Watch the go-librespot websocket endpoint for volume change events and update local volume info accordingly"""
28+
"""Watch the go-librespot websocket endpoint for volume change events and update AmpliPi volume info accordingly"""
2929
try:
3030
# Connect to the websocket and listen for state changes
3131
# pylint: disable=E1101
@@ -81,5 +81,5 @@ def set_vol(self, amplipi_volume: float, shared_volume: float) -> float:
8181

8282
args = parser.parse_args()
8383

84-
handler = VolumeSynchronizer(SpotifyData, {"api_port": args.port}, args.stream_id, args.debug)
84+
handler = VolumeSynchronizer(SpotifyData(api_port=args.port), args.stream_id, args.debug)
8585
handler.watcher_loop()

streams/volume_synchronizer.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ def set_vol(self, stream_volume: float, vol_set_point: float):
110110
class VolumeSynchronizer:
111111
"""Volume synchronizer for AmpliPi and another volume-providing stream"""
112112

113-
def __init__(self, stream: StreamData, stream_kwargs: dict, stream_id: int, debug=False):
113+
def __init__(self, stream: StreamData, stream_id: int, debug=False):
114114

115115
self.logger = logging.getLogger(__name__)
116116
self.logger.setLevel(logging.DEBUG if debug else logging.WARNING)
@@ -120,7 +120,7 @@ def __init__(self, stream: StreamData, stream_kwargs: dict, stream_id: int, debu
120120
self.event_queue = queue.Queue()
121121
self.amplipi = AmpliPiData(stream_id, self.on_child_event, self.logger)
122122

123-
self.stream: StreamData = stream(**stream_kwargs)
123+
self.stream: StreamData = stream
124124

125125
# Set these directly so children don't need to add them to their constructors
126126
self.stream.logger = self.logger

0 commit comments

Comments
 (0)