Files
Iris/mopidy_iris/snapcast_thread.py

33 lines
670 B
Python
Raw Normal View History

2018-11-03 23:19:03 +13:00
from threading import Thread
import os, logging, subprocess, socket, json, random, string
from .snapcast import IrisSnapcast
# import logger
logger = logging.getLogger(__name__)
class IrisSnapcastThread(Thread):
sock = None
2018-11-03 23:19:03 +13:00
def __init__(self, config, broadcast):
Thread.__init__(self)
self.config = config
self.broadcast = broadcast
##
# This thread has been started
##
def run(self):
self.sock = IrisSnapcast(self.config)
self.sock.listen(self.broadcast)
##
# Instruction to stop this thread
##
def close(self):
self.sock.stop_listening()