diff --git a/mopidy_iris/__init__.py b/mopidy_iris/__init__.py index 5b111540..7c9ab474 100755 --- a/mopidy_iris/__init__.py +++ b/mopidy_iris/__init__.py @@ -40,6 +40,7 @@ class Extension( ext.Extension ): schema['snapcast_enabled'] = config.Boolean() schema['snapcast_host'] = config.String() schema['snapcast_port'] = config.Integer() + schema['snapcast_buffer_size'] = config.Integer() return schema def setup(self, registry): diff --git a/mopidy_iris/ext.conf b/mopidy_iris/ext.conf index beb8b134..90826452 100755 --- a/mopidy_iris/ext.conf +++ b/mopidy_iris/ext.conf @@ -8,3 +8,4 @@ genius_authorization_url = https://jamesbarnsley.co.nz/iris/auth_genius.php snapcast_enabled = false snapcast_host = localhost snapcast_port = 1705 +snapcast_buffer_size = 8192 diff --git a/mopidy_iris/snapcast.py b/mopidy_iris/snapcast.py index fefa6ad7..e7d0e4ec 100755 --- a/mopidy_iris/snapcast.py +++ b/mopidy_iris/snapcast.py @@ -46,6 +46,7 @@ class IrisSnapcast(object): self.connect() self.listen = True + buffer_size = int(self.config['iris']['snapcast_buffer_size']) logger.info("Established Snapcast listener") broadcast(data={'method':'snapcast_connected'}) @@ -67,9 +68,8 @@ class IrisSnapcast(object): # Rread and print the available data on any of the read list for socket in readlist: - - # Allow a relatively large buffer size to handle large JSON payloads - message = socket.recv(8192) + + message = socket.recv(buffer_size) try: message = json.loads(message)